Is SSE FP ABI breaking on i386?
Geert Bosch
bosch@gnat.com
Thu Feb 15 07:26:00 GMT 2001
On Thu, 15 Feb 2001 10:28:31 +0100, Jan Hubicka wrote:
Is gcc required to mandate the precisity for FLT_EVAL_METHOD == 2?
I was thinking about this issue and my conclusion is, that currently gcc
is free to throw away the extra precision anytime it wants (it does so
on each spill). SSE code is equivalent to i387 code if gcc gets crazy
enought to spill after each instruction - gcc has right to do so, so
it has right to use SSE instructions too.
This is really not true. It just is a GCC bug that we cut off precision
when spilling floating point registers containing doubles. Cutting of
FP registers to double is *only* allowed when the rounding mode is set
to round at 53 bits. In any other case one would get in effect double
rounding for the addition, subtraction, division, multiplication and
square root, and the final accurracy is *worse* than for regular IEEE
double arithmetic.
Note that this is not an issue at all for single precision floats, as
double rounding there cannot harm since the number of bits in the mantissa
of a long double (64) is more than twice that of float (24).
The issue is of course that GCC currently does not implement correct
IEEE double operation due to the extra precision internally, but at least
having this extended precision for entire expressions helps with knowing
that you'll have at most one double rounding.
Geert
More information about the Gcc
mailing list