User Guide

278 x87 Floating-Point Programming
AMD64 Technology 24592—Rev. 3.15—November 2009
6.7 Feature Detection
Before executing x87 floating-point instructions, software should determine if the processor supports
the technology by executing the CPUID instruction. “Feature Detection” on page 74 describes how
software uses the CPUID instruction to detect feature support. For full support of the x87 floating-
point features, the following feature must be present:
On-Chip Floating-Point Unit, indicated by bit 0 of CPUID function 1 and CPUID function
8000_0001h.
CMOVcc (conditional moves), indicated by bit 15 of CPUID function 1 and CPUID function
8000_0001h. This bit indicates support for x87 floating-point conditional moves (FCMOVcc)
whenever the On-Chip Floating-Point Unit bit (bit 0) is also set.
Software may also wish to check for the following support, because the FXSAVE and FXRSTOR
instructions execute faster than FSAVE and FRSTOR:
FXSAVE and FXRSTOR, indicated by bit 24 of CPUID function 1 and function 8000_0001h.
Software that runs in long mode should also check for the following support:
Long Mode, indicated by bit 29 of CPUID function 8000_0001h.
See “Processor Feature Identification” in Volume 2 for a full description of the CPUID instruction and
its function codes.
6.8 Exceptions
Types of Exceptions. x87 instructions can generate two types of exceptions:
General-Purpose Exceptions, described below in “General-Purpose Exceptions”
x87 Floating-Point Exceptions (#MF), described in “x87 Floating-Point Exception Causes” on
page 279
Relation to 128-Bit Media Exceptions. Although the x87 floating-point instructions and the 128-bit
media instructions each have certain exceptions with the same names, the exception-reporting and
exception-handling m ethods used by the two instruction subsets are distinct and independent of each
other. If procedures using both types of instructions are run in the same operating environment,
separate service routines should be provided for the exceptions of each type of instruction subset.
6.8.1 General-Purpose Exceptions
The sections below list general-purpose exceptions generated and not generated by x87 floating-point
instructions. For a summary of the general-purpose exception mechanism, see “Interrupts and
Exceptions” on page 86. For details about each exception and its potential causes, see “Exceptions and
Interrupts” in Volume 2.
Exceptions Generated. x87 instructions can generate the following general-purpose exceptions: