Commit 33ab6245 by James A. Morrison

fold-const (fold_binary): Fold ~X ^ ~ Y to X ^ Y.

2005-04-19  James A. Morrison  <phython@gcc.gnu.org>

	* fold-const (fold_binary):  Fold ~X ^ ~ Y to X ^ Y.

From-SVN: r98434
parent 72a3b9d2
2005-04-19 James A. Morrison <phython@gcc.gnu.org>
* fold-const (fold_binary): Fold ~X ^ ~ Y to X ^ Y.
2005-04-20 Michael Pogue <michael.pogue@sun.com>
Joseph S. Myers <joseph@codesourcery.com>
......
......@@ -8174,6 +8174,13 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
goto bit_ior;
}
/* Convert ~X ^ ~Y to X ^ Y. */
if (TREE_CODE (arg0) == BIT_NOT_EXPR
&& TREE_CODE (arg1) == BIT_NOT_EXPR)
return fold_build2 (code, type,
fold_convert (type, TREE_OPERAND (arg0, 0)),
fold_convert (type, TREE_OPERAND (arg1, 0)));
/* See if this can be simplified into a rotate first. If that
is unsuccessful continue in the association code. */
goto bit_rotate;
......
2005-04-19 James A. Morrison <phython@gcc.gnu.org>
* gcc.dg/fold-xor-1.c: New test.
2005-04-19 James E. Wilson <wilson@specifixinc.com>
PR target/20670
......
/* { dg-do compile } */
/* { dg-options "-fdump-tree-generic" } */
int f (int a, int b) {
return ~a ^ ~b;
}
unsigned int g (unsigned int a, unsigned int b) {
return ~a ^ ~b;
}
/* { dg-final { scan-tree-dump-times "a \\^ b" 2 "generic" } } */
/* { dg-final { cleanup-tree-dump "generic" } } */
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