Instructions
5.4.2 Definition of Overflow
The overflow exception can occur whenever the rounded true result would exceed, in magnitude, the largest finite number in the destination format.
The IEEE Overflow Floating-Point Exception trap disabled response for all normal and Parallel-FP arithmetic instructions is to either return an infinity or the correctly signed maximum finite value for the destination precision. This depends on the rounding mode, the sign of the result, and the operation. An inexact result exception is signaled. The IEEE Overflow Floating-Point Exception trap enabled response for all normal arithmetic instructions is to return the true biased exponent value MOD 217 and for all Parallel-FP arithmetic instructions is to return the true biased exponent value MOD 28. The value’s significand is rounded to the specified precision and written to the
destination register. If the rounded value is different from the infinitely-precise value,
Figure 5-12. Floating-point Exception Trap Prioritization
>Emax <Emin Overflow
Enabled? UnderflowEnabled?
FLAGS.o=1 FLAGS.i|=tmp_i Exp=tmp_exp%217 Sig=tmp_sig ISR.o=1 ISR.i=tmp_i ISR.fpa=tmp_fpa FP TRAP Infinity Result Inexact Enabled? FP TRAP ISR.i=1 ISR.fpa=tmp_fpa DONE >=Emin <=Emax FLAGS.i=1 tmp_i? tmp_i Inf.Precision Operation
Unbounded Range Rounding tmp_exp, tmp_sig
tmp_i, tmp_fpa FLAGS.u=1FLAGS.i|=tmp_i
Exp=tmp_exp%217 Sig=tmp_sig ISR.u=1 ISR.i=tmp_i ISR.fpa=tmp_fpa FP TRAP N N Zero Res. tmp_i=1 tmp_fpa=0 MaxReal/ Inf. Res tmp_fpa FLAGS.o=1 FTZ? Y N Y Y N Y Y N FLAGS.u=1 N Y tmp_exp? START Zero Result Zero Inf Inf.Precision Operation Bound Range Rounding tmp_i, tmp_fpa Zero/Den/MinReal Res Pre- Computed Res? Terminal
State DecisionPoint tmp_exp=result exponent tmp_sig=result significand tmp_i=inexactness indicator tmp_fpa=significand roundup
then inexactness is signaled. If the significand was rounded by adding a one to its least significant bit, then bit fpa in ISR.code is set to 1. Finally, an interruption due to a Floating-Point Exception trap will occur.
Note that when rounding to single, double, or double-extended real, the overflow trap enabled response for normal (non Parallel FP) arithmetic instructions is not guaranteed to be in the range of a valid single, double, or double-extended real quantity, because it is in 17-bit exponent format.
5.4.3
Definition of Tininess, Inexact and Underflow
Tininess is detected after rounding, and is said to occur when a non-zero result
(computed as though the exponent range were unbounded) would lie strictly between +2Emin and -2Emin. See Table 5-1 for the values of Emin for each real type. Creation of a tiny result may cause an exception later (such as overflow upon division because it is so small).
Inexactness is said to occur when the result differs from what would have been
computed if both the exponent range and precision were unbounded.
How tininess and inexactness trigger the underflow exception depends on whether the Underflow Floating-Point Exception trap is disabled or enabled. If the trap is disabled then the underflow exception is signaled when the result is both tiny and inexact. If the trap is enabled then the underflow exception is signaled when the result is tiny, regardless of inexactness. Note that in the event that the Underflow Floating-Point Exception trap is disabled and tininess but not inexactness occurs, then neither underflow nor inexactness is signaled, and the result is a denormal.
The IEEE Underflow Floating-Point Exception trap disabled response for all normal and Parallel-FP arithmetic instructions is to denormalize the infinitely precise result and then round it to the destination precision. The result may be a denormal, zero, or a normal. The inexact exception is signaled when appropriate.
The IEEE Underflow Floating-Point Exception trap enabled response for all normal arithmetic instructions is to return the true biased exponent value MOD 217and for all Parallel-FP arithmetic instructions is to return the true biased exponent value MOD 28. The significand is rounded to the specified precision and written to the destination register independent of the possibility of the exponent calculation requiring a borrow. If the rounded value is different from the infinitely-precise value, then inexactness is signaled. If the significand was rounded by adding a one to its least significant bit, then bit fpa in ISR.code is set to 1. Finally, an interruption due to a Floating-Point Exception trap will occur.
Note: When rounding to single, double, or double-extended real, the underflow trap
enabled response for normal (non Parallel FP) arithmetic instructions is not guaranteed to be in the range of a valid single, double, or double-extended real quantity, because it is in 17-bit exponent format.
When Flush-to-Zero mode is enabled, the behavior for tiny results is different. If an instruction would deliver a tiny result, a correctly signed zero is delivered instead and the appropriate FPSR.sfx.u and FPSR.sfx.i bits are set. This mode may improve the
performance on implementations that do not implement denormal handling in
hardware. When the Flush-to-Zero mode is enabled, floating-point exception software assist traps will not occur when producing tiny results.
5.4.4
Integer Invalid Operations
Floating-point to integer conversions which are invalid (in the IEEE sense) signal an Invalid Operation Floating-Point Exception fault. If the IEEE Invalid Operation trap is disabled, then the largest magnitude negative integer is the result, even for unsigned integer operations.
5.4.5
Definition of Arithmetic Operations
Arithmetic operations are those that compute on the operands by treating each operand’s encoding as a value, whereas non-arithmetic operations perform bit manipulations on the input operands without regard to the value represented by the encoding (except for NaTVal detection). Non-arithmetic instructions do not cause Floating-point Exception faults or traps, but can cause the Disabled Floating-point Register fault.
5.4.6
Definition and Propagation of NaNs
Signaling NaNs have a zero in the most significant fractional bit of the significand. Quiet NaNs have a one in the most significant fractional bit of the significand. This definition of signaling and quiet NaNs easily preserves “NaNness” when converting between different precisions. When propagating NaNs in operations that have more than one NaN operand, the result NaN is chosen from one of the operand NaNs in the following priority based on register encoding fields: first f4, then f2, and lastly f3.
5.4.7
IEEE Standard Mandated Operations Deferred to Software
The following IEEE mandated operations will be implemented in software: • String to floating-point conversion
• Floating-point to string conversion
• Divide (with help from frcpa or fprcpa instruction)
• Square root (with help from frsqrta or fprsqrta instruction) • Remainder (with help from frcpa or fprcpa instruction) • Floating-point to integer valued floating-point conversion
• Correctly wrapping the exponent for single, double, and double-extended overflow and underflow values, as recommended by the IEEE standard
5.4.8
Additions beyond the IEEE Standard
• The fused multiply and add (fma, fms, fnma, fpma, fpms, fpnma) operations enable efficient software divide, square root, and remainder algorithms.
• The extended range of the 17-bit exponent in the register format allows simplified implementation of many basic numeric algorithms by the careful numeric
• The NaTVal is a natural extension of the IEEE concept of NaNs. It is used to support speculative execution.
• Flush-to-Zero mode is an industry standard addition.
• The minimum and maximum instructions allow the efficient execution of the common Fortran Intrinsic Functions: MIN(), MAX(), AMIN(), AMAX(); and C language idioms such as a<b?a:b.
• All mixed precision operations are allowed. The IEEE standard suggests that implementations allow lower precision operands to produce higher precision results; this is supported. The IEEE standard also suggests that implementations not allow higher precision operands to produce lower precision results; this suggestion is not followed. When computations with higher precision operands produce values beyond the destination precision range, the information provided in the ISR.code allows the true result to be unambiguously determined by software. The correct wrapping count and the appropriate bias amount can also be computed. • An IEEE style quad-precision real type that is supported in software.