Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture
8-6 Vol. 1
PROGRAMMING WITH THE X87 FPU
8.1.3 x87 FPU Status Register
The 16-bit x87 FPU status register (see Figure 8-4) indicates the current state of the
x87 FPU. The flags in the x87 FPU status register include the FPU busy flag, top-of-
stack (TOP) pointer, condition code flags, error summary status flag, stack fault flag,
and exception flags. The x87 FPU sets the flags in this register to show the results of
operations.
The contents of the x87 FPU status register (referred to as the x87 FPU status word)
can be stored in memory using the FSTSW/FNSTSW, FSTENV/FNSTENV,
FSAVE/FNSAVE, and FXSAVE instructions. It can also be stored in the AX register of
the integer unit, using the FSTSW/FNSTSW instructions.
8.1.3.1 Top of Stack (TOP) Pointer
A pointer to the x87 FPU data register that is currently at the top of the x87 FPU
register stack is contained in bits 11 through 13 of the x87 FPU status word. This
pointer, which is commonly referred to as TOP (for top-of-stack), is a binary value
from 0 to 7. See Section 8.1.2, “x87 FPU Data Registers,” for more information
about the TOP pointer.
8.1.3.2 Condition Code Flags
The four condition code flags (C0 through C3) indicate the results of floating-point
comparison and arithmetic operations. Table 8-1 summarizes the manner in which
the floating-point instructions set the condition code flags. These condition code bits
Figure 8-4. x87 FPU Status Word
FPU Busy
15
13
14
11
10 9
8
7
6
543
2
1
0
B
I
E
P
E
O
E
U
E
Z
E
D
E
TOP
Top of Stack Pointer
Exception Flags
Precision
Underflow
Overflow
Zero Divide
Denormalized Operand
Invalid Operation
Stack Fault
Error Summary Status
Condition
Code
C
2
C
1
C
0
E
S
S
F
C
3