tbnz

Test Bit Not Zero

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

Branches if specified bit is 1.

Pseudocode Operation

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

Example

TBNZ Wt, #16, label

Encoding

Binary Layout
b5
31
011011
30:25
1
24
b40
23:19
imm14
18:5
Rt
4:0
 
Format Branch
Opcode 0x37000000
Extension Base

Operands

  • Wt
    Reg
  • imm
    Bit
  • label
    Label

Related

More in Base

Reference

Instruction Forms

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

Description

Test bit and Branch if Nonzero compares the value of a bit in a general-purpose register with zero, and conditionally branches to a label at a PC-relative offset if the comparison is not 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);