https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107881
--- Comment #17 from CVS 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:895e476f64c308dfdbf49693d0b1166c0b7733de commit r14-3881-g895e476f64c308dfdbf49693d0b1166c0b7733de Author: Andrew Pinski <apin...@marvell.com> Date: Mon Sep 11 15:35:59 2023 -0700 MATCH: Simplify (a CMP1 b) ^ (a CMP2 b) This adds the missing optimizations here. Note we don't need to match where CMP1 and CMP2 are complements of each other as that is already handled elsewhere. I added a new executable testcase to make sure we optimize it correctly as I had originally messed up one of the entries for the resulting comparison to make sure they were 100% correct. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/107881 gcc/ChangeLog: * match.pd (`(a CMP1 b) ^ (a CMP2 b)`): New pattern. (`(a CMP1 b) == (a CMP2 b)`): New pattern. gcc/testsuite/ChangeLog: * gcc.c-torture/execute/pr107881-1.c: New test. * gcc.dg/tree-ssa/cmpeq-4.c: New test. * gcc.dg/tree-ssa/cmpxor-1.c: New test.