it
If-Then (Thumb)
IT{x{y{z}}} <cond>
Makes up to 4 following instructions conditional (Thumb-only).
Details
If-Then creates an IT block in Thumb mode, making up to 4 following instructions conditionally executed based on the condition code and optional xyz masks. The condition code and mask pattern determine which instructions execute. No condition flags are modified by IT itself; subsequent instructions execute based on the condition. T32-only; not available in AArch64 or A32 modes.
Pseudocode Operation
itState ← (condition, mask); // Sets IT block state; following 1–4 instructions are conditional based on itState
Example
IT}} cond
Encoding
Binary Layout
10111111
firstcond
mask
Operands
-
cond
Condition
Reference (Arm AArch32 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0xBF00 | IT{<x>{<y>{<z>}}}{<q>} <cond> | T32 | 10111111 | firstcond | mask |
Description
If-Then makes up to four following instructions (the IT block) conditional. The conditions for the instructions in the IT block are the same as, or the inverse of, the condition the IT instruction specifies for the first instruction in the block.
The IT instruction itself does not affect the condition flags, but the execution of the instructions in the IT block can change the condition flags.
16-bit instructions in the IT block, other than CMP, CMN and TST, do not set the condition flags. An IT instruction with the AL condition can change the behavior without conditional execution.
The architecture permits exception return to an instruction in the IT block only if the restoration of the CPSR restores PSTATE.IT to a state consistent with the conditions specified by the IT instruction. Any other exception return to an instruction in an IT block is unpredictable. Any branch to a target instruction in an IT block is not permitted, and if such a branch is made it is unpredictable what condition is used when executing that target instruction and any subsequent instruction in the IT block.
Many uses of the IT instruction are deprecated for performance reasons, and an implementation might include ITD controls that can disable those uses of IT, making them undefined.
For more information see Conditional execution and Conditional instructions. The first of these sections includes more information about the ITD controls.
Operation
EncodingSpecificOperations(); AArch32.CheckITEnabled(mask); PSTATE.IT<7:0> = firstcond:mask; ShouldAdvanceIT = FALSE;