Bug in builtin_floor optimization

Dale Johannesen dalej@apple.com
Tue Aug 23 17:51:00 GMT 2005


On Aug 23, 2005, at 9:53 AM, Richard Henderson wrote:

> On Tue, Aug 23, 2005 at 09:28:50AM -0600, Roger Sayle wrote:
>> Good catch.  This is indeed a -ffast-math (or more precisely a
>> flag_unsafe_math_optimizations) transformation.  I'd prefer to
>> keep these transformations with -ffast-math, as Jan described them
>> as significantly helping SPEC's mesa when they were added.
>
> Are you sure it was "(float)floor(d)"->"floorf((float)d)" that
> helped mesa and not "(float)floor((double)f)"->"floorf(f)" ?

All the floor calls in mesa seem to be of the form (int)floor((double)f)
or (f - floor((double)f)).  (the casts to double are implicit, 
actually.)

> It wouldn't bother me if the first transformation went away
> even for -ffast-math.  It seems egregeously wrong.

I think I'd prefer this, given that it is not useful in mesa.  Will put
together a patch.



More information about the Gcc mailing list