diff options
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 8fa32c6..6f12dd0 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -12163,15 +12163,6 @@ fold_binary_loc (location_t loc, type); } - /* Similarly for a NEGATE_EXPR. */ - if (TREE_CODE (arg0) == NEGATE_EXPR - && TREE_CODE (arg1) == INTEGER_CST - && 0 != (tem = negate_expr (fold_convert_loc (loc, TREE_TYPE (arg0), - arg1))) - && TREE_CODE (tem) == INTEGER_CST - && !TREE_OVERFLOW (tem)) - return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0), tem); - /* Similarly for a BIT_XOR_EXPR; X ^ C1 == C2 is X == (C1 ^ C2). */ if (TREE_CODE (arg0) == BIT_XOR_EXPR && TREE_CODE (arg1) == INTEGER_CST @@ -12356,22 +12347,6 @@ fold_binary_loc (location_t loc, return omit_one_operand_loc (loc, type, rslt, arg0); } - /* If we have (A | C) == D where C & ~D != 0, convert this into 0. - Similarly for NE_EXPR. */ - if (TREE_CODE (arg0) == BIT_IOR_EXPR - && TREE_CODE (arg1) == INTEGER_CST - && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) - { - tree notd = fold_build1_loc (loc, BIT_NOT_EXPR, TREE_TYPE (arg1), arg1); - tree candnotd - = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0), - TREE_OPERAND (arg0, 1), - fold_convert_loc (loc, TREE_TYPE (arg0), notd)); - tree rslt = code == EQ_EXPR ? integer_zero_node : integer_one_node; - if (integer_nonzerop (candnotd)) - return omit_one_operand_loc (loc, type, rslt, arg0); - } - /* If this is a comparison of a field, we may be able to simplify it. */ if ((TREE_CODE (arg0) == COMPONENT_REF || TREE_CODE (arg0) == BIT_FIELD_REF) @@ -12429,32 +12404,6 @@ fold_binary_loc (location_t loc, } } - /* (X ^ Y) == 0 becomes X == Y, and (X ^ Y) != 0 becomes X != Y. */ - if (integer_zerop (arg1) - && TREE_CODE (arg0) == BIT_XOR_EXPR) - return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0), - TREE_OPERAND (arg0, 1)); - - /* (X ^ Y) == Y becomes X == 0. We know that Y has no side-effects. */ - if (TREE_CODE (arg0) == BIT_XOR_EXPR - && operand_equal_p (TREE_OPERAND (arg0, 1), arg1, 0)) - return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0), - build_zero_cst (TREE_TYPE (arg0))); - /* Likewise (X ^ Y) == X becomes Y == 0. X has no side-effects. */ - if (TREE_CODE (arg0) == BIT_XOR_EXPR - && operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0) - && reorder_operands_p (TREE_OPERAND (arg0, 1), arg1)) - return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 1), - build_zero_cst (TREE_TYPE (arg0))); - - /* (X ^ C1) op C2 can be rewritten as X op (C1 ^ C2). */ - if (TREE_CODE (arg0) == BIT_XOR_EXPR - && TREE_CODE (arg1) == INTEGER_CST - && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) - return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0), - fold_build2_loc (loc, BIT_XOR_EXPR, TREE_TYPE (arg1), - TREE_OPERAND (arg0, 1), arg1)); - /* Fold (~X & C) == 0 into (X & C) != 0 and (~X & C) != 0 into (X & C) == 0 when C is a single bit. */ if (TREE_CODE (arg0) == BIT_AND_EXPR @@ -12508,14 +12457,6 @@ fold_binary_loc (location_t loc, return omit_one_operand_loc (loc, type, res, arg0); } - /* Fold -X op -Y as X op Y, where op is eq/ne. */ - if (TREE_CODE (arg0) == NEGATE_EXPR - && TREE_CODE (arg1) == NEGATE_EXPR) - return fold_build2_loc (loc, code, type, - TREE_OPERAND (arg0, 0), - fold_convert_loc (loc, TREE_TYPE (arg0), - TREE_OPERAND (arg1, 0))); - /* Fold (X & C) op (Y & C) as (X ^ Y) & C op 0", and symmetries. */ if (TREE_CODE (arg0) == BIT_AND_EXPR && TREE_CODE (arg1) == BIT_AND_EXPR) |