std::pow implementation

Richard Guenther rguenth@tat.physik.uni-tuebingen.de
Tue Jul 29 14:14:00 GMT 2003


On 29 Jul 2003, Steven Bosscher wrote:

> Op di 29-07-2003, om 14:55 schreef Richard Guenther:
> > double foo2(double x)
> > {
> >   pow(x, 2);
> > }
> >
>
> Not that it didn't even unroll the loop at all.
>
> I have no idea if it makes any difference, I'm just curious: What
> happens if you replace
>
>       while (__n >>= 1)
>
> with
>       while (__n = __n / 2)
> ?
>
> Maybe the loop stuff can't handle shifts...

It doesnt handle __n /= 2 either. So we're lost in optimizing this, it
seems (-fold-unroll-loops is not better either).

Richard.

--
Richard Guenther <richard dot guenther at uni-tuebingen dot de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/



More information about the Gcc mailing list