diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2024-06-11 17:16:42 -0700 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2024-06-12 08:44:49 -0700 |
commit | 0256121e2f23ac3550e87410c9b1e690c8edfc7c (patch) | |
tree | 65a1b68217abad9389c3faee421d221df2aeb1bc /gcc/cp/tree.cc | |
parent | bd6bc352d96304a13da63fed6aeb1615be535fd7 (diff) | |
download | gcc-0256121e2f23ac3550e87410c9b1e690c8edfc7c.zip gcc-0256121e2f23ac3550e87410c9b1e690c8edfc7c.tar.gz gcc-0256121e2f23ac3550e87410c9b1e690c8edfc7c.tar.bz2 |
match: Improve gimple_bitwise_equal_p and gimple_bitwise_inverted_equal_p for truncating casts [PR115449]
As mentioned by Jeff in r15-831-g05daf617ea22e1d818295ed2d037456937e23530, we don't handle
`(X | Y) & ~Y` -> `X & ~Y` on the gimple level when there are some different signed
(but same precision) types dealing with matching `~Y` with the `Y` part. This
improves both gimple_bitwise_equal_p and gimple_bitwise_inverted_equal_p to
be able to say `(truncate)a` and `(truncate)a` are bitwise_equal and
that `~(truncate)a` and `(truncate)a` are bitwise_invert_equal.
Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR tree-optimization/115449
gcc/ChangeLog:
* gimple-match-head.cc (gimple_maybe_truncate): New declaration.
(gimple_bitwise_equal_p): Match truncations that differ only
in types with the same precision.
(gimple_bitwise_inverted_equal_p): For matching after bit_not_with_nop
call gimple_bitwise_equal_p.
* match.pd (maybe_truncate): New match pattern.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/bitops-10.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'gcc/cp/tree.cc')
0 files changed, 0 insertions, 0 deletions