This is the mail archive of the 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]
Other format: [Raw text]

Re: Fldcw, rounding and optimizations

On 14-Aug-2003, Loisel, Sebastien <> wrote:
> I know about fenv.h, I'm trying to save some cycles.
> Also, should this be considered a bug in g++ (the FPU optimizer changes
> the semantics of my program, hence the optimizer is wrong) or a bug in
> my code (I'm inserting inline assembler behind g++'s back, which g++
> can't be expected to grok anyway?)

The latter.  If you need to change rounding modes, and <fenv.h> is
available, you should use it.  If the compiler doesn't do a good job
of optimizing the resulting code, then send a bug report with the
"pessimizes-code" keyword.

> Are the g++ FPU optimizations always correct in the absence of rounding
> mode tweakage?

Define "correct"?

> (Do all programs output the exact same floating point
> numbers at all precision levels, if floating point rounding mode is
> left alone?)

No.  For example, on some architectures (e.g. x86) you can get different
precision depending on whether an intermediate expression gets stored
on the C stack or in floating point registers.  See the documentation
for the `-ffloat-store' option for more information on that.

Fergus Henderson <>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <>  |     -- the last words of T. S. Garp.

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