This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: alternative to -ffloat-store on x86?


>>>>> "TCB" == Theodore C Belding <Ted.Belding@umich.edu> writes:

 TCB> I need to force strict IEEE floating-point compliance in a
 TCB> program that I'm compiling with egcs 1.1 for x86, so that
 TCB> floating-point results are exactly the same as on other
 TCB> platforms.

I can't guarantee exactly that, at least not for Fortran in general.

 TCB> Is -ffloat-store still the best way to do this, or is there a
 TCB> better alternative?

I don't think it's in the 1.1 version, but the development version of
the g77 manual has this; I think I have recipes that should work on
other x86 systems.

Floating point precision
------------------------

   If your program depends on exact IEEE 754 floating point handling it
may help on some systems--specifically x86 or m68k hardware--to use the
`-ffloat-store' option or to reset the precision flag on the floating
point unit *Note Optimize Options::.

   However, it might be better simply to put the FPU into double
precision mode and not take the performance hit of `-ffloat-store'.  On
x86 and m68k GNU systems you can do this with a technique similar to
that for turning on floating point exceptions *Note Floating-point
Exception Handling::.  The control word could be set to double
precision by replacing the `__setfpucw' call with one like this:
       __setfpucw ((_FPU_DEFAULT & ~_FPU_EXTENDED) | _FPU_DOUBLE);
   (It is not clear whether this has any effect on the operation of the
GNU maths library, but we have no evidence of it causing trouble.)

 TCB> I apologize if this has been discussed before; I wasn't able to find
 TCB> anything in a web search of the mailing list archives.

Probably well disguised under a random subject...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]