floating point fwaits for i386

Robert Dewar dewar@adacore.com
Tue Apr 4 22:08:00 GMT 2006


Gary Knott wrote:
> Dear Gnu gcc person,
> 
> We have written our own FP exception handler for our
> use (because we want 1e155*1e155 to return 1.797...e308 (maxpos),
> and not a NaN!, and so on.)
             ^^^^

I assume you mean plus infinity?
> 
> For this to work in our gcc-compiled code, we need gcc to generate
> fwaits where needed (after all non-interrupting FP instructions)
> so that we can catch the exception at the right time and handle it 
> appropriately.
> 
> For the old gcc 2.91 - 2.96 compilers on i386 architecture, this worked!
> For the gcc 3.2 compiler we are trying to use, this no longer works.
> (If we put an asm fwait in our test code, good behavior is restored
>  - but of course we don't want to sprinkle hundreds or thousands of 
> fwaits everywhere.)
> 
> There seems to be no compiler switch to ask for these fwaits
> we have tried -ftrapv and many other options.

Not too surprising, the effect on performance should be drastically
horrible, so it is not something you want to encourage.
> 
> Could you possibly add a switch -mfwait  to the i386 batch of switches
> to get us back the capability we need.
> 
> Thanks.




More information about the Gcc mailing list