[Bug target/93535] slow float/double simple constant folding with -Ofast
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Feb 2 08:40:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93535
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
(testing clang++ -O2 -ffast-math is useful as well)
It would be more helpful if you could isolate some specific transformations
that gcc is missing, instead of one big benchmark.
For instance:
double f(int n){
double d=0;
for(int i=0;i<100000;++i)
d+=2;
return d;
}
With -O3 -ffast-math, gcc keeps the original scalar loop.
(on variants of the testcase) Clang unrolls the loop, so it can do d+=20 for
fewer iterations, or it vectorizes (strangely).
If it is going to get wrong results, they might as well go all in and replace
the loop with a multiplication return 2*100000.
The example above might not be representative at all of the benchmark.
More information about the Gcc-bugs
mailing list