ARM ARM1176JZF-S Technical Reference Manual page 647

Table of Contents

Advertisement

ARM DDI 0301H
ID012310
The VFP11 coprocessor supports:
Compare operations
The compare operations are FCMPS, FCMPZS, FCMPD, and FCMPZD.
In default NaN mode, a compare instruction involving a QNaN produces an
unordered result. An SNaN produces an unordered result and generates an Invalid
Operation exception. If the IOE bit, FPSCR[8], is set, the Invalid Operation user
trap handler is called. When the VFP11 coprocessor is not in default NaN mode,
comparisons involving NaNs bounce to support code.
Compare with exception operations
The compare with exception operations are FCMPES, FCMPEZS, FCMPED,
and FCMPEZD.
In default NaN mode, a compare with exception operation involving either an
SNaN or a QNaN produces an unordered result and generates an Invalid
Operation exception. When the VFP11 coprocessor is not in default NaN mode,
comparisons involving NaNs bounce to support code.
Some simple comparisons on single-precision data can be computed directly by the ARM11
processor. If only equality or comparison to zero is required, and NaNs are not an issue,
performing the comparison in ARM11 registers using CMP or CMN instructions can be faster.
If branching on the state of the Z flag is required, you can use the following instructions for
positive values:
FMRS Rx, Sn
CMP Rx, #0
BEQ label
If the input values can include negative numbers, including negative zero, you can use the
following code:
FMRS Rx, Sn
CMP Rx, #0x80000000
CMPNE Rx, #0
BEQ label
Using a temporary register is even faster:
FMRS Rx, Sn
MOVS Rt, Rx, LSL #1
BEQ label
Comparisons with particular values are also possible. For example, to check if a positive value
is greater or equal to +1.0, use:
FMRS Rx, Sn
CMP Rx,#0x3F800000
BGE label
When comparisons are required for double-precision values, or when IEEE 754 standard
comparisons are required, it is safer to use the FCMP and FCMPE instructions with FMSTAT.
Underflow
In the generation of Underflow exceptions, the after rounding form of tininess and the
subnormalization loss form of loss of accuracy as the IEEE 754 standard describes are used.
Copyright © 2004-2009 ARM Limited. All rights reserved.
Non-Confidential, Unrestricted Access
VFP Programmer's Model
20-6

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents