aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJames A. Morrison <phython@gcc.gnu.org>2005-04-20 02:31:26 +0000
committerJames A. Morrison <phython@gcc.gnu.org>2005-04-20 02:31:26 +0000
commit33ab6245545612b87af5868b4f6e6373cc733791 (patch)
tree16946e0d737d4e878583432cead2d91d65f93a7a /gcc/fold-const.c
parent72a3b9d27900c00d2b560dfbec36058759ed4f27 (diff)
downloadgcc-33ab6245545612b87af5868b4f6e6373cc733791.zip
gcc-33ab6245545612b87af5868b4f6e6373cc733791.tar.gz
gcc-33ab6245545612b87af5868b4f6e6373cc733791.tar.bz2
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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index bbd14c0..2c90d0c 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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;