Disabling x87 instructions in -O3 X86_64 sse enabled code

Alex Bennee kernel-hacker@bennee.com
Tue Aug 29 18:36:00 GMT 2006


Hi,

I posted a reply to http://gcc.gnu.org/ml/gcc-help/2006-03/msg00159.html
but seeing as it was in March it's probably disappeared under the radar.

I'm running gcc 4:

$: /export/BobTheBuilder/compilers/x86-linux-cross/x86_64-linux-gcc-4.1.0/bin/x86_64-linux-gcc --version
x86_64-linux-gcc (GCC) 4.1.0

And I'm seeing problems with signalling NaN propagation in my code if I
compile with -O3. The problem is is the compiler is putting the operands
into the x87 registers with code like:

 flds   0x108(%rsp)
 fstps  0x20(%rsp)

Which kills the Signalling aspect of the NaN so when it gets to my hand
crafted SSE2 assembler routine the signal isn't thrown.

I'm compiling the code with:
 -march=nocona -mfpmath=sse -msse2 -ffast-math

But it doesn't seem to make any difference. Putting a fprintf to dump
the operands before the call does change the register allocation and
keep the numbers un-molested in xmm registers. However I'm under the
impression gcc shouldn't be generating any x87 code unless explicitly
enabled.

I also tried:
 -ffixed-st0 -ffixed-st1 -ffixed-st2 -ffixed-st3 -ffixed-st4 -ffixed-st5
-ffixed-st6 -ffixed-st7

To try and force the x87 floating point registers from being used.
Unfortunately gcc didn't recognise the registers and I couldn't find the
REGISTER_NAMES macro definition in the sources for what the correct
incantation was.

The previously mentioned message seemed to imply this was fixed but I
can't find any reference in the 4.1.1 ChangeLog. Any suggestions on how
I can work around this bug?

--
Alex, homepage: http://www.bennee.com/~alex/
The qotc (quote of the con) was Liz's: "My brain is paged out to my
liver"



More information about the Gcc-help mailing list