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. r~