aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-09-13 09:36:50 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2018-09-13 09:36:50 +0200
commit392750c53e09334eb509aae4db52a4db18c413be (patch)
tree238326fc1d7c8ee912fbf715e291e60aa255bf65 /gcc/fold-const.c
parent8a90f559d727a993b5a3c5c9c5d5cd5520a7503a (diff)
downloadgcc-392750c53e09334eb509aae4db52a4db18c413be.zip
gcc-392750c53e09334eb509aae4db52a4db18c413be.tar.gz
gcc-392750c53e09334eb509aae4db52a4db18c413be.tar.bz2
re PR tree-optimization/87287 (Move signed (x % pow2) == 0 optimization to gimple)
PR tree-optimization/87287 * fold-const.c (fold_binary_loc) <case EQ_EXPR>: Move signed modulo X % C == 0 to X % (unsigned) C == 0 optimization to ... * match.pd (X % C == 0): ... here. New optimization. * gcc.dg/tree-ssa/pr87287.c: New test. From-SVN: r264260
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 3bcf272..71c18eb 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -10661,28 +10661,6 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type,
}
}
- /* If this is an NE or EQ comparison of zero against the result of a
- signed MOD operation whose second operand is a power of 2, make
- the MOD operation unsigned since it is simpler and equivalent. */
- if (integer_zerop (arg1)
- && !TYPE_UNSIGNED (TREE_TYPE (arg0))
- && (TREE_CODE (arg0) == TRUNC_MOD_EXPR
- || TREE_CODE (arg0) == CEIL_MOD_EXPR
- || TREE_CODE (arg0) == FLOOR_MOD_EXPR
- || TREE_CODE (arg0) == ROUND_MOD_EXPR)
- && integer_pow2p (TREE_OPERAND (arg0, 1)))
- {
- tree newtype = unsigned_type_for (TREE_TYPE (arg0));
- tree newmod = fold_build2_loc (loc, TREE_CODE (arg0), newtype,
- fold_convert_loc (loc, newtype,
- TREE_OPERAND (arg0, 0)),
- fold_convert_loc (loc, newtype,
- TREE_OPERAND (arg0, 1)));
-
- return fold_build2_loc (loc, code, type, newmod,
- fold_convert_loc (loc, newtype, arg1));
- }
-
/* Fold ((X >> C1) & C2) == 0 and ((X >> C1) & C2) != 0 where
C1 is a valid shift constant, and C2 is a power of two, i.e.
a single bit. */