[PATCH] Fold zero extensions into bit-wise ANDs
Richard Henderson
rth@redhat.com
Mon Apr 15 17:13:00 GMT 2002
On Mon, Apr 15, 2002 at 06:31:55PM -0600, Roger Sayle wrote:
> long long foo(unsigned char bar)
> {
> return bar & 0x24;
> }
>
> with the current mainline CVS we'd generate:
>
> foo: movzbl 4(%esp), %ecx
> xorl %edx, %edx
> andb $36, %cl
> movzbl %cl, %eax
> ret
>
> with my patch applied it now generates
>
> foo: movzbl 4(%esp), %eax
> andl $36, %eax
> cltd
> ret
Now that is interesting, and certainly not what I expected.
The patch is ok for mainline then.
r~
More information about the Gcc-patches
mailing list