RISC-V negw Pseudo-Instruction Details
Assembler pseudo-instructionRISC-V negw is an RV64 assembler pseudo-instruction that expands to subw rd, x0, rs. SUBW subtracts in the low 32 bits, then sign-extends the 32-bit result to XLEN.
What This Pseudo Instruction Is Saving You From Writing
The assembly manual lists negw as the standard pseudo-instruction spelling for subw rd, x0, rs, with a two's-complement word meaning.
Availability And Extension Conditions
- RV64I
- SUBW rd, x0, rs
- The result is computed in the low 32 bits and sign-extended; original upper bits are not preserved.
How To Read The Expansion
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.
FAQ
Is negw a real RISC-V instruction?
negw 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 negw?
negw applies only to RV64I; its low-32-bit result is sign-extended to XLEN.