[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
Sat Dec 6 20:05:00 GMT 2003


------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2003-12-06 20:05 -------
Subject: Re:  std::pow(T, int) implementation pessimizes
 code

On Sat, 5 Dec 2003, bkoz at gcc dot gnu dot org wrote:

> Can we get this resolved, folks? I think all that needs to be done now is
> examine cmath.tcc for inline-ability (ie, is __cmath_power to be inlined now?)
> Please let me know how I can help.

Ok, so I checked todays mainline and g++-3.3 (GCC) 3.3.3 20031114
(prerelease), with gcc 3.3, for both, ::pow(x,2) and std::pow(x,2) we
generate a call to libm, for mainline this is the same - except if we
compile with -ffast-math, in which case the first call is expanded to
optimal asm. So it seems this transformation is guarded with
-funsafe-math-optimizations -- why?

Richard.


-- 


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



More information about the Gcc-bugs mailing list