You copied the Doc URL to your clipboard.

Conditional execution in Thumb state

In Thumb state on processors before ARMv6T2, the only mechanism for conditional execution is a conditional branch. You can conditionally skip over the instruction using a conditional branch instruction.

In Thumb state on ARMv6T2 or later processors, instructions can also be conditionally executed by:

  • using CBZ and CBNZ

  • using the IT (If-Then) instruction.

The Thumb CBZ (Conditional Branch on Zero) and CBNZ (Conditional Branch on Non-Zero) instructions compare the value of a register against zero and branch on the result.

IT is a 16-bit instruction that enables almost all Thumb instructions to be conditionally executed, on the value of the ALU flags, using the condition code suffix. Each IT instruction provides conditional execution for up to four following instructions.

    ; flags set by a previous instruction
    ITT   EQ
    LSLEQ r0, r0, #24
    ADDEQ r0, r0, #2