bl

Branch with Link (A32)

BL<c> <label>

Calls a subroutine, storing return address in LR (R14).

Details

Calls a subroutine by performing a relative branch to a label and storing the return address (address of the next instruction after BL) in the link register (LR, R14). The branch offset is ±32 MB from the current instruction. Branch is conditional based on the specified condition code. Executes in A32 only.

Pseudocode Operation

if condition_satisfied then
  LR ← PC + 4
  PC ← PC + (sign_extend(imm24) << 2) + 8

Example

BL label

Encoding

Binary Layout
cond
101
1
imm24
 
Format Branch
Opcode 0x0B000000
Extension A32 (Base)

Operands

  • label
    Label

Reference (Arm AArch32 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x0B000000 BL{<c>}{<q>} <label> A32 cond | 101 | 1 | imm24
0xF000D000 BL{<c>}{<q>} <label> T32 11110 | S | imm10 | 11 | J1 | 1 | J2 | imm11

Description

Branch with Link calls a subroutine at a PC-relative address, and setting LR to the return address. Branch with Link and Exchange Instruction Sets (immediate) calls a subroutine at a PC-relative address, setting LR to the return address, and changes the instruction set from A32 to T32, or from T32 to A32.

Operation

if ConditionPassed() then
    EncodingSpecificOperations();
    if CurrentInstrSet() == InstrSet_A32 then
        LR = PC - 4;
    else
        LR = PC<31:1> : '1';
    bits(32) targetAddress;
    if targetInstrSet == InstrSet_A32 then
        targetAddress = Align(PC,4) + imm32;
    else
        targetAddress = PC + imm32;
    SelectInstrSet(targetInstrSet);
    BranchWritePC(targetAddress, BranchType_DIRCALL);