]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/match.pd
match.pd: Move (X & C) eqne (Y & C) -> -> (X ^ Y) & C eqne 0 opt to match.pd [PR94718]
authorJakub Jelinek <jakub@redhat.com>
Mon, 4 May 2020 08:57:46 +0000 (10:57 +0200)
committerJakub Jelinek <jakub@redhat.com>
Mon, 4 May 2020 08:57:46 +0000 (10:57 +0200)
commit73a8043481d24ac86ce8d19459276181dfd9c858
tree7a8030878e93027d910a55ad8a1025996e207b12
parentefaffc6997f33f663f887f63c72e589d4318f902
match.pd: Move (X & C) eqne (Y & C) -> -> (X ^ Y) & C eqne 0 opt to match.pd [PR94718]

This patch moves this optimization from fold-const.c to match.pd where it
is actually much shorter to do and lets optimize even code not seen together
in a single expression in the source, as the first step towards fixing the
PR.

2020-05-04  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/94718
* fold-const.c (fold_binary_loc): Move (X & C) eqne (Y & C)
-> (X ^ Y) & C eqne 0 optimization to ...
* match.pd ((X & C) op (Y & C) into (X ^ Y) & C op 0): ... here.

* gcc.dg/tree-ssa/pr94718-1.c: New test.
* gcc.dg/tree-ssa/pr94718-2.c: New test.
gcc/ChangeLog
gcc/fold-const.c
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr94718-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr94718-2.c [new file with mode: 0644]