match.pd: Optimize ~(X >> Y) to ~X >> Y if ~X can be simplified [PR96688]
authorJakub Jelinek <jakub@redhat.com>
Thu, 14 Jan 2021 11:50:33 +0000 (12:50 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 14 Jan 2021 11:50:33 +0000 (12:50 +0100)
commit8f8762a2e8659c1db802ba001869085c1915498f
treeca73185066382b0e83e9d96cb388dd6cad1af760
parente45c41988bfd655b1df7cff8fcf111dc6fb732e3
match.pd: Optimize ~(X >> Y) to ~X >> Y if ~X can be simplified [PR96688]

This patch optimizes two GIMPLE operations into just one.
As mentioned in the PR, there is some risk this might create more expensive
constants, but sometimes it will make them on the other side less expensive,
it really depends on the exact value.
And if it is an important issue, we should do it in md or during expansion.

2021-01-14  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/96688
* match.pd (~(X >> Y) -> ~X >> Y): New simplification if
~X can be simplified.

* gcc.dg/tree-ssa/pr96688.c: New test.
* gcc.dg/tree-ssa/reassoc-37.c: Adjust scan-tree-dump regex.
* gcc.target/i386/pr66821.c: Likewise.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/pr96688.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/reassoc-37.c
gcc/testsuite/gcc.target/i386/pr66821.c