Vector Floating-point Programming
ARM DUI 0068B
Copyright © 2000, 2001 ARM Limited. All rights reserved.
6-13
6.6
Flush-to-zero mode
Some implementations of VFP use support code to handle denormalized numbers. The
performance of such systems, in calculations involving denormalized numbers, is much
less than it is in normal calculations.
Flush-to-zero mode replaces denormalized numbers with +0. This does not comply with
IEEE 754 arithmetic, but in some circumstances can improve performance
considerably.
6.6.1
When to use flush-to-zero mode
You should select flush-to-zero mode if all the following are true:
•
IEEE 754 compliance is not a requirement for your system
•
the algorithms you are using are such that they sometimes generate denormalized
numbers
•
your system uses support code to handle denormalized numbers
•
the algorithms you are using do not depend for their accuracy on the preservation
of denormalized numbers
•
the algorithms you are using do not generate frequent exceptions as a result of
replacing denormalized numbers with +0.
You can change between flush-to-zero and normal mode at any time, if different parts
of your code have different requirements. Numbers already in registers are not affected
by changing mode.
6.6.2
The effects of using flush-to-zero mode
With certain exceptions (see
Operations not affected by flush-to-zero mode
on
page 6-14), flush-to-zero mode has the following effects on floating-point operations:
•
A denormalized number is treated as +0 when used as an input to a floating point
operation. The source register is not altered.
•
If the result of a single-precision floating-point operation, before rounding, is in
the range –2
–126
to +2
–126
, it is replaced by +0.
•
If the result of a double-precision floating-point operation, before rounding, is in
the range –2
–1022
to +2
–1022
, it is replaced by +0.
An inexact exception occurs whenever a denormalized number is used as an operand,
or a result is flushed to zero. Underflow exceptions do not occur in flush-to-zero mode.