help-rcs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug libstdc++/11706] std::pow(T, int) implementation pessimizes code


From: rguenth at tat dot physik dot uni-tuebingen dot de
Subject: [Bug libstdc++/11706] std::pow(T, int) implementation pessimizes code
Date: 11 Mar 2004 19:04:42 -0000

------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen 
dot de  2004-03-11 19:04 -------
Subject: Re:  std::pow(T, int) implementation pessimizes
 code

cvs-commit at gcc dot gnu dot org wrote:
> Log message:
>       2004-03-11  Steven Bosscher  <address@hidden>
>       
>       PR libstdc++/11706
>       * include/c_std/cmath.tcc (__cmath_power): Define inline.

Folks, this is not the right fix.  It doesn't help at all and moves the 
problem to a place where it is harder to fix than before.  Namely now we 
need
- a loop unroller capable of non-linear iv handling
- a inliner that will inline pow(x, c) for c == -1, 0, 1, 2 all the 
time, for constant c if not -Os and otherwise not (probably based on 
profile-feedback).

This ain't gonna happen, even in 3.5 timeframe.  The simplest fix for 
3.4 is replacing the __cmath_power() call with ::pow(), if c is 
constant.  I.e.

   template<typename _Tp>
     inline _Tp
     __pow_helper(_Tp __x, int __n)
     {
       if (__builtin_constant_p(__n))
         return ::pow(__x, __n);
       else
         return __n < 0
           ? _Tp(1)/__cmath_power(__x, -__n)
           : __cmath_power(__x, __n);
     }

This is sitting in my 3.3, 3.4 and ssa trees for month now.

Please remove the SUSPENDED state of the bug.

Richard.


-- 


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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]