[PATCH] PR11706, optimize std::pow(T, int)
Paolo Carlini
pcarlini@suse.de
Wed Jan 12 15:19:00 GMT 2005
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.
More information about the Libstdc++
mailing list