
Chapter 4. Floating-Point Unit (FPU)
For More Information On This Product,
Go to: www.freescale.com
4-17
FPU Programmer’s Model
The inclusion of the NAN data type in the IEEE floating-point number system requires
each conditional test to include FPCC[NAN] in its boolean equation. Because it cannot be
determined whether a NAN is bigger or smaller than an in-range number (that is, it is
unordered), the compare instruction sets FPCC[NAN] when an unordered compare is
attempted. All arithmetic instructions that result in a NAN also set the NAN bit.
Conditional instructions interpret NAN being set as the unordered condition.
The IEEE-754 standard defines the following four conditions:
Equal to (EQ)
Greater than (GT)
Less than (LT)
Unordered (UN)
The standard requires only the generation of the condition codes as a result of a
floating-point compare operation. The FPU can test for these conditions and 28 others at
the end of any operation affecting condition codes. For floating-point conditional branch
instructions, the processor logically combines the 4 bits of the FPCC condition codes to
form 32 conditional tests, 16 of which cause an exception if an unordered condition is
present when the conditional test is attempted (IEEE nonaware tests). The other 16 do not
cause an exception (IEEE-aware tests). The set of IEEE nonaware tests is best used in one
of the following cases:
When porting a program from a system that does not support the IEEE standard to
a conforming system
When generating high-level language code that does not support IEEE
floating-point concepts (that is, the unordered condition).
An unordered condition occurs when one or both of the operands in a floating-point
compare operation is a NAN. The inclusion of the unordered condition in floating-point
branches destroys the familiar trichotomy relationship (greater than, equal, less than) that
exists for integers. For example, the opposite of floating-point branch greater than (FBGT)
is not floating-point branch less than or equal (FBLE). Rather, the opposite condition is
floating-point branch not greater than (FBNGT). If the result of the previous instruction
was unordered, FBNGT is true; whereas, both FBGT and FBLE would be false because
unordered fails both of these tests (and sets BSUN). Compiler code generators should be
particularly careful of the lack of trichotomy in the floating-point branches because it is
common for compilers to invert the sense of conditions.
+ NAN
0
0
0
1
– NAN
1
0
0
1
Table 4-8. FPCC Encodings (Continued)
Data Type
N
Z
I
NAN
F
Freescale Semiconductor, Inc.
n
.