This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Trim surplus zero extends
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- To: Alan Modra <amodra at bigpond dot net dot au>,gcc-patches at gcc dot gnu dot org
- Date: Sat, 23 Mar 2002 20:29:09 +0100
- Subject: Re: Trim surplus zero extends
- References: <20020322142948.GP1089@bubble.sa.bigpond.net.au>
On Friday 22 March 2002 15:29, Alan Modra wrote:
> This test case:
>
> void foo (unsigned char *p)
> {
> unsigned long i;
>
> if (p[0] != 0xff)
> for (i = 1; i <= p[0]; i++)
> p[i] = 0;
> }
>
> generates code with an unnecessary zero extend on powerpc64-linux
> (also powerpc-linux if using "unsigned long long i", which is a
> regression from 2.95 and 3.0).
>
> .foo:
> lbz 11,0(3) # zero extended byte
> rlwinm 0,11,0,0xff # not needed
> cmpwi 0,0,255
> [snip]
>
> I guess this problem was introduced when all CONST_INTs became sign
> extended.
>
> * combine.c (simplify_comparison): When widening modes, ignore
> sign extension on CONST_INTs.
>
> OK for mainline and branch? Currently bootstrapping 3.1 powerpc-linux.
Uhm, this patch causes a regression on powerpc-linux-gnu,
gcc.c-torture/execute/20011223-1.c is failing at -O1 or higher. since you
regtested on this platform, I guess your patch interferes with another one
applied since your tests?
Franz.