diff options
author | Richard Biener <rguenther@suse.de> | 2014-11-06 09:07:39 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-11-06 09:07:39 +0000 |
commit | 5609420fbab5ca93d18219b94eda95779bd75bb2 (patch) | |
tree | e8f63a58ac6d127bfe10b0ea17550a63bc530c20 /gcc/fold-const.c | |
parent | 45ea41fe8a833e4605ce0a1af794530030d483e4 (diff) | |
download | gcc-5609420fbab5ca93d18219b94eda95779bd75bb2.zip gcc-5609420fbab5ca93d18219b94eda95779bd75bb2.tar.gz gcc-5609420fbab5ca93d18219b94eda95779bd75bb2.tar.bz2 |
match.pd: Implement bitwise binary and unary simplifications from tree-ssa-forwprop.c.
2014-11-06 Richard Biener <rguenther@suse.de>
* match.pd: Implement bitwise binary and unary simplifications
from tree-ssa-forwprop.c.
* fold-const.c (fold_unary_loc): Remove them here.
(fold_binary_loc): Likewise.
* tree-ssa-forwprop.c (simplify_not_neg_expr): Remove.
(truth_valued_ssa_name): Likewise.
(lookup_logical_inverted_value): Likewise.
(simplify_bitwise_binary_1): Likewise.
(hoist_conversion_for_bitop_p): Likewise.
(simplify_bitwise_binary_boolean): Likewise.
(simplify_bitwise_binary): Likewise.
(pass_forwprop::execute): Remove calls to simplify_not_neg_expr
and simplify_bitwise_binary.
* genmatch.c (dt_node::append_true_op): Use safe_as_a for parent.
(decision_tree::insert): Also insert non-expressions.
* gcc.dg/tree-ssa/forwprop-28.c: Adjust scanning for the
desired transform.
From-SVN: r217178
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index efcefa7..e3bb706 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8008,8 +8008,6 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) case BIT_NOT_EXPR: if (TREE_CODE (arg0) == INTEGER_CST) return fold_not_const (arg0, type); - else if (TREE_CODE (arg0) == BIT_NOT_EXPR) - return fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0)); /* Convert ~ (-A) to A - 1. */ else if (INTEGRAL_TYPE_P (type) && TREE_CODE (arg0) == NEGATE_EXPR) return fold_build2_loc (loc, MINUS_EXPR, type, @@ -11152,26 +11150,6 @@ fold_binary_loc (location_t loc, arg1); } - /* (X & Y) | Y is (X, Y). */ - if (TREE_CODE (arg0) == BIT_AND_EXPR - && operand_equal_p (TREE_OPERAND (arg0, 1), arg1, 0)) - return omit_one_operand_loc (loc, type, arg1, TREE_OPERAND (arg0, 0)); - /* (X & Y) | X is (Y, X). */ - if (TREE_CODE (arg0) == BIT_AND_EXPR - && operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0) - && reorder_operands_p (TREE_OPERAND (arg0, 1), arg1)) - return omit_one_operand_loc (loc, type, arg1, TREE_OPERAND (arg0, 1)); - /* X | (X & Y) is (Y, X). */ - if (TREE_CODE (arg1) == BIT_AND_EXPR - && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0) - && reorder_operands_p (arg0, TREE_OPERAND (arg1, 1))) - return omit_one_operand_loc (loc, type, arg0, TREE_OPERAND (arg1, 1)); - /* X | (Y & X) is (Y, X). */ - if (TREE_CODE (arg1) == BIT_AND_EXPR - && operand_equal_p (arg0, TREE_OPERAND (arg1, 1), 0) - && reorder_operands_p (arg0, TREE_OPERAND (arg1, 0))) - return omit_one_operand_loc (loc, type, arg0, TREE_OPERAND (arg1, 0)); - /* (X & ~Y) | (~X & Y) is X ^ Y */ if (TREE_CODE (arg0) == BIT_AND_EXPR && TREE_CODE (arg1) == BIT_AND_EXPR) @@ -11391,42 +11369,6 @@ fold_binary_loc (location_t loc, && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0)) return omit_one_operand_loc (loc, type, integer_zero_node, arg0); - /* Canonicalize (X | C1) & C2 as (X & C2) | (C1 & C2). */ - if (TREE_CODE (arg0) == BIT_IOR_EXPR - && TREE_CODE (arg1) == INTEGER_CST - && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) - { - tree tmp1 = fold_convert_loc (loc, type, arg1); - tree tmp2 = fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0)); - tree tmp3 = fold_convert_loc (loc, type, TREE_OPERAND (arg0, 1)); - tmp2 = fold_build2_loc (loc, BIT_AND_EXPR, type, tmp2, tmp1); - tmp3 = fold_build2_loc (loc, BIT_AND_EXPR, type, tmp3, tmp1); - return - fold_convert_loc (loc, type, - fold_build2_loc (loc, BIT_IOR_EXPR, - type, tmp2, tmp3)); - } - - /* (X | Y) & Y is (X, Y). */ - if (TREE_CODE (arg0) == BIT_IOR_EXPR - && operand_equal_p (TREE_OPERAND (arg0, 1), arg1, 0)) - return omit_one_operand_loc (loc, type, arg1, TREE_OPERAND (arg0, 0)); - /* (X | Y) & X is (Y, X). */ - if (TREE_CODE (arg0) == BIT_IOR_EXPR - && operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0) - && reorder_operands_p (TREE_OPERAND (arg0, 1), arg1)) - return omit_one_operand_loc (loc, type, arg1, TREE_OPERAND (arg0, 1)); - /* X & (X | Y) is (Y, X). */ - if (TREE_CODE (arg1) == BIT_IOR_EXPR - && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0) - && reorder_operands_p (arg0, TREE_OPERAND (arg1, 1))) - return omit_one_operand_loc (loc, type, arg0, TREE_OPERAND (arg1, 1)); - /* X & (Y | X) is (Y, X). */ - if (TREE_CODE (arg1) == BIT_IOR_EXPR - && operand_equal_p (arg0, TREE_OPERAND (arg1, 1), 0) - && reorder_operands_p (arg0, TREE_OPERAND (arg1, 0))) - return omit_one_operand_loc (loc, type, arg0, TREE_OPERAND (arg1, 0)); - /* Fold (X ^ 1) & 1 as (X & 1) == 0. */ if (TREE_CODE (arg0) == BIT_XOR_EXPR && INTEGRAL_TYPE_P (type) |