RISC-V zext-w Pseudo-Instruction Details
Assembler pseudo-instructionRV64 zero-extend-word pseudo-instruction that keeps the low 32 bits and clears the high bits. Without Zba it can use an slli/srli sequence; with Zba it can use add.uw.
What This Pseudo Instruction Is Saving You From Writing
On RV64, 32-bit unsigned values need the high 32 bits cleared; zext.w expresses that intent and lets the toolchain choose add.uw or a shift sequence based on Zba availability.
Official Semantics Checklist
Availability And Extension Conditions
- Mainly for RV64
- Zba provides the ADD.UW path
- On RV32, 32-bit zero extension does not have the same meaning because XLEN is already 32.
Toolchain And Linker Boundaries
How To Read The Expansion
What You May See In objdump / Disassembly
Official References And Reading Order
This page treats pseudo-instructions as assembler-level aliases or macros: first read what real instructions they expand to, then use the official ISA manual for the behavior of those real instructions. ABI, relocation, and linker-relaxation details follow the psABI document.
When To Think Of It First
Pitfalls / Common Confusions
FAQ
Is zext-w a real RISC-V instruction?
zext-w is an assembler pseudo-instruction or alias, not a separate hardware opcode. The “Typical Real Expansion” section lists the official expansion, and behavior is defined by the expanded ISA instructions.
What is the main trap when using zext-w?
Only meaningful when XLEN is greater than 32, mainly RV64