[PATCH, i386]: Rewrite x87 sqrt patterns

Uros Bizjak ubizjak@gmail.com
Wed Nov 22 13:22:00 GMT 2006


On 11/22/06, Michael Matz <matz@suse.de> wrote:

> >  > The i386 sqrt patterns doesn't truncate the result of fsqrt x87
> >  > instruction.
> >
> > And neither do add, sub. mult, or div.  What's special about sqrt that
> > it deserves this treatement?
>
> Right.  If you _really_ want to fix x87 you'll have to explicitely
> truncate every intermediate result, just like -ffloat-store.  I guess
> nobody wants that, so why do it for sqrt?

Because there is a difference between returned results when sqrt() is
implemented as a builtin function or when it is implemented as a
library call. This is similar to the problems of __builtin_fmod() vs
fmod() library call on x87.

So, is it tolerable to substitute sqrt() call with a __builtin_sqrt()
that returns "different" results? If it is, could __builtin_fmod()
also return different results than fmod()?

Uros.



More information about the Gcc-patches mailing list