Re: Bug in builtin_floor optimization

2005-08-23 Thread Dale Johannesen
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 d

Re: Bug in builtin_floor optimization

2005-08-23 Thread Richard Henderson
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

Re: Bug in builtin_floor optimization

2005-08-23 Thread Roger Sayle
On Mon, 22 Aug 2005, Dale Johannesen wrote: > There is some clever code in convert_to_real that converts > > double d; > (float)floor(d) > > to > > floorf((float)d) > ... > > Comments? Should I preserve the buggy behavior with -ffast-math? Good catch. This is indeed a -ffast-math (or more precis

Bug in builtin_floor optimization

2005-08-22 Thread Dale Johannesen
There is some clever code in convert_to_real that converts double d; (float)floor(d) to floorf((float)d) (on targets where floor and floorf are considered builtins.) This is wrong, because the (float)d conversion normally uses round-to-nearest and can round up to the next integer. For example