https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113186
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:97def769e6b28832f5ba4087d6fcdd44e18bf005 commit r14-6927-g97def769e6b28832f5ba4087d6fcdd44e18bf005 Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Sun Dec 31 16:38:30 2023 -0800 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_apin...@quicinc.com>