BLX (register)

A32: data processing and miscellaneous instructions / T32: 16-bit instructions

fixed bit field field the encoding fixes should be

A1

313029282726252423222120191817161514131211109876543210
cond000100101111111111110011Rm

xxxx000100101111111111110011xxxx
cond != 1111

Decode Sail

if ConditionPassed() then {
    assert(cond != 0b1111);
    let 'm = UInt(Rm);
    if m == 15 then {
        throw(Error_Unpredictable())
    };
    execute_aarch32_instrs_BLX_r_Op_A_txt(m)
};
()

T1

1514131211109876543210
010001111Rm000

010001111xxxx000

Decode Sail

if ConditionPassed() then {
    let 'm = UInt(Rm);
    if m == 15 then {
        throw(Error_Unpredictable())
    };
    if InITBlock() & not_bool(LastInITBlock()) then {
        throw(Error_Unpredictable())
    };
    execute_aarch32_instrs_BLX_r_Op_A_txt(m)
};
()

Operation Sail

let target : bits(32) = R_read(m);
next_instr_addr : bits(32) = undefined;
if CurrentInstrSet() == InstrSet_A32 then {
    let next_instr_addr : bits(32) = PC_read__1() - 4;
    LR_write() = next_instr_addr
} else {
    let next_instr_addr : bits(32) = PC_read__1() - 2;
    LR_write() = next_instr_addr[31 .. 1] @ 0b1
};
BXWritePC(target, BranchType_INDCALL)

Made from ScarletNX's Sail at 166ad3910f80. sail-arm's definitions are Arm's ASL in Sail (BSD 3-Clause Clear, license); ScarletNX's fixups are GPL-3.0-or-later.