BX

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

fixed bit field field the encoding fixes should be

A1

313029282726252423222120191817161514131211109876543210
cond000100101111111111110001Rm

xxxx000100101111111111110001xxxx
cond != 1111

Decode Sail

if ConditionPassed() then {
    assert(cond != 0b1111);
    let 'm = UInt(Rm);
    execute_aarch32_instrs_BX_Op_A_txt(m)
};
()

T1

1514131211109876543210
010001110Rm000

010001110xxxx000

Decode Sail

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

ScarletNX: legacy BX

1514131211109876543210
010001110

010001110xxxxxxx
ArchVersion() < 5

Decode Sail

ScarletNX's fixup: The ARM7TDMI's BX takes no notice of bits 2 to 0, which should be zero (the later architectures' (0)(0)(0): no clause has such a halfword there): it branches with them set, before ARMv5. Sail-arm's BX T1 with no IT block to check

if ConditionPassed() then {
    execute_aarch32_instrs_BX_Op_A_txt(UInt(Rm))
};
()

Operation Sail

BXWritePC(R_read(m), BranchType_INDIR)

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.