| |||
| Home > NEON and VFP Programming > Condition codes | |||
In ARM state, you can use a condition code to control the execution of VFP instructions. The instruction is executed conditionally, according to the status flags in the APSR, in exactly the same way as almost all other ARM instructions.
In ARM state, except for the instructions that are common to both VFP and NEON, you cannot use a condition code to control the execution of NEON instructions.
In Thumb® state
on a Thumb-2 processor, you can use an IT instruction
to set condition codes on up to four following NEON or VFP instructions.
See IT for details.
The only VFP instruction that can be used to update the status
flags is VCMP. It does not update the flags in the
APSR directly, but updates a separate set of flags in the FPSCR (see FPSCR, the floating‑point status and control register).
To use these flags to control conditional instructions, including
conditional VFP instructions, you must first copy them into the
APSR using a VMRS instruction (see VMRS and VMSR).
Following an VCMP instruction, the precise meanings
of the flags are different from their meanings following an ARM
data processing instruction. This is because:
floating-point values are never unsigned, so the unsigned conditions are not required
Not-a-Number (NaN) values have no ordering relationship with numbers or with each other, so additional conditions are required to account for unordered results.
The meanings of the condition code mnemonics are shown in Table 5.4.
Table 5.4. Condition codes
| Mnemonic | Meaning after ARM data processing instruction | Meaning after VFP VCMP instruction |
|---|---|---|
EQ | Equal | Equal |
NE | Not equal | Not equal, or unordered |
CS or HS | Carry set or Unsigned higher or same | Greater than or equal, or unordered |
CC or LO | Carry clear or Unsigned lower | Less than |
MI | Negative | Less than |
PL | Positive or zero | Greater than or equal, or unordered |
VS | Overflow | Unordered (at least one NaN operand) |
VC | No overflow | Not unordered |
HI | Unsigned higher | Greater than, or unordered |
LS | Unsigned lower or same | Less than or equal |
GE | Signed greater than or equal | Greater than or equal |
LT | Signed less than | Less than, or unordered |
GT | Signed greater than | Greater than |
LE | Signed less than or equal | Less than or equal, or unordered |
AL | Always (normally omitted) | Always (normally omitted) |
The type of the instruction that last updated the flags in the APSR determines the meaning of condition codes.