Functional Description
131
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
Cortex-M4 Peripherals
2.2.5.5
IEEE 754 Standard Implementation Choices
2.2.5.5.1 NaN Handling
All single-precision values with the maximum exponent field value and a nonzero fraction field are valid
NaNs. A most-significant fraction bit of zero indicates a Signaling NaN (SNaN). A one indicates a Quiet
NaN (QNaN). Two NaN values are treated as different NaNs if they differ in any bit. The table below
shows the default NaN values.
Table 2-7. NaN Handling
Sign
Fraction
Fraction
0
0xFF
bit [22] = 1, bits [21:0] are all zeros
Processing of input NaNs for Arm floating-point functionality and libraries is defined as follows:
•
In full-compliance mode, NaNs are handled as described in the Arm Architecture Reference Manual.
The hardware processes the NaNs directly for arithmetic CDP instructions. For data transfer
operations, NaNs are transferred without raising the Invalid Operation exception. For the nonarithmetic
CDP instructions, VABS, VNEG, and VMOV, NaNs are copied, with a change of sign if specified in the
instructions, without causing the Invalid Operation exception.
•
In default NaN mode, arithmetic CDP instructions involving NaN operands return the default NaN
regardless of the fractions of any NaN operands. SNaNs in an arithmetic CDP operation set the IOC
flag, FPSCR[0]. NaN handling by data transfer and nonarithmetic CDP instructions is the same as in
full-compliance mode.
(1)
IOC is the Invalid Operation exception flag, FPSCR[0].
Table 2-8. QNaN and SNaN Handling
Instruction Type
Default NaN Mode
With QNaN Operand
With SNaN Operand
Arithmetic CDP
Off
The QNaN or one of the QNaN operands,
if there is more than one, is returned
according to the rules given in the
IOC
(1)
set. The SNaN is quieted and the
result NaN is determined by the rules
given in the Arm Architecture Reference
Manual.
On
Default NaN returns.
IOC
(1)
set. Default NaN returns.
Non-arithmetic CDP
Off/On
NaN passes to destination with sign changed as appropriate.
FCMP(Z)
–
Unordered compare.
IOC set. Unordered compare.
FCMPE(Z)
–
IOC set. Unordered compare.
IOC set. Unordered compare.
All NaNs transferred
Off/On
All NaNs transferred
2.2.5.5.2 Comparisons
Comparison results modify the flags in the FPSCR. You can use the MVRS APSR_nzcv instruction
(formerly FMSTAT) to transfer the current flags from the FPSCR to the APSR. For mapping of IEEE 754-
2008 standard predicates to Arm conditions, see the Arm Architecture Reference Manual. The flags used
are chosen so that subsequent conditional execution of Arm instructions can test the predicates defined in
the IEEE standard.