This is the mail archive of the
mailing list for the libstdc++ project.
Re: [PATCH] PR11706, optimize std::pow(T, int)
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- Cc: libstdc++ at gcc dot gnu dot org,Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Date: Wed, 12 Jan 2005 16:21:00 +0100
- Subject: Re: [PATCH] PR11706, optimize std::pow(T, int)
- References: <Pine.LNX.firstname.lastname@example.org>
Richard Guenther wrote:
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?