]> git.ipfire.org Git - thirdparty/gcc.git/commit
Match: Add maybe_bit_not instead of plain matching
authorAndrew Pinski <quic_apinski@quicinc.com>
Sun, 26 May 2024 06:29:48 +0000 (23:29 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Wed, 29 May 2024 15:54:09 +0000 (08:54 -0700)
commit0a9154d154957b21eb2c9e4fbe9869e50fb9742f
tree8c23d30c6374cbb0524a34be322855184b69b309
parent39263ed2d39ac1cebde59bc5e72ddcad5dc7a1ec
Match: Add maybe_bit_not instead of plain matching

While working on adding matching of negative expressions of `a - b`,
I noticed that we started to have "duplicated" patterns due to not having
a way to match maybe negative expressions. So I went back to what I did for
bit_not and decided to improve the situtation there so for some patterns
where we had 2 operands of an expression where one could have been a bit_not,
add back maybe_bit_not.
This does not add maybe_bit_not in every place were bitwise_inverted_equal_p
is used, just the ones were 2 operands of an expression could be swapped.

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

gcc/ChangeLog:

* match.pd (bit_not_with_nop): Unconditionalize.
(maybe_cmp): Likewise.
(maybe_bit_not): New match pattern.
(`~X & X`): Use maybe_bit_not and add `:c` back.
(`~x ^ x`/`~x | x`): Likewise.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/match.pd