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

rguenth at tat dot physik dot uni-tuebingen dot de gcc-bugzilla@gcc.gnu.org
Tue Jul 29 13:01:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2003-07-29 13:01 -------
Subject: Re:  std::pow(T, int) implementation pessimizes
 code

On 29 Jul 2003, steven at gcc dot gnu dot org wrote:

> Richard, can you test this and see if it helps?  It's still not as good as
> pow(x,2)->x*x but it's darn close and with loop unrolling it might even get to that.

Given recent discussion on gcc list and gcc3.4s ability to optimize
::pow, we should just drop __pow_helper() and __cmath_power() and change

  inline double
  std::pow(double __x, int __i)
  { return __pow_helper(__x, __i); }

to

  inline double
  std::pow(double __x, int __i)
  { return ::pow(__x, __i); }


Maybe for all other overloads, too.

Richard.

--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/



More information about the Gcc-bugs mailing list