diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2015-08-31 16:02:00 +0200 |
---|---|---|
committer | Marc Glisse <glisse@gcc.gnu.org> | 2015-08-31 14:02:00 +0000 |
commit | b0eb889bf88eff3316690c6397a7f3dc75fbeda7 (patch) | |
tree | a33c135ce9d2d8750a86956b05a1741e6d13de2e /gcc/fold-const.c | |
parent | f196d062919feaf10ec10c67ac0d20f15fcfd2f5 (diff) | |
download | gcc-b0eb889bf88eff3316690c6397a7f3dc75fbeda7.zip gcc-b0eb889bf88eff3316690c6397a7f3dc75fbeda7.tar.gz gcc-b0eb889bf88eff3316690c6397a7f3dc75fbeda7.tar.bz2 |
Move some comparison simplifications to match.pd
2015-08-31 Marc Glisse <marc.glisse@inria.fr>
gcc/
* tree.h (zerop): New function.
* tree.c (zerop): Likewise.
(element_precision): Handle expressions.
* match.pd (define_predicates): Add zerop.
(x <= +Inf): Fix comment.
(abs (x) == 0, A & C == C, A & C != 0): Converted from ...
* fold-const.c (fold_binary_loc): ... here. Remove.
gcc/testsuite/
* gcc.dg/tree-ssa/cmp-1.c: New file.
From-SVN: r227346
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index a5d58a8..d478c4d 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -10678,11 +10678,6 @@ fold_binary_loc (location_t loc, TREE_OPERAND (arg0, 1), arg1); } - /* Convert ABS_EXPR<x> == 0 or ABS_EXPR<x> != 0 to x == 0 or x != 0. */ - if (TREE_CODE (arg0) == ABS_EXPR - && (integer_zerop (arg1) || real_zerop (arg1))) - return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0), arg1); - /* If this is an EQ or NE comparison with zero and ARG0 is (1 << foo) & bar, convert it to (bar >> foo) & 1. Both require two operations, but the latter can be done in one less insn @@ -10785,21 +10780,6 @@ fold_binary_loc (location_t loc, } } - /* If we have (A & C) == C where C is a power of 2, convert this into - (A & C) != 0. Similarly for NE_EXPR. */ - if (TREE_CODE (arg0) == BIT_AND_EXPR - && integer_pow2p (TREE_OPERAND (arg0, 1)) - && operand_equal_p (TREE_OPERAND (arg0, 1), arg1, 0)) - return fold_build2_loc (loc, code == EQ_EXPR ? NE_EXPR : EQ_EXPR, type, - arg0, fold_convert_loc (loc, TREE_TYPE (arg0), - integer_zero_node)); - - /* If we have (A & C) != 0 or (A & C) == 0 and C is the sign - bit, then fold the expression into A < 0 or A >= 0. */ - tem = fold_single_bit_test_into_sign_test (loc, code, arg0, arg1, type); - if (tem) - return tem; - /* 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 |