This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: alternative to -ffloat-store on x86?
- To: d dot love at dl dot ac dot uk (Dave Love), egcs at cygnus dot com
- Subject: Re: alternative to -ffloat-store on x86?
- From: Jason Merrill <jason at cygnus dot com>
- Date: 01 Dec 1998 10:42:00 -0800
- References: <Pine.SOL.3.95.981124095353.6435C-100000@seawolf.rs.itd.umich.edu> <rzqpvabacn9.fsf.cygnus.egcs@djlvig.dl.ac.uk>
Interesting info from http://math.nist.gov/javanumerics/jgfnwg-01.html:
... x86 processors most naturally operate on 80-bit double extended
floating-point values. A precision control word can be set to make the
processor round to single or double precision. However, even when rounding
to a reduced precision, the floating-point registers still use the full 15
exponent bits of the double extended format (instead of the 11 exponent
bits for true double and 8 bits for true float). A store to memory is
required to narrow the exponent as well ...
Recently, a refinement of the store-reload technique that eliminates the
double rounding problem has been developed [Gol98]. To avoid double
rounding during multiplication, the new technique scales down one of the
operands by 2^(Emax (double extended) - Emax (double)) where Emax is the
largest exponent for a given floating point format. After this scaling, all
operations that would result in subnormals in true double also result in
subnormals in double with extended exponent range. This result is then
rescaled back up by the same quantity; normal results are unaffected and
subnormals are properly rounded once. A store of the product after being
scaled enforces the overflow threshold.