RISC-V zext-h Pseudo-Instruction Details
Assembler pseudo-instructionZero-extend-halfword pseudo-instruction that keeps the low 16 bits and clears the high bits. Without Zbb it can use a shift-left/logical-shift-right sequence; with Zbb it can use a single instruction form.
What This Pseudo Instruction Is Saving You From Writing
Halfword data often needs conversion to an unsigned integer; zext.h explicitly means zero-extend the low 16 bits and lets the toolchain choose an implementation based on Zbb availability.
Official Semantics Checklist
Availability And Extension Conditions
- RV32I/RV64I can express it with a shift sequence
- Zbb provides the real ZEXT.H instruction
- Zero-extends the low 16 bits; it is not sign extension.
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-h a real RISC-V instruction?
zext-h 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-h?
The available sequence depends on Zbb support