]> git.ipfire.org Git - thirdparty/gcc.git/commit
MATCH: [PR111432] Simplify `a & (x | CST)` to a when we know that (a & ~CST) == 0
authorAndrew Pinski <pinskia@gmail.com>
Fri, 13 Oct 2023 20:27:18 +0000 (13:27 -0700)
committerAndrew Pinski <pinskia@gmail.com>
Tue, 17 Oct 2023 15:51:51 +0000 (08:51 -0700)
commitb18d1cabe2f9cccc0cad697e1e0bfd2abebb85f9
treed3ee416cd553b7861a1c52947a7eccb63e21ed60
parentda65efe433f20984bab93335d8f994a6987847e6
MATCH: [PR111432] Simplify `a & (x | CST)` to a when we know that (a & ~CST) == 0

This adds the simplification `a & (x | CST)` to a when we know that
`(a & ~CST) == 0`. In a similar fashion as `a & CST` is handle.

I looked into handling `a | (x & CST)` but that I don't see any decent
simplifications happening.

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

PR tree-optimization/111432

gcc/ChangeLog:

* match.pd (`a & (x | CST)`): New pattern.

gcc/testsuite/ChangeLog:

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