This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: [PATCH] PR11706, optimize std::pow(T, int)


Richard Guenther wrote:

Hi!

This is a fix for the ages old PR11706 (or rather a work-around?).
cmath __pow_helper now recognizes constant (or small constant)
integer powers and dispatches to the appropriate gcc builtin in
these cases.  This makes the code for ::pow(x, 2), std::pow(x, 2)
and std::pow(x, 2.0) the same, likewise for exponents > 2 in case
of -ffast-math (even without -funroll-loops).

Ok for mainline?


Maybe Gaby wants to add something here, but I seem to remember that
we really dislike this kind of approach, calling back pow from __pow_helper
via a cast, thus giving away the info that the exponent is integer.

And, after Zdenek nice patch, -funroll-loops should lead to optimal code.
Does it work as expected?

Paolo.


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