This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/11706] std::pow(T, int) implementation pessimizes code
- From: "rguenth at tat dot physik dot uni-tuebingen dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Dec 2003 19:50:17 -0000
- Subject: [Bug libstdc++/11706] std::pow(T, int) implementation pessimizes code
- References: <20030729120327.11706.rguenth@tat.physik.uni-tuebingen.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de 2003-12-06 19:50 -------
Subject: Re: std::pow(T, int) implementation pessimizes
code
On Sat, 6 Dec 2003, gdr at integrable-solutions dot net wrote:
> "rguenth at tat dot physik dot uni-tuebingen dot de" <gcc-bugzilla@gcc.gnu.org> writes:
>
> | Inlining __cmath_power won't help, as gcc is unable to optimize the loop
> | in it which has a non-linear biv. Some time ago it did help to call
> | __builtin_pow() from inside the integer overloads of pow, but I suspect
> | this is no longer true. Another possibility is to use __builtin_constant()
> | to check for constant exponent and manually optimize for this.
>
> Just a note. I'm *for* a good approach that makes the situation better.
> I excluse any use of __builtin_constant from any such approach.
Of course - use of __builtin_constant would be acceptable for me only, if
we can come up with a __cmath_power implementation for constant exponent
which would then be optimzed ok in all cases (and of course, inlined). My
hack to only optimize for powers of 2 and 3 is obviously a hack.
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11706