aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-07-06 23:42:41 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2018-07-06 23:42:41 +0200
commitf290100275139ccb59832bb75ff7fb2606e110d7 (patch)
tree18cda432e83a3fcae530b889830983dd4a7f0efb /gcc/fold-const.h
parent8de583fc5301987f31e1897e07d545e218b943da (diff)
downloadgcc-f290100275139ccb59832bb75ff7fb2606e110d7.zip
gcc-f290100275139ccb59832bb75ff7fb2606e110d7.tar.gz
gcc-f290100275139ccb59832bb75ff7fb2606e110d7.tar.bz2
re PR tree-optimization/86401 (The "For constants M and N, if M == (1LL << cst) - 1 && (N & M) == M,..." opts are only in fold-const.c and in RTL)
PR tree-optimization/86401 * fold-const.c (fold_binary_loc) <case BIT_AND_EXPR>: Move the ((A & N) + B) & M -> (A + B) & M etc. optimization into ... (fold_bit_and_mask): ... here. New helper function for match.pd. * fold-const.h (fold_bit_and_mask): Declare. * match.pd (((A & N) + B) & M -> (A + B) & M): New optimization. * gcc.dg/tree-ssa/pr86401-1.c: New test. * gcc.dg/tree-ssa/pr86401-2.c: New test. * c-c++-common/rotate-9.c: New test. From-SVN: r262485
Diffstat (limited to 'gcc/fold-const.h')
-rw-r--r--gcc/fold-const.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/fold-const.h b/gcc/fold-const.h
index 337818a..c64b8d0 100644
--- a/gcc/fold-const.h
+++ b/gcc/fold-const.h
@@ -96,6 +96,9 @@ extern tree omit_two_operands_loc (location_t, tree, tree, tree, tree);
extern tree invert_truthvalue_loc (location_t, tree);
extern tree fold_unary_to_constant (enum tree_code, tree, tree);
extern tree fold_binary_to_constant (enum tree_code, tree, tree, tree);
+extern tree fold_bit_and_mask (tree, tree, enum tree_code,
+ tree, enum tree_code, tree, tree,
+ tree, enum tree_code, tree, tree, tree *);
extern tree fold_read_from_constant_string (tree);
extern tree int_const_binop (enum tree_code, const_tree, const_tree);
#define build_fold_addr_expr(T)\