5.4. 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).

Note

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:

The meanings of the condition code mnemonics are shown in Table 5.4.

Table 5.4. Condition codes

MnemonicMeaning after ARM data processing instructionMeaning after VFP VCMP instruction
EQEqualEqual
NENot equalNot equal, or unordered
CS or HSCarry set or Unsigned higher or sameGreater than or equal, or unordered
CC or LOCarry clear or Unsigned lowerLess than
MINegativeLess than
PLPositive or zeroGreater than or equal, or unordered
VSOverflowUnordered (at least one NaN operand)
VCNo overflowNot unordered
HIUnsigned higherGreater than, or unordered
LSUnsigned lower or sameLess than or equal
GESigned greater than or equalGreater than or equal
LTSigned less thanLess than, or unordered
GTSigned greater thanGreater than
LESigned less than or equalLess than or equal, or unordered
ALAlways (normally omitted)Always (normally omitted)

Note

The type of the instruction that last updated the flags in the APSR determines the meaning of condition codes.

Copyright © 2002-2010 ARM. All rights reserved.ARM DUI 0204J
Non-ConfidentialID101213