diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2023-12-31 16:38:30 -0800 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2024-01-04 12:51:50 -0800 |
commit | 97def769e6b28832f5ba4087d6fcdd44e18bf005 (patch) | |
tree | 0d4b7a546e1f52ba454c0cda8f79911b2195f7b0 /libcpp | |
parent | 589781c1d266290e6a84fdb65fc979354d67dbac (diff) | |
download | gcc-97def769e6b28832f5ba4087d6fcdd44e18bf005.zip gcc-97def769e6b28832f5ba4087d6fcdd44e18bf005.tar.gz gcc-97def769e6b28832f5ba4087d6fcdd44e18bf005.tar.bz2 |
Match: Improve inverted_equal_p for bool and `^` and `==` [PR113186]
For boolean types, `a ^ b` is a valid form for `a != b`. This means for
gimple_bitwise_inverted_equal_p, we catch some inverted value forms. This
patch extends inverted_equal_p to allow matching of `^` with the
corresponding `==`. Note in the testcase provided we used to optimize
in GCC 12 to just `return 0` where `a == b` was used,
this allows us to do that again.
Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR tree-optimization/113186
gcc/ChangeLog:
* gimple-match-head.cc (gimple_bitwise_inverted_equal_p):
Match `^` with the `==` for 1bit integral types.
* match.pd (maybe_cmp): Allow for bit_xor for 1bit
integral types.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/bitops-bool-1.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions