diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2017-05-25 10:39:37 +0200 |
---|---|---|
committer | Marc Glisse <glisse@gcc.gnu.org> | 2017-05-25 08:39:37 +0000 |
commit | 10bc8017a3028c291e7b85486bc66bfc12b5f377 (patch) | |
tree | 0ae39800f5225d93ec8ee7ce60769570b69186da /gcc/fold-const.c | |
parent | d112b94ac4c8038056cf035dd8d550c9dc74b8e2 (diff) | |
download | gcc-10bc8017a3028c291e7b85486bc66bfc12b5f377.zip gcc-10bc8017a3028c291e7b85486bc66bfc12b5f377.tar.gz gcc-10bc8017a3028c291e7b85486bc66bfc12b5f377.tar.bz2 |
Move "(A & C) == D is false when D & ~C != 0" to match.pd
2017-05-25 Marc Glisse <marc.glisse@inria.fr>
* fold-const.c (fold_binary_loc) [(A & C) == D]: Remove transformation.
* match.pd (X == C): Rewrite it here.
(with_possible_nonzero_bits, with_possible_nonzero_bits2,
with_certain_nonzero_bits2): New predicates.
* tree-ssanames.c (get_nonzero_bits): Handle INTEGER_CST.
From-SVN: r248447
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 736552c..efc0b10 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -10636,24 +10636,6 @@ fold_binary_loc (location_t loc, } } - /* If we have (A & C) == D where D & ~C != 0, convert this into 0. - Similarly for NE_EXPR. */ - if (TREE_CODE (arg0) == BIT_AND_EXPR - && TREE_CODE (arg1) == INTEGER_CST - && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) - { - tree notc = fold_build1_loc (loc, BIT_NOT_EXPR, - TREE_TYPE (TREE_OPERAND (arg0, 1)), - TREE_OPERAND (arg0, 1)); - tree dandnotc - = fold_build2_loc (loc, BIT_AND_EXPR, TREE_TYPE (arg0), - fold_convert_loc (loc, TREE_TYPE (arg0), arg1), - notc); - tree rslt = code == EQ_EXPR ? integer_zero_node : integer_one_node; - if (integer_nonzerop (dandnotc)) - 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) |