NaN Propagation Rules

For instructions that generate a result, special propagation rules apply when one or both source operands are NaN values, such that sNaNs can be successfully used as “tracer” values.

When both source operands are NaNs, qNaNs take priority over sNaNs. The appropriate NaN values will be selected as the operation default result as shown in Table 6-38. In the absence of any NaN source operands, any other floating-point numbers will be processed by the FPU module to generate the result.

Note: Source sNaN values will always generate an Invalid exception, but the corresponding quieted sNaN may not always be the operation result.

This magnitude comparison is based on the magnitude of the significand associated with each of these values (the sign is ignored). It is straightforward to implement because:

  • The MSb of a sNaN significant is 0 (with any non-zero value in the remaining bits).
  • The MSb of a qNaN significant is 1 (with any value in the remaining bits).

An example tracer sNaN propagation is shown in Figure 6-18. When an FPU operation (Op1) executes with a sNaN and a normal floating-point number, the sNaN will be quieted and propagate as the result. In Figure 6-18, this is sNaN1 (the initial tracer) being propagated as qNaN1. Should a subsequent operation (Op2) execute with qNaN1 and, for example, a later sNaN tracer (sNaN2), operand qNaN1 will have priority, thereby maintaining propagation of the original tracer payload. However, should that qNaN1 value then be presented to another FPU operation (Op3) together with another qNaN, the qNaN result could be either of the source qNaNs, depending upon the magnitude of their respective significands.

However, if the significand of the initial sNaN1 tracer is large enough, it will ultimately be able to continue to propagate past all subsequent NaNs and be available to view at the end of the code block, thereby allowing it to be traced back to its source.

Figure 6-18. Tracker sNaN Operand Propagation Example
Table 6-39. FMAC NaN Propagation Priority
Multiply Source OperandsAdd Source OperandsFMAC Result (Fd)Notes
Fb or FsFs or FbIntermediate ResultAccumulator Source (Fd)
FP Multiply
FP Add
FPNFPNFPNFPNFPN
qNaNqNaN
sNaNQuieted sNaNINVAL signaled
Distinguished qNaN(3)FPNDistinguished qNaNINVAL signaled
qNaN1Distinguished qNaN or qNaN1(2)INVAL signaled
sNaNDistinguished qNaN or Quieted sNaN(2)INVAL signaled
FPNsNaN1Quieted sNaN1FPNQuieted sNaN1INVAL signaled
qNaNQuieted sNaN1 or qNaN(2)INVAL signaled
sNaN2Quieted sNaN1(2)INVAL signaled
FPNqNaN1qNaN1FPNqNaN1
qNaN2qNaN1 or qNaN22
sNaNqNaN1INVAL signaled
qNaN1qNaN2qNaN1 or qNaN2(2)FPNqNaN1 or qNaN2(2)
qNaN3qNaN1 or qNaN2 or qNaN3(2)
sNaNqNaN1 or qNaN2(2)INVAL signaled
sNaN1sNaN2Quieted (sNaN1 or sNaN2)(2)FPNQuieted (sNaN1 or sNaN2)(2)INVAL signaled
qNaN

Quieted (sNaN1 or sNaN2)(2) or

qNaN

INVAL signaled
sNaN3Quieted (sNaN1 or sNaN2)(2)INVAL signaled
Note:
  1. FPN is a floating-point number that is not a NaN.
  2. Using significand magnitude comparisons as defined in Table 6-38.
  3. Distinguished qNaN intermediate result will arise when operands are 0 and Inf (any sign).