98
Use FFREEP Macro to Pop One Register from the FPU
AMD Athlon™ Processor x86 Code Optimization
22007E/0—November 1999
Use FFREEP Macro to Pop One Register from the FPU Stack
In FPU intensive code, frequently accessed data is often
pre-loaded at the bottom of the FPU stack before processing
floating-point data. After completion of processing, it is
desirable to remove the pre-loaded data from the FPU stack as
quickly as possible. The classical way to clean up the FPU stack
is to use either of the following instructions:
FSTP
ST(0)
;removes one register from stack
FCOMPP
;removes two registers from stack
On the AMD Athlon processor, a faster alternative is to use the
FFREEP instruction below. Note that the FFREEP instruction,
although insufficiently documented in the past, is supported by
all 32-bit x86 processors. The opcode bytes for FFREEP ST(i)
are listed in Table 22 on page 212.
FFREEP
ST(0)
;removes one register from stack
F F R E E P ST ( i ) wo rk s l i ke F F R E E S T (i ) ex c e p t th a t i t
increments the FPU top-of-stack after doing the FFREE work.
In other words, FFREEP ST(i) marks ST(i) as empty, then
increm e nts the x 87 sta ck pointer. O n the A MD A thl on
processor, the FFREEP instruction converts to an internal NOP,
which can go down any pipe with no dependencies.
Many assemblers do not support the FFREEP instruction. In
these cases, a simple text macro can be created to facilitate use
of the FFREEP ST(0).
FFREEP_ST0
TEXTEQU
<DB 0DFh, 0C0h>
Floating-Point Compare Instructions
For branches that are dependent on floating-point comparisons,
use the following instructions:
■
FCOMI
■
FCOMIP
■
FUCOMI
■
FUCOMIP
Summary of Contents for Athlon Processor x86
Page 1: ...AMD Athlon Processor x86 Code Optimization Guide TM...
Page 12: ...xii List of Figures AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 16: ...xvi Revision History AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 202: ...186 Page Attribute Table PAT AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 252: ...236 VectorPath Instructions AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...
Page 256: ...240 Index AMD Athlon Processor x86 Code Optimization 22007E 0 November 1999...