We do not unroll the loop in

double foo(double __x)
{
        unsigned int __n = 2;
        double __y = __n % 2 ? __x : 1;

        while (__n >>= 1)
          {
            __x = __x * __x;
            if (__n % 2)
              __y = __y * __x;
          }

        return __y;
}

with -O2 which causes us to emit gratiously worse code
for std::pow(x, 2) than for std::pow(x, 2.0).

We should definitely get this right without -funroll-loops
and all its side-effects.

-- 
           Summary: Trivial loop not unrolled
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at tat dot physik dot uni-tuebingen dot de
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to