b.cond

Branch Conditional

B.cond <label>

Branch if condition is met (e.g., B.EQ, B.NE).

Details

Conditional branch to a PC-relative label in AArch64, executed only if the specified condition is true. The 19-bit signed immediate is shifted left by 2 and added to the current PC. No condition flags are modified by this instruction. This is an AArch64-only instruction.

Pseudocode Operation

if ConditionHolds(cond) then
  PC ← PC + (SignExtend(imm19, 64) << 2)

Example

B.cond label

Encoding

Binary Layout
01010100
imm19
0
cond
 
Format Branch
Opcode 0x54000000
Extension Base

Operands

  • label
    Label
  • cond
    Condition

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x54000000 B.<cond> <label> A64 01010100 | imm19 | 0 | cond
0x14000000 B <label> A64 0 | 00101 | imm26

Description

Branch conditionally to a label at a PC-relative offset, with a hint that this is not a subroutine call or return.

Operation

if ConditionHolds(cond) then
    BranchTo(PC64 + offset, BranchType_DIR, TRUE);
else
    BranchNotTaken(BranchType_DIR, TRUE);