it
If-Then (Thumb)
Makes up to 4 following instructions conditional (Thumb-only).
Pseudocode Operation
itState ← (condition, mask); // Sets IT block state; following 1-4 instructions are conditional based on itState
Example
Encoding
Operands
-
cond
Condition
Related
More in T32 (Thumb)
Reference
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;