6.6.3.2.2 Flush-To-Zero (FTZ)
Flush-To-Zero (FTZ) mode is enabled when both FCR.FTZ and FCR.UDFM are set. If the underflow
exception is unmasked (FCR.UDFM = 0
), then the FCR.FTZ bit will have no
effect. Should a floating-point operation generate an infinitely precise result that is
less than the smallest possible subnormal number, then the Functional Block will round
this to a result of 0 with the same sign as the subnormal value. This will occur
irrespective of whether FTZ mode is enabled or not. Both Underflow (FSR.UDF) and Inexact
(FSR.INX) will be signaled (if not already set, sticky status FSR.UDFS and FSR.INXS will
also be set). Should a floating-point result be a subnormal number (that the Functional
Block has not rounded up to the smallest magnitude normal number), and FTZ mode is
enabled, the result will be replaced with 0 of the same sign as the subnormal value it
is replacing. Again, both Underflow (FSR.UDF) and Inexact (FSR.INX) will be signaled (if
not already set, sticky status FSR.UDFS and FSR.INXS will also be set), though the
Underflow exception has to be masked (in order to enabled FTZ mode), so no interrupt
will be issued. Forcing the result to 0 allows the user to ignore underflows (though at
the expense of some accuracy).
The FCR.FTZ bit is only examined during the WB-stage of an instruction such that it may be
modified as late as the cycle before the instruction enters the
WB-stage. For example, the following code sequence will only
apply the FTZ function to the FSUB
instruction:
* Assume FCR.FTZ=0 && FCR.UDFM=1 at entry
ADD.s F0, F1,F2 ; add without FTZ
IOR.s #0x0400, FCR ; set FCR.FTZ
SUB.s F3, F4,F5 ; sub with FTZ
AND.s #0xFBFF, FCR ; clear FCR.FTZADD.s F2,F6,F7 ;add without FTZ