You copied the Doc URL to your clipboard.

BX

Branch and exchange instruction set.

Syntax

BX{cond} Rm

where:

cond

is an optional condition code. cond is not available on all forms of this instruction.

Rm

is a register containing an address to branch to.

Operation

The BX instruction causes a branch to the address contained in Rm. and exchanges the instruction set, if required:

  • BX Rm derives the target instruction set from bit[0] of Rm:

    • if bit[0] of Rm is 0, the processor changes to, or remains in, ARM state

    • if bit[0] of Rm is 1, the processor changes to, or remains in, Thumb state.

Instruction availability and branch ranges

Table 11 shows the instructions that are available in ARM and Thumb state. Instructions that are not shown in this table are not available. Notes in brackets show the first architecture version where the instruction is available.

Table 11. Branch instruction availability and range
InstructionARM Thumb, 16-bit encodingThumb, 32-bit encoding
BX Rm [a]Available(4T, 5)Available(All T)Use 16-bit(All T2)
BX{cond} Rm [a]Available(4T, 5)- --

[a] The assembler accepts BX{cond} Rm for code assembled for ARMv4 and converts it to MOV{cond} PC, Rm at link time, unless objects targeted for ARMv4T are present.


BX in ThumbEE

You can use the BX instruction as a branch in ThumbEE code, but you cannot use it to change state. Bit[0] of Rm must be 1, and execution continues at the target address in ThumbEE state.

Register restrictions

You can use PC for Rm in the ARM BX instruction, but this is deprecated in ARMv6T2 and above. You cannot use PC in other ARM instructions.

You can use PC for Rm in the Thumb BX instruction. You cannot use PC in other Thumb instructions.

You can use SP for Rm in the ARM BX instruction but this is deprecated in ARMv6T2 and above.

You can use SP for Rm in the Thumb BX instruction, but this is deprecated.

Condition flags

The BX instruction does not change the flags.

Architectures

See Table 11 for details of availability of the BX instruction in each architecture.

See also