This is the mail archive of the gcc@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]

Re: std::pow implementation


If we go back to the original question, wether std::__pow_helper and
std::__cmath_power are good implementations, please.

It has been shown that the current gcc unroller is not able to
unroll the while loop in std::__cmath_power() and such even inlining
does not help to create good code. Also inlining the loop if it is
not unrolled and its contents not sufficiently cprop'ed is harmful.

Isnt what one would expect to inline for constant and small __n only?
This we can make work using __builtin_constant_p() as proposed. This would
work for gcc3.3, too. For gcc3.4 we may want to rely on __builtin_pow()
instead (which calls libc pow() for not expanded cases which may be
slower than the pow(T, int) overload for small n).

Richard.

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


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