https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128911
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Hongyu Wang <[email protected]>: https://gcc.gnu.org/g:77d6090f8450928ea569e7bd62896c989cdede9a commit r16-10006-g77d6090f8450928ea569e7bd62896c989cdede9a 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. (cherry picked from commit bfd6e895d9ec31e43199c3581858becb80730fb3)
