Home/Instructions/CZERO-EQZ
CZERO.EQZ

RISC-V CZERO.EQZ Instruction Details

Instruction ManualR-type

Conditional zero: if rs2==0 then rd=0, else rd=rs1

Instruction Syntax

czero.eqz rd, rs1, rs2
Operand Breakdown
Destination rd: register receiving the operation result.
Source rs1: register holding the first operand.
Source rs2: register holding the second operand.
ZicondConditional Operations

Instruction Behavior

czero.eqz is a Zicond conditional-zero instruction. If rs2 is equal to zero, rd is written with zero; otherwise rd is written with rs1.

Quick Understanding & Search Notes

czero.eqz is a Zicond conditional-zero instruction. If rs2 is equal to zero, rd is written with zero; otherwise rd is written with rs1.

It can be used to build branchless conditional-select sequences, but architecturally it only conditionally writes zero.
rd has syntactic dependencies on both rs1 and rs2, as defined by the official manual.

Common Usage Scenarios

Branch & Jump

Understand this scenario with real code like «czero.eqz x10, x11, x12 ; x10 = (x12 == 0) ? 0 : x11».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is R-type.
  • Confirm the operand order matches the example.
Semantic Check
  • Ensure the destination register usage is compatible with the calling convention.
  • Confirm this is not the lower-level form of a pseudo-instruction expansion.

Pitfalls / Common Confusions

It selects only between zero and rs1; it does not branch and does not access memory.
The condition tests whether rs2 is zero; it does not compare rs1 with rs2.

FAQ

Is czero.eqz a conditional branch?

No. It does not change the PC; it selects zero or rs1 based on whether rs2 is zero.

Does czero.eqz compare two register magnitudes?

No. The condition only tests whether rs2 is zero.