aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2003-09-30 21:07:41 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2003-09-30 21:07:41 +0000
commit518723777f8ef7a965e4a7f9c2e9f64105de03ea (patch)
treee0e6b3ab50ad71b39fa54fdba29ba23c9bc1d24f /gcc/fold-const.c
parentae7c3ba55f177f5469271802312ec4d697fa1896 (diff)
downloadgcc-518723777f8ef7a965e4a7f9c2e9f64105de03ea.zip
gcc-518723777f8ef7a965e4a7f9c2e9f64105de03ea.tar.gz
gcc-518723777f8ef7a965e4a7f9c2e9f64105de03ea.tar.bz2
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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 54458ef..f5a6f78 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6023,17 +6023,13 @@ fold (tree expr)
if (TREE_CODE (arg0) == BIT_AND_EXPR
&& TREE_CODE (arg1) == BIT_AND_EXPR
&& operand_equal_p (TREE_OPERAND (arg0, 0),
- TREE_OPERAND (arg1, 0), 0)
- && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
- && TREE_CODE (TREE_OPERAND (arg1, 1)) == INTEGER_CST)
+ TREE_OPERAND (arg1, 0), 0))
{
tree mask0 = TREE_OPERAND (arg0, 1);
tree mask1 = TREE_OPERAND (arg1, 1);
tree tem = fold (build1 (BIT_NOT_EXPR, type, mask0));
- if (operand_equal_p (tem, mask1, 0)
- && integer_pow2p (fold (build (PLUS_EXPR, type,
- mask1, integer_one_node))))
+ if (operand_equal_p (tem, mask1, 0))
{
tem = fold (build (BIT_XOR_EXPR, type,
TREE_OPERAND (arg0, 0), mask1));