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: [patch][4.7] Enhance XOR handling in simplify-rtx.c


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~


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