http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48092

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.08.05 08:33:59
                 CC|                            |rguenth at gcc dot gnu.org
          Component|rtl-optimization            |tree-optimization
            Summary|missing optimization        |associative property of
                   |(associative property of    |builtins is not exploited
                   |sqrt)                       |on GIMPLE
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-08-05 
08:33:59 UTC ---
The reason is we handle this only from the frontend folder which doesn't see
builtins when using std::sqrt.  A C testcase like

double foo (double x, double y)
{
  return __builtin_sqrt (x) * __builtin_sqrt (y);
}

is optimized.

For C++ (thus, optimizing the above when wrapping the sqrt inside an
inline function) these optimizations have to be replicated at the 
GIMPLE level.  Which today means in, for example, tree-ssa-forwprop.c.

Same issue for std::exp and other associative builtins.

Reply via email to