[Bug tree-optimization/113186] [13/14 Regression] `(a^c) & (a^!c)` is not optimized to 0 for bool
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113186 Andrew Pinski changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #6 from Andrew Pinski --- Fixed.
[Bug tree-optimization/113186] [13/14 Regression] `(a^c) & (a^!c)` is not optimized to 0 for bool
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113186 --- Comment #5 from GCC Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:97def769e6b28832f5ba4087d6fcdd44e18bf005 commit r14-6927-g97def769e6b28832f5ba4087d6fcdd44e18bf005 Author: Andrew Pinski 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
[Bug tree-optimization/113186] [13/14 Regression] `(a^c) & (a^!c)` is not optimized to 0 for bool
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113186 Andrew Pinski changed: What|Removed |Added URL||https://gcc.gnu.org/piperma ||il/gcc-patches/2024-January ||/641612.html --- Comment #4 from Andrew Pinski --- Patch posted: https://gcc.gnu.org/pipermail/gcc-patches/2024-January/641612.html I will fix the regression with the IR from the C++ front-end seperately.
[Bug tree-optimization/113186] [13/14 Regression] `(a^c) & (a^!c)` is not optimized to 0 for bool
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113186 --- Comment #3 from Andrew Pinski --- So for the C testcase, we don't need to create a new pattern, just extend gimple_bitwise_inverted_equal_p to catch `a == b` and `a ^ b` are inverted equals like we already do for `a == b` and `a != b`. This allows for other patterns to work too ...
[Bug tree-optimization/113186] [13/14 Regression] `(a^c) & (a^!c)` is not optimized to 0 for bool
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113186 --- Comment #2 from Andrew Pinski --- Note for `~a != b` (for boolean size) we should just convert that into: `a == b` . And then we would have the form for both C++ and C at -O1 in forwprop1 .
[Bug tree-optimization/113186] [13/14 Regression] `(a^c) & (a^!c)` is not optimized to 0 for bool
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113186 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Target Milestone|--- |14.0 Last reconfirmed||2023-12-31 Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski --- I am going to fix this next week.