This is the mail archive of the gcc-cvs@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]

r242031 - in /trunk/gcc: ChangeLog simplify-rtx.c


Author: segher
Date: Thu Nov 10 00:32:43 2016
New Revision: 242031

URL: https://gcc.gnu.org/viewcvs?rev=242031&root=gcc&view=rev
Log:
simplify-rtx: Transform (xor (and (xor A B) C) B) with C const

match.pd transforms (A&C)|(B&~C) to ((A^B)&C)^B, which is fewer
operations if C is not const (and it is not on simple tests at least,
this transform is done very early already).

Various processors have "insert" instructions that can do this, but
combine cannot build those from the xor-and-xor, especially it has no
chance at all to do that if A or B or multiple instructions as well
(on PowerPC, the rl[wd]imi instructions can do this with together with
a rotate, or a simple shift with appropriate C; other ISAs have similar
insns).

This patch makes RTL simplify transform (xor (and (xor A B) C) B) back
to (ior (and A C) (and B ~C)) for constant C (and similar with A instead
of B for that last term).


	* simplify-rtx.c (simplify_binary_operation_1): Simplify
	(xor (and (xor A B) C) B) to (ior (and A C) (and B ~C)) and
	(xor (and (xor A B) C) A) to (ior (and A ~C) (and B C)) if C
	is a const_int.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/simplify-rtx.c


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