[PATCH, i386]: Rewrite x87 sqrt patterns

Geert Bosch bosch@adacore.com
Wed Nov 22 16:13:00 GMT 2006


On Nov 22, 2006, at 08:28, Michael Matz wrote:
> I have no authority here, but given that x87 is as it is you don't  
> even
> get any interesting precision guarantee about division, so it  
> doesn't seem
> to make much sense to require such guarantees from sqrt, hence yes,  
> IMHO
> it is tolerable that __builtin_sqrt and sqrt return different  
> results on
> x87 (different meaning with more precision, not arbitrary  
> differences :)
> ).

Just to add my two cents, I completely agree that __builtin_sqrt  
returning
a more precise result than sqrt is acceptable and even expected.
The same thing happens when inlining functions or using other  
optimizations:
values that were previously truncated by storing them to memory may now
be kept in registers.

Same reasoning goes for other builtins, like fmod.
If people really don't want builtins to be used, they can always
the appropriate GCC option for that, like -fno-builtin-sqrt or
maybe even -fno-builtin.

   -Geert



More information about the Gcc-patches mailing list