[patch] combine.c: Remove unnecessary AND when storing into zero_extract.
Richard Earnshaw
rearnsha@arm.com
Fri Mar 21 18:02:00 GMT 2003
> Hi,
>
> Attached is a patch to remove unnecessary AND when storing into
> zero_extract. Consider
>
> A = (A & ~64) | (B & 64);
>
> The combiner eventually suggests
>
> (set (zero_extract:SI (reg:SI A)
> (const_int 1)
> (const_int 6))
> (and:SI (lshiftrt:SI (reg:SI B)
> (const_int 6))
> (const_int 1)))
>
> We are storing only one bit, so the AND in the source is unnecessary.
> The patch causes it to be stripped, resulting in
>
> (set (zero_extract:SI (reg:SI A)
> (const_int 1)
> (const_int 6))
> (lshiftrt:SI (reg:SI B)
> (const_int 6)))
>
> Tested on h8300 port. OK to apply?
>
Surely any mask that is wider than the insertion can be stripped. In the
above case 3, 7, 15,...
R.
More information about the Gcc-patches
mailing list