You copied the Doc URL to your clipboard.

ARM Compiler armasm User Guide : Conditional execution in T32 code

Conditional execution in T32 code

In T32 code, there are several ways to achieve conditional execution. You can conditionally skip over the instruction using a conditional branch instruction.

Instructions can also be conditionally executed by using either of the following:

  • CBZ and CBNZ.
  • The IT (If-Then) instruction.

The T32 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 a single subsequent 16-bit T32 instruction from a restricted set to be conditionally executed, based on the value of the condition flags, and the condition code suffix specified.

Conditional instructions using IT block
; flags set by a previous instruction
    IT   EQ
    LSLEQ r0, r0, #24

The use of the IT instruction is deprecated when any of the following are true:

  • There is more than one instruction in the IT block.
  • There is a 32-bit instruction in the IT block.
  • The instruction in the IT block references the PC.

Related reference

Was this page helpful? Yes No