]> git.ipfire.org Git - thirdparty/gcc.git/commit
MATCH: PR 106164 : Optimize `(X CMP1 Y) AND/IOR (X CMP2 Y)`
authorAndrew Pinski <apinski@marvell.com>
Sat, 29 Jul 2023 23:59:10 +0000 (16:59 -0700)
committerAndrew Pinski <apinski@marvell.com>
Mon, 31 Jul 2023 17:12:06 +0000 (10:12 -0700)
commit0258b73680e21fd96290af961c80966ac6b3cc68
tree56220448040f639c4cb74fc7a6f800feb6eb0f71
parentb9237226fdc9387bccf584a811b30c5d3689ffd2
MATCH: PR 106164 : Optimize `(X CMP1 Y) AND/IOR (X CMP2 Y)`

I noticed that there are patterns that optimize
`(X CMP1 CST1) AND/IOR (X CMP2 CST2)` and we can easily extend
them to support the  `(X CMP1 Y) AND/IOR (X CMP2 Y)` by saying they
compare equal. This allows for this kind of optimization for integral
and pointer types (which have the same semantics).

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

gcc/ChangeLog:

PR tree-optimization/106164
* match.pd: Extend the `(X CMP1 CST1) AND/IOR (X CMP2 CST2)`
patterns to support `(X CMP1 Y) AND/IOR (X CMP2 Y)`.

gcc/testsuite/ChangeLog:

PR tree-optimization/106164
* gcc.dg/tree-ssa/cmpbit-1.c: New test.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/cmpbit-1.c [new file with mode: 0644]