This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Broken optimization of pow (x, 1.5) and other halfs of integers..
- From: Nils Pipenbrinck <n dot pipenbrinck at cubic dot org>
- To: GCC Development <gcc at gcc dot gnu dot org>
- Date: Fri, 27 Feb 2009 21:51:03 +0100
- Subject: Broken optimization of pow (x, 1.5) and other halfs of integers..
Hi folks.
While optimizing some of my code I replaced powf (x, 1.5f) with x *
sqrt(x). Out of couriosity I checked if GCC does this optimization and
found it in the code. It's in expand_builtin_pow in the file builtin.c
(gcc 4.3.1 source).
However, GCC does not apply this optimization for a reason or another.
If I change the constant to 3.0f I get optimized code from another
special case expansion branch in that function (whole integers). Any
ideas what's wrong here?
The test-code, compiled with gcc (4.3.1) test.c
-funsafe-math-optimizations -O3 -S
#include <math.h>
float test (float arg)
{
return powf (arg, 1.5f);
}
If the optimization is triggered the disassembly shouldn't have a call
to _powf anymore.
Should I file a bug-report?
Cheers,
Nils