SNEZ
Set if Not Equal to Zero
SNEZ rd, rs
Sets rd to 1 if rs is not zero, otherwise 0.
Encoding
Binary Layout
0000000
31:25
rs2
24:20
00000011
19:12
rd
11:7
0110011
6:0
Operands
-
rd
Destination register (integer) -
rs
Source
Example
SNEZ x5, x10
// Sets x5 to 1 if x10 is non-zero.
Related
More in Pseudo
Reference
View in RISC-V Unprivileged ISA Specification ↗
RISC-V ISA Manual
Description
SNEZ writes 1 to rd if rs1 is non-zero, and 0 otherwise. It is a pseudoinstruction for SLTU rd, x0, rs1.
Operation
R[rd] = (R[rs] != 0) ? 1 : 0;