RISC-V bnez Pseudo-Instruction Details
Assembler pseudo-instructionBranch if not equal zero pseudo-instruction, expands to bne rs, x0, offset. Branches when a register is non-zero. Common for non-null guard checks, loop continuation, and boolean testing.
What This Pseudo Instruction Is Saving You From Writing
More naturally expresses 'if non-zero, branch' control flow than bne rs, x0, offset. Complements beqz, together covering all zero/non-zero branch needs.
Official Semantics Checklist
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 bnez a real RISC-V instruction?
bnez 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 bnez?
±4 KiB branch range limit — far branches need bnez + j combo