background image

11-16 Vol. 1

PROGRAMMING WITH INTEL® STREAMING SIMD EXTENSIONS 2 (INTEL® SSE2)

11.5.2.5   Numeric Underflow Exception (#U)

The processor reports a numeric underflow exception whenever the magnitude of the rounded result of an arith-
metic instruction, with unbounded exponent, is less than the smallest possible normalized, finite value that will fit 
in the destination operand and the numeric-underflow exception is not masked. If the numeric underflow exception 
is masked, both underflow and the inexact-result condition must be detected before numeric underflow is reported. 
This exception can be generated with the ADDPS, ADDSS, ADDPD, ADDSD, SUBPS, SUBSS, SUBPD, SUBSD, 
MULPS, MULSS, MULPD, MULSD, DIVPS, DIVSS, DIVPD, DIVSD, CVTPD2PS, CVTSD2SS, ADDSUBPD, ADDSUBPS, 
HADDPD, HADDPS, HSUBPD, and HSUBPS instructions. The flag (UE) and mask (UM) bits for the numeric under-
flow exception are bits 4 and 11, respectively, in the MXCSR register.
The flush-to-zero flag (bit 15) of the MXCSR register provides an additional option for handling numeric underflow 
exceptions. When this flag is set and the numeric underflow exception is masked, tiny results are returned as a zero 
with the sign of the true result (see Section 10.2.3.3, “Flush-To-Zero”). 
Underflow will occur when a tiny non-zero result is detected (the result has to be also inexact if underflow excep-
tions are masked), as described in the IEEE Standard 754-2008. While DAZ does not affect the rules for signaling 
IEEE exceptions, operations on denormal inputs might have different results when DAZ=1. As a consequence, DAZ 
can have an effect on the floating-point exceptions - including the underflow exception - when observed for a given 
operation involving denormal inputs.
See Section 4.9.1.5, “Numeric Underflow Exception (#U),” for more information about the numeric underflow 
exception. See Section 11.5.4, “Handling SIMD Floating-Point Exceptions in Software,” for information on handling 
unmasked exceptions.

11.5.2.6   Inexact-Result (Precision) Exception (#P)

The inexact-result exception (also called the precision exception) occurs if the result of an operation is not exactly 
representable in the destination format. For example, the fraction 1/3 cannot be precisely represented in binary 
form. This exception occurs frequently and indicates that some (normally acceptable) accuracy has been lost. The 
exception is supported for applications that need to perform exact arithmetic only. Because the rounded result is 
generally satisfactory for most applications, this exception is commonly masked.
The flag (PE) and mask (PM) bits for the inexact-result exception are bits 2 and 12, respectively, in the MXCSR 
register.
See Section 4.9.1.6, “Inexact-Result (Precision) Exception (#P),” for more information about the inexact-result 
exception. See Section 11.5.4, “Handling SIMD Floating-Point Exceptions in Software,” for information on handling 
unmasked exceptions.
In flush-to-zero mode, the inexact result exception is reported. 

11.5.3 

Generating SIMD Floating-Point Exceptions

When the processor executes a packed or scalar floating-point instruction, it looks for and reports on SIMD 
floating-point exception conditions using two sequential steps:
1. Looks for, reports on, and handles pre-computation exception conditions (invalid-operand, divide-by-zero, and 

denormal operand)

2. Looks for, reports on, and handles post-computation exception conditions (numeric overflow, numeric 

underflow, and inexact result)

If both pre- and post-computational exceptions are unmasked, it is possible for the processor to generate a SIMD 
floating-point exception (#XM) twice during the execution of an SSE, SSE2 or SSE3 instruction: once when it 
detects and handles a pre-computational exception and when it detects a post-computational exception.

11.5.3.1   Handling Masked Exceptions

If all exceptions are masked, the processor handles the exceptions it detects by placing the masked result (or 
results for packed operands) in a destination operand and continuing program execution. The masked result may 
be a rounded normalized value, signed infinity, a denormal finite number, zero, a QNaN floating-point indefinite, or