bl.w

Branch with Link (Wide)

BL.W <label>

Thumb-2 32-bit Branch with Link.

Details

Thumb-2 32-bit branch with link and large range (±16 MB). Stores return address (next instruction) in LR and branches to the target computed from the S, imm10, J1, J2, imm11 fields. No condition flags are affected.

Pseudocode Operation

if ConditionPassed() then
  LR ← PC + 4 | 1
  offset ← SignExtend(S || imm10 || J1 || J2 || imm11, 24)
  PC ← PC + (offset << 1)

Example

BL.W label

Encoding

Binary Layout
11110
S
imm10
11
J1
1
J2
imm11
 
Format Thumb Branch
Opcode 0xF000D000
Extension T32 (Thumb2)

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);