https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114326
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <[email protected]>: https://gcc.gnu.org/g:ad6087410356999730cbe9680ada3077f4afcf76 commit r17-2291-gad6087410356999730cbe9680ada3077f4afcf76 Author: Andrew Pinski <[email protected]> Date: Sat Jul 4 00:32:03 2026 -0700 match: Fix up `((a ^ b) & c) cmp d || a != b` pattern and add support for && case [PR116860] Turns out it was easy to fix these patterns for `--param=logical-op-non-short-circuit=0` case after all. Just add support for `((a ^ b) & c) cmp d && a == b` which is the same as `!(((a ^ b) & c) cmp d || a != b)`. So this adds the bit_and case to support exactly that. Also fixes up some of the `:c` on the operands. `:c` needs to be on the outer bitop and does not need to be on the inner one for bit_xor as it will be the same order as ne/eq. PR tree-optimization/116860 PR tree-optimization/114326 gcc/ChangeLog: * match.pd (`((a ^ b) & c) cmp d || a != b`): Expand to support bit_and and fix up the :c. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/fold-xor-and-or-1.c: New test. * gcc.dg/tree-ssa/fold-xor-or-1.c: New test. * gcc.dg/tree-ssa/pr102793-1.c: Update for the optimization happening in pre. Signed-off-by: Andrew Pinski <[email protected]>
