This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: std::pow implementation
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>, <gcc at gcc dot gnu dot org>
- Date: Tue, 29 Jul 2003 14:43:56 +0200 (CEST)
- Subject: Re: std::pow implementation
On 29 Jul 2003, Gabriel Dos Reis wrote:
> Steven Bosscher <s.bosscher@student.tudelft.nl> writes:
>
> | If you were so great you would have declated __cmath_power inline in
> | the first place.
>
> Did I claim I am "great" or "so great"?
> There are reasons I didn't declare __cmath_power inline in the first place.
> That is why I asked for data and ways to reproduce them.
To show you some of the performance improve I get with my "hacked"
__pow_helper(), the average time for one iteration of my scientific
app dropped from 2.6s to 1.8s - this is a 30% improvement. Not to say
I ever expected gcc (or libstdc++) to not create x*x out of std::pow(x,2).
> | Now cut away all the redundant labels and other cruft, and you end up
> | with:
>
> In short, you have demonstrated that if "inline" is given its obvious
> meaning, the compiler can do a better job. That is what I claimed in
> the first place.
Note that Steven checked with -O3, so wether inline is specified here or
not should be meaningless(?).
Steven, does the code in your example optimize to the same as x*X?
Richard.
--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/