Commit 51872377 by Kazu Hirata Committed by Kazu Hirata

fold-const.c (fold): Fold (A & ~B) - (A & B) into (A ^ B) - B for any B.

	* fold-const.c (fold): Fold (A & ~B) - (A & B) into
	(A ^ B) - B for any B.

From-SVN: r71953
parent ae7c3ba5
2003-09-30 Kazu Hirata <kazu@cs.umass.edu>
* fold-const.c (fold): Fold (A & ~B) - (A & B) into
(A ^ B) - B for any B.
2003-09-30 Nathanael Nerode <neroden@gcc.gnu.org> 2003-09-30 Nathanael Nerode <neroden@gcc.gnu.org>
* config.gcc (arm*-*-kaos*, i[34567]86-*-kaos*, powerpc-*-kaos*, * config.gcc (arm*-*-kaos*, i[34567]86-*-kaos*, powerpc-*-kaos*,
......
...@@ -6023,17 +6023,13 @@ fold (tree expr) ...@@ -6023,17 +6023,13 @@ fold (tree expr)
if (TREE_CODE (arg0) == BIT_AND_EXPR if (TREE_CODE (arg0) == BIT_AND_EXPR
&& TREE_CODE (arg1) == BIT_AND_EXPR && TREE_CODE (arg1) == BIT_AND_EXPR
&& operand_equal_p (TREE_OPERAND (arg0, 0), && operand_equal_p (TREE_OPERAND (arg0, 0),
TREE_OPERAND (arg1, 0), 0) TREE_OPERAND (arg1, 0), 0))
&& TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
&& TREE_CODE (TREE_OPERAND (arg1, 1)) == INTEGER_CST)
{ {
tree mask0 = TREE_OPERAND (arg0, 1); tree mask0 = TREE_OPERAND (arg0, 1);
tree mask1 = TREE_OPERAND (arg1, 1); tree mask1 = TREE_OPERAND (arg1, 1);
tree tem = fold (build1 (BIT_NOT_EXPR, type, mask0)); tree tem = fold (build1 (BIT_NOT_EXPR, type, mask0));
if (operand_equal_p (tem, mask1, 0) if (operand_equal_p (tem, mask1, 0))
&& integer_pow2p (fold (build (PLUS_EXPR, type,
mask1, integer_one_node))))
{ {
tem = fold (build (BIT_XOR_EXPR, type, tem = fold (build (BIT_XOR_EXPR, type,
TREE_OPERAND (arg0, 0), mask1)); TREE_OPERAND (arg0, 0), mask1));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment