tbz

Test Bit Zero

TBZ <Wt|Xt>, #<imm>, <label>

Branches if specified bit is 0.

Details

Tests the bit at position imm in register Wt|Xt; if the bit is 0 (zero), branches to label. The bit position is specified by b5:imm14 (6-bit total index). This is an AArch64-only instruction. No arithmetic flags are modified by the test itself; the branch updates PC.

Pseudocode Operation

bit_index ← (b5 << 5) | imm14; if (Wt|Xt)[bit_index] == 0 then PC ← label

Example

TBZ Wt, #16, label

Encoding

Binary Layout
b5
011011
0
b40
imm14
Rt
 
Format Branch
Opcode 0x36000000
Extension Base

Operands

  • Wt
    Reg
  • imm
    Bit
  • label
    Label

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x36000000 TBZ <R><t>, #<imm>, <label> A64 b5 | 011011 | 0 | b40 | imm14 | Rt

Description

Test bit and Branch if Zero compares the value of a test bit 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) operand = X[t, datasize];
if operand<bit_pos> == op then
    BranchTo(PC64 + offset, BranchType_DIR, TRUE);
else
    BranchNotTaken(BranchType_DIR, TRUE);