AMD amd64 architecture User Manual

Page of 336
x87 Floating-Point Programming
263
24592—Rev. 3.15—November 2009
AMD64 Technology
P—Pop
PP—Pop Twice
R—Reverse
ST—Store
U—Unordered
x—One or more variable characters in the mnemonic
For example, the mnemonic for the store instruction that stores the top-of-stack and pops the stack is
FSTP. In this mnemonic, the F means a floating-point instruction, the ST means a store, and the P
means pop the stack.
6.4.2 Data Transfer and Conversion
The data transfer and conversion instructions copy data—in some cases with data conversion—
between x87 stack registers and memory or between stack positions.
Load or Store Floating-Point
FLD—Floating-Point Load
FST—Floating-Point Store Stack Top
FSTP—Floating-Point Store Stack Top and Pop
The FLD instruction pushes the source operand onto the top-of-stack, ST(0). The source operand may
be a single-precision, double-precision, or double-extended-precision floating-point value in memory
or the contents of a specified stack position, ST(i).
The FST instruction copies the value at the top-of-stack, ST(0), to a specified stack position, ST(i), or
to a 32-bit or 64-bit memory location. If the destination is a memory location, the value copied is
converted to the precision allowed by the destination and rounded, as specified by the rounding control
(RC) field of the x87 control word. If the top-of-stack value is a NaN or an infinity, FST truncates the
stack-top exponent and significand to fit the destination size. (For details, see “FST FSTP” in AMD64
Architecture Programmer’s Manual Volume 5: 64-bit Media and x87 Floating-Point Instructions,
order# 26569.
The FSTP instruction is similar to FST, except that FSTP can also store to an 80-bit memory location
and it pops the stack after the store. FSTP can be used to clean up the x87 stack at the end of an x87
procedure by removing one register of preloaded data from the stack.
Convert and Load or Store Integer
FILD—Floating-Point Load Integer
FIST—Floating-Point Integer Store
FISTP—Floating-Point Integer Store and Pop
FISTTP—Floating-Point Integer Truncate and Store