https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107881
--- Comment #19 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrea Pinski <[email protected]>: https://gcc.gnu.org/g:c7ebd58535ad63351123e2aa98b92b1eec3c8ca9 commit r17-4000-gc7ebd58535ad63351123e2aa98b92b1eec3c8ca9 Author: Andrea Pinski <[email protected]> Date: Tue Aug 11 11:17:08 2026 -0700 match/fold: Add support for NE, XOR, and EQ to combine_comparisons [PR107881] This adds support for !=, ^ and == to combine_comparisons and uses combine_comparisons in match for those cases instead of what was previously there. This allows for floating point comparisons to be merged in some more cases. And simplifies the match code to read. Also moves up the match pattern that uses combine_comparisons to above the other comparisons combines so it is matched first. Changes since v1: * v2: Add bitwise operators for comparison_code to hide the &0xf. Also place comparison_code in an anonymous namespace to mark it as local to the file. Update for the new sytanx of the match pattern. * v3: Update for the newer syntax. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/107881 gcc/ChangeLog: * fold-const.cc (enum comparison_code): Mark underlying type as unsigned char. Wrap in an anonymous namespace. (operator~): New function. (operator|): New function. (operator&): New function. (operator^): New function. (combine_comparisons): Add support for NE/XOR and EQ. * match.pd (`(a CMP1 b) OP (a CMP2 b)`): Move above others and add NE, XOR and EQ to the list of OPs. (`(a CMP1 b) ^ (a CMP2 b)`): Remove. (`(a CMP1 b) == (a CMP2 b)`): Remove. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/cmpeq-5.c: New test. * gcc.dg/tree-ssa/cmpxor-2.c: New test. Signed-off-by: Andrea Pinski <[email protected]>
