cbz
Compare and Branch Zero (64-bit)
CBZ <Xt>, <label>
Branches if 64-bit register is zero.
Pseudocode Operation
if Xt == 0 then
PC ← PC + SignExtend(imm19 << 2, 64)
Example
CBZ x3, label
Encoding
Binary Layout
1
31
011010
30:25
0
24
imm19
23:5
Rt
4:0
Operands
-
Xt
Reg -
label
Label
Related
Other forms of cbz
Across architectures
Compare and Branch : how x86, ARM, RISC-V, and PowerISA each do this.
More in Base
Reference
View in Arm A64 ISA Reference ↗
Arm A64 ISA
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x34000000 | CBZ <Wt>, <label> | A64 | 0 | 011010 | 0 | imm19 | Rt | ||
| 0xB4000000 | CBZ <Xt>, <label> | A64 | 1 | 011010 | 0 | imm19 | Rt |
Description
Compare and Branch on Zero compares the value in a register with zero, and conditionally branches to a label at a PC-relative offset if the comparison is equal. It provides a hint that this is not a subroutine call or return. This instruction does not affect condition flags.
Operation
bits(datasize) operand1 = X[t, datasize];
if IsZero(operand1) == TRUE then
BranchTo(PC64 + offset, BranchType_DIR, TRUE);
else
BranchNotTaken(BranchType_DIR, TRUE);