https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128911

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Hongyu Wang <[email protected]>:

https://gcc.gnu.org/g:bfd6e895d9ec31e43199c3581858becb80730fb3

commit r17-6581-gbfd6e895d9ec31e43199c3581858becb80730fb3
Author: Hongyu Wang <[email protected]>
Date:   Fri Nov 13 07:43:57 2026 +0530

    i386: Fix the compare and the flags mode in the APX ccmp pattern [PR128911]

    The @ccmp<mode> leaf compared (minus a b) against zero, which only matches
    the flags of cmp a, b for EQ/NE, so simplify-rtx could fold ordered and
    unsigned conditions wrongly. Also the condition was hard-coded on
    (reg:CC FLAGS_REG), losing the CC mode of the previous compare and the
    scc output was incorrect. Compare operands 2 and 3 directly and make the
    flags register an operand to inhert previous CCmode.

    gcc/ChangeLog:

            PR target/128911
            * config/i386/i386.md (@ccmp<mode>): Compare operands 2 and 3
            directly.  Use operand 5 for the flags register in operand 1.
            * config/i386/i386-expand.cc (ix86_gen_ccmp_next): Keep the CC
            mode of the previous compare and pass it as operand 5.

    gcc/testsuite/ChangeLog:

            PR target/128911
            * gcc.target/i386/pr128911-1.c: New test.
            * gcc.target/i386/pr128911-2.c: Likewise.
            * gcc.target/i386/pr128911-3.c: Likewise.

Reply via email to