This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/37845] gcc ignores FP_CONTRACT pragma set to OFF
- From: "vincent at vinc17 dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Oct 2008 13:54:56 -0000
- Subject: [Bug target/37845] gcc ignores FP_CONTRACT pragma set to OFF
- References: <bug-37845-6373@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from vincent at vinc17 dot org 2008-10-16 13:54 -------
(In reply to comment #1)
> Confirmed. The FP_CONTRACT macro is not implemented, but the default behavior
> of GCC is to behave like it was set to OFF.
The problem is that on PowerPC, x*y+z is fused (contracted) by default (which
is forbidden when FP_CONTRACT is OFF). I could test only with Apple's gcc
4.0.1, but the man page of the gcc snapshot implies that the problem remains
with the current versions:
IBM RS/6000 and PowerPC Options
-mfused-madd
-mno-fused-madd
Generate code that uses (does not use) the floating point multiply
and accumulate instructions. These instructions are generated by
default if hardware floating is used.
But the correct behavior would be that these instructions should not be
generated by default.
On http://www.vinc17.org/software/tst-ieee754.c compiled with
gcc -Wall -O2 -std=c99 tst-ieee754.c -o tst-ieee754 -lm
I get:
$ ./tst-ieee754 | grep fused
x * y + z with FP_CONTRACT OFF is fused.
I need to add -mno-fused-madd to get the correct behavior:
$ ./tst-ieee754 | grep fused
x * y + z with FP_CONTRACT OFF is not fused.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37845