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: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- Cc: Paolo Carlini <pcarlini at suse dot de>, <libstdc++ at gcc dot gnu dot org>
- Date: 12 Jan 2005 17:50:01 +0100
- Subject: Re: [PATCH] PR11706, optimize std::pow(T, int)
- Organization: Integrable Solutions
- References: <Pine.LNX.4.44.0501121702480.16464-100000@alwazn.tat.physik.uni-tuebingen.de>
Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
| On 12 Jan 2005, Gabriel Dos Reis wrote:
|
| > Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
| >
| > [...]
| >
| > | code-size anyway (insert usual rant about us not unrolling constant
| > | rolling loops unconditionally).
| >
| > That is the proper issue to be dealt with.
|
| No, it is one issue that has to be dealt with anyway, but still
| gives unexpectedly different (or I should say, unexpectedly _worse_)
| code for std::pow(x, 27) and std::pow(x, 27.0).
As usual, you spot a problem and you provide the wrong fix, insisting
that it is simple.
The bug is not that we're not using __builtin_constant_p. The bug
here is that we have (i.e. in libstdc++) to compute the power for
integer values and built-in types. The fix, is to have the compiler
provide built-in for those. See past discussions with Roger Sayly
about __builtin_powfi (double-check the suffix).
-- Gaby