8.3 SSE Pre-Computation Exceptions

The procedure described in this section is formalized by the functions *sse-binary-pre-comp*,
*sse-sqrt-pre-comp*,
and *sse-fma-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:

- 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.

- Addition: Two infinities 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
exception occurs.
- Any denormal operand (with DAZ = 0) and none of the above conditions: DE is set, but the numerical computation proceeds unless an unmasked
exception occurs.

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 post-computation exception.

The setting of status flags and the default values are summarized in Table 8.2.

David Russinoff 2017-08-01