re PR tree-optimization/86401 (The "For constants M and N, if M == (1LL << cst) ...
authorJakub Jelinek <jakub@redhat.com>
Fri, 6 Jul 2018 21:42:41 +0000 (23:42 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 6 Jul 2018 21:42:41 +0000 (23:42 +0200)
commitf290100275139ccb59832bb75ff7fb2606e110d7
tree18cda432e83a3fcae530b889830983dd4a7f0efb
parent8de583fc5301987f31e1897e07d545e218b943da
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
gcc/ChangeLog
gcc/fold-const.c
gcc/fold-const.h
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/rotate-9.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr86401-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr86401-2.c [new file with mode: 0644]