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 16:54:21 +0100
- Subject: Re: [PATCH] PR11706, optimize std::pow(T, int)
- Organization: Integrable Solutions
- References: <Pine.LNX.4.44.0501121619390.16464-100000@alwazn.tat.physik.uni-tuebingen.de>
Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
[...]
| > And, after Zdenek nice patch, -funroll-loops should lead to optimal code.
| > Does it work as expected?
|
| Yes, __cmath_power is inlined and -funroll-loops is able to optimize
| the loop for constant powers. Though the approach in __cmath_power
| is not optimal, f.i. for a exponent of 27 we generate one more
| multiplication than with __builtin_pow(). Also, as we inline
| __cmath_power all the time now, we have icache and code-size regressions
| for not constant powers. With my hackish approach we could again
| remove these inlines. Also, having to enable -funroll-loops to
So, what you want is to have the compiler better understand loop with
"constant" bounds, without requiring -funroll-loops.
-- Gaby