This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] PR11706, optimize std::pow(T, int)
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>,<libstdc++ at gcc dot gnu dot org>
- Date: Wed, 12 Jan 2005 17:17:24 +0100 (CET)
- Subject: Re: [PATCH] PR11706, optimize std::pow(T, int)
On Wed, 12 Jan 2005, Paolo Carlini wrote:
> Gabriel Dos Reis wrote:
>
> >Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
> >
> >| else if (__builtin_types_compatible_p(_Tp, double))
> >
> >Dispatching on types is done is C++ with template specializations.
> >
> >
> Please correct me if I'm wrong: probably the optimal solution (besides
> generically improving the treatment of loops with constant bounds) would
> involve dispatching integer powers of float, double, long double to
> appropriate builtins (using template specializations), otherwise, using
> the generic loop.
>
> Unfortunately, the above builtins are still missing :-( Is there a PR open
> tracking this issue? Shall I open one?
The __builtin_pow variants handle constant integer exponents specially
- they only do not dispatch to special integer versions for non-constant
exponents. But these integer versions may be dubious for -fno-fast-math
anyway (though maybe the std::pow(T, int) overloads are special cases
regarding snans, infs, etc.).
Richard.
--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/