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.
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.
Multiply Source Operands | Add Source Operands | FMAC Result (Fd) | Notes | ||||
---|---|---|---|---|---|---|---|
Fb or Fs | Fs or Fb | Intermediate Result | Accumulator Source (Fd) | ||||
FP Multiply | |||||||
FP Add | |||||||
FPN | FPN | FPN | FPN | FPN | |||
qNaN | qNaN | ||||||
sNaN | Quieted sNaN | INVAL signaled | |||||
Distinguished qNaN(3) | FPN | Distinguished qNaN | INVAL signaled | ||||
qNaN1 | Distinguished qNaN or qNaN1(2) | INVAL signaled | |||||
sNaN | Distinguished qNaN or Quieted sNaN(2) | INVAL signaled | |||||
FPN | sNaN1 | Quieted sNaN1 | FPN | Quieted sNaN1 | INVAL signaled | ||
qNaN | Quieted sNaN1 or qNaN(2) | INVAL signaled | |||||
sNaN2 | Quieted sNaN1(2) | INVAL signaled | |||||
FPN | qNaN1 | qNaN1 | FPN | qNaN1 | |||
qNaN2 | qNaN1 or qNaN22 | ||||||
sNaN | qNaN1 | INVAL signaled | |||||
qNaN1 | qNaN2 | qNaN1 or qNaN2(2) | FPN | qNaN1 or qNaN2(2) | |||
qNaN3 | qNaN1 or qNaN2 or qNaN3(2) | ||||||
sNaN | qNaN1 or qNaN2(2) | INVAL signaled | |||||
sNaN1 | sNaN2 | Quieted (sNaN1 or sNaN2)(2) | FPN | Quieted (sNaN1 or sNaN2)(2) | INVAL signaled | ||
qNaN |
Quieted (sNaN1 or sNaN2)(2) or qNaN | INVAL signaled | |||||
sNaN3 | Quieted (sNaN1 or sNaN2)(2) | INVAL signaled | |||||
Note:
|