User Guide
248 x87 Floating-Point Programming
AMD64 Technology 24592—Rev. 3.15—November 2009
• Opcode Field[7:0] = Second x87-opcode byte[7:0].
For example, the x87 opcode D9 F8 (floating-point partial remainder) is stored as 001_1111_1000b.
The low-order three bits of the first opcode byte, D9 (1101_1001b), are stored in bits 10–8. The second
opcode byte, F8 (1111_1000b), is stored in bits 7–0. The high-order five bits of the first opcode byte
(1101_1b) are not needed because they are identical for all x87 instructions.
Last x87 Data Pointer. The operating mode determines the value of the 64-bit data pointer, as
follows:
• 64-Bit Mode—The pointer contains the 64-bit offset of the last memory operand accessed by the
last non-control x87 instruction executed.
• Legacy Protected Mode and Compatibility Mode—The pointer contains the 16-bit data-segment
selector and the 16-bit or 32-bit offset of the last memory operand accessed by an executed non-
control x87 instruction.
• Legacy Real Mode and Virtual-8086 Mode—The pointer contains the 20-bit or 32-bit linear
address (segment base + offset) of the last memory operand accessed by an executed non-control
x87 instruction.
The FINIT and FNINIT instructions clear all bits in this pointer.
6.2.6 x87 Environment
The x87 environment—or non-data processor state—includes the following processor state:
• x87 control word register (FCW)
• x87 status word register (FSW)
• x87 tag word (FTW)
• last x87 instruction pointer
• last x87 data pointer
• last x87 opcode
Table 6-4 lists the x87 instructions can access this x87 processor state.
Table 6-4. Instructions that Access the x87 Environment
Instruction Description State Accessed
FINIT Floating-Point Initialize Entire Environment
FNINIT Floating-Point No-Wait Initialize Entire Environment
FNSAVE Floating-Point No-Wait Save State Entire Environment
FRSTOR Floating-Point Restore State Entire Environment
FSAVE Floating-Point Save State Entire Environment
FLDCW Floating-Point Load x87 Control Word x87 Control Word