This is the mail archive of the
mailing list for the GCC project.
Re: patch for rotation
- To: Geoff Keating <geoffk at ozemail dot com dot au>
- Subject: Re: patch for rotation
- From: Jeffrey A Law <law at upchuck dot cygnus dot com>
- Date: Wed, 24 Mar 1999 01:34:06 -0700
- cc: egcs-patches at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <199901061147.WAA01606@geoffk.wattle.id.au>you write:
> I compiled the following procedure with egcs 1.1.1:
> rotate1(unsigned x, unsigned r)
> unsigned y;
> y = x << r | x >> 32u-r;
> return y;
[ ... ]
> There are probably more places in fold() where such things should go;
> particularly, bitwise operations are unaffected by casts and suchlike.
Yes. There's a variety of things that fold doesn't do that it should.
x = ((((x)&0xffff)^(~0x7fff))+0x8000)
Which is a cute way to perform sign extension without knowing the underlying
type of x. Right now we generate poor code since we don't fold or combine
this beast very well. This kind of code comes up often in tools which need to
run on both 32 and 64 bit host platforms.
> Geoffrey Keating <firstname.lastname@example.org>
> ===File /home/geoffk/patches/egcs-11.diff===================
> Wed Jan 6 22:02:44 1999 Geoff Keating <email@example.com>
> * fold-const.c (fold): Recognise a rotate by an unsigned amount.