This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]