[patch][4.7] Enhance XOR handling in simplify-rtx.c
Chung-Lin Tang
cltang@codesourcery.com
Mon Mar 21 07:38:00 GMT 2011
On 2011/3/18 12:18 AM, Richard Henderson wrote:
> On 03/16/2011 06:55 PM, Chung-Lin Tang wrote:
>> You have to use DeMorgan's Law to distribute the ~ operator:
>
> Duh. Not sure where my head was yesterday.
>
> Let's enhance the comment for someone else having an off day. Perhaps
>
> /* Given (xor (and A B) C), using P^Q == ~P&Q | ~Q&P and DeMorgan's
> we can transform
> A&B ^ C == ~(A&B)&C | ~C&(A&B)
> == (~A|~B)&C | A&B&~C
> == ~A&C | ~B&C | A&B&~C
> Attempt a few simplifications when B and C are both constants. */
>
>> + if (GET_CODE (op0) == AND
>> + && CONST_INT_P (op1) && CONST_INT_P (XEXP (op0, 1)))
>
> Should have a newline before the second && here.
>
> Ok with those changes.
Thanks, committed patch attached below. Hope the comments are now
descriptive enough.
C.L.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xor-2.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110321/a2b2b4a7/attachment.ksh>
More information about the Gcc-patches
mailing list