MATCH: [PR111679] Add alternative simplification of `a | ((~a) ^ b)`
commit975da6fa9170c9cf1ec4a9a9d8177f8561d464d1
authorAndrew Pinski <pinskia@gmail.com>
Mon, 9 Oct 2023 18:07:08 +0000 (9 11:07 -0700)
committerAndrew Pinski <pinskia@gmail.com>
Tue, 10 Oct 2023 17:26:34 +0000 (10 10:26 -0700)
treecb638a627d5e0a38f0f3bd416335096b82928d9d
parent5bb6a8766ec83e20550e1b59f2accb1ef25e3369
MATCH: [PR111679] Add alternative simplification of `a | ((~a) ^ b)`

So currently we have a simplification for `a | ~(a ^ b)` but
that does not match the case where we had originally `(~a) | (a ^ b)`
so we need to add a new pattern that matches that and uses bitwise_inverted_equal_p
that also catches comparisons too.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

PR tree-optimization/111679

gcc/ChangeLog:

* match.pd (`a | ((~a) ^ b)`): New pattern.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/bitops-5.c: New test.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/bitops-5.c [new file with mode: 0644]