BNE
Branch if Not Equal
BNE rs1, rs2, offset
Take the branch if registers rs1 and rs2 are not equal.
Details
BNE takes the branch if rs1 is not equal to rs2. The branch target is the PC of the branch plus the sign-extended B-immediate within a ±4 KiB range.
Pseudocode Operation
if (R[rs1] != R[rs2]) PC += sext(offset);
Example
BNE x5, x6, loop
Encoding
Binary Layout
imm[12
10:5]
rs2
31:27
rs1
26:22
001
21:19
imm[4:1
11]
1100011
18:12
Operands
-
rs1
Source register 1 (integer) -
rs2
Source register 2 (integer) -
offset
PC-relative offset