This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/6914: -O2 and -O give different results for the same valid FP code
- From: Tim Prince <tprince at computer dot org>
- To: veksler at il dot ibm dot com, gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org,gcc-bugs at gcc dot gnu dot org
- Date: Mon, 3 Jun 2002 06:30:53 -0700
- Subject: Re: c++/6914: -O2 and -O give different results for the same valid FP code
- References: <3CFB6A8A.9090304@il.ibm.com>
- Reply-to: tprince at computer dot org
On Monday 03 June 2002 06:09, Michael Veksler wrote:
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&
>pr=6914
>
> So here are my conclusions (after reading the assembly, and running gdb
> on it):
> Floating point on x86 is done on 80 bit registers (IEEE's double
> extended type).
> GCC generates code to exploit all 80 bits during divide. It then spills
> the result
> to memory.
>
> The second divide is not spilled to memory, and the comparison is done
> between truncated value (which lost accuracy), and a completely accurate
> 80 bit
> value.
> According to http://www.validlab.com/goldberg/paper.ps this does not
> seem right.
> According to this paper, gcc should operate on double precision (64
> bit), or at
> least give the impression that it does so (to the outside viewer). But
> gcc operates
> on a mixed 80/64 bit setting, and that seems contradictory to IEEE spirit
> (and, probably, agains ISO C rules).
>
Among the remedies available would be
a) set 53-bit rounding mode
b) choose -msse2, for appropriate targets
--
Tim Prince