Vector Floating-point Programming

6.4VFP and condition codes

You can use a condition code to control the execution of any VFP instruction. The instruction is executed conditionally, according to the status flags in the CPSR, in exactly the same way as almost all other ARM instructions.

The only VFP instruction that can be used to update the status flags is FCMP. It does not update the flags in the CPSR directly, but updates a separate set of flags in the FPSCR (see FPSCR, the floating-point status and control register on page 6-10).

Note

To use these flags to control conditional instructions, including conditional VFP instructions, you must first copy them into the CPSR using an FMSTAT instruction (see FMRX, FMXR, and FMSTAT on page 6-33).

Following an FCMP 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 needed

Not-a-Number(NaN) values have no ordering relationship with numbers or with each other, so additional conditions are needed to allow for unordered results.

The meanings of the condition code mnemonics are shown in Table 6-2.

 

 

Table 6-2 Condition codes

 

 

 

Mnemonic

Meaning after ARM data processing instruction

Meaning after VFP FCMP instruction

 

 

 

EQ

Equal

Equal

 

 

 

NE

Not equal

Not equal, or unordered

 

 

 

CS / HS

Carry set / Unsigned higher or same

Greater than or equal, or unordered

 

 

 

CC / LO

Carry clear / 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

6-8

Copyright © 2000, 2001 ARM Limited. All rights reserved.

ARM DUI 0068B

Page 246
Image 246
ARM VERSION 1.2 manual VFP and condition codes