SNEZ

Set if Not Equal to Zero

SNEZ rd, rs

Sets rd to 1 if rs is not zero, otherwise 0.

Details

SNEZ writes 1 to rd if rs1 is non-zero, and 0 otherwise. It is a pseudoinstruction for SLTU rd, x0, rs1.

Pseudocode Operation

R[rd] = (R[rs] != 0) ? 1 : 0;

Example

SNEZ x5, x10

Encoding

Binary Layout
0000000
31:25
rs2
24:20
00000
19:15
011
14:12
rd
11:7
0110011
6:0
 
Format R-Type
Opcode 0x33
Extension Pseudo

Operands

  • rd
    Destination register (integer)
  • rs
    Source