This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Trim surplus zero extends


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]