The procedure described in this section is formalized by the functions sse-binary-pre-comp,
The first step in the execution of any SSE floating-point instruction,
before any exception checking is performed, is to examine the DAZ
bit of MXCSR. If this bit is set, then any denormal operand is
replaced by a zero of the same sign.
The conditions that may cause an exception flag to be set, or
the operation to be terminated with a QNaN value, or both, prior to an SSE computation are as follows:
Note that these conditions are prioritized in the order listed: if any
condition holds for a given operation, then any other of lower
priority is ignored for that operation.
For a packed instruction, all operands are examined in parallel for
pre-computation exception conditions. Consequently, it is possible
for different flags to be set for different operations.
- SNaN operand: IE is set and the operation is terminated. If the first NaN operand
is a QNaN, then the value is that operand; if the first NaN operand
is an SNaN, then the value is that operand converted to a QNaN. For this purpose, in the case
of a fused multiply-add
, the operands are ordered as , , .
- QNaN operand and no SNaN operand: No flag is set, but the operation is terminated. The value is
the first NaN operand.
- Undefined Operation: There is no NaN operand, but the operation
is undefined. IE is set, the operation is terminated, and the value is the real indefinite
QNaN (Definition 5.4.4). The operands for which this condition holds
depends on the operation:
- Addition: Two infinities with opposite signs;
- Subtraction: Two infinities with the same sign;
- Multiplication: Any infinity and any zero;
- Division: Any two infinities or any two zeroes;
- Square root extraction: Any operand with negative sign, excluding negative zero;
- Multiply-accumulate: Multiplication of any infinity and any zero, or addition of
two infinities (the product and the addend) with opposite signs.
- A division operation with any zero as divisor and any
finite numerical dividend: ZE is set, but the operation proceeds (resulting in an infinity) unless an unmasked
- Any denormal operand (with DAZ = 0) and none of the above conditions: DE is set, but the numerical computation proceeds unless an unmasked
If any exception flag is set during this process and the corresponding mask
bit is clear, then all operations are terminated before any
computation is performed, no result is written to the destination, and
an exception is generated.
If an operation of a packed instruction is terminated with a default value, the value is
not written to the destination until execution of the instruction
is completed, since no value is written in the event of an unmasked
The setting of status flags and the default values are summarized in Table 8.2.
SSE Pre-computation Exceptions