
292
Chapter 6: x87 Floating-Point Programming
AMD 64-Bit Technology
24593—Rev. 3.09—September 2003
other x87 exceptions, the SF flag does not have a corresponding
mask bit in the x87 control word.
If, subsequent to the instruction that caused the SF bit to be
set, a second invalid-operation exception (IE) occurs due to an
invalid operand in an arithmetic instruction (i.e., not a stack
fault), and if software has not cleared the SF bit between the
two instructions, the SF bit will remain set.
Exception Status (ES).
Bit 7. The processor calculates the value of
this bit at each instruction boundary and sets the bit to 1 when
one or more unmasked floating-point exceptions occur. If the
ES bit has already been set by the action of some prior
instruction, the processor invokes the #MF exception handler
when the next non-control x87 or 64-bit media instruction is
executed. (See “Control” on page 331 for a definition of control
instructions).
The ES bit can be written, but the written value is ignored. Like
the SF bit, the ES bit does not have a corresponding mask bit in
the x87 control word.
Top-of-Stack Pointer (TOP).
Bits 13–11. The TOP contains the
physical register index of the location of the top of stack, ST(0).
It thus specifies the mapping of the x87 stack registers,
ST(0)–ST(7), onto the x87 physical registers, FPR0–FPR7. The
processor changes the TOP during any instructions that pushes
or pops the stack. For details on how the stack works, see “Stack
Organization” on page 288.
Condition Codes (C3–C0).
Bits 14 and 10–8. The processor sets these
bits according to the result of arithmetic, compare, and other
instructions. In certain cases, other status-word flags can be
used together with the condition codes to determine the result
of an operation, including stack overflow, stack underflow, sign,
least-significant quotient bits, last-rounding direction, and out-
of-range operand. For details on how each instruction sets the
condition codes, see “x87 Floating-Point Instruction
Reference” in Volume 5.
x87 Floating-Point Unit Busy (B).
Bit 15. The processor sets the value
of this bit equal to the calculated value of the ES bit, bit 7. This
bit can be written, but the written value is ignored. The bit is
included only for backward-compatibility with the 8087
coprocessor, in which it indicates that the coprocessor is busy.