http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46726
Summary: x*x has different cost than pow(x,2) with -ffast-math
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
double
foo(double x, double y)
{
return x*x + y;
}
is inlined at -O2 but not at -O2 -ffast-math (which folds x*x to pow(x, 2)).
MUL_EXPR has const 1 but __builtin_pow isn't is_inexpensive_builtin.
We probably should special-case pow(, 2) and pow(, 0.5) and sqrt where
target support is available.