https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128923
--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by hongtao Liu <[email protected]>: https://gcc.gnu.org/g:5e46f75475ae102684b39ac9702e5b8e67e5d502 commit r17-7014-g5e46f75475ae102684b39ac9702e5b8e67e5d502 Author: liuhongt <[email protected]> Date: Wed Nov 4 00:48:20 2026 -0800 x86: Keep min/max recognizable for selects without blendv Without blendv (no SSE4.1, or TARGET_SSE_MOVCC_USE_BLENDV off as on Sierra Forest and Clearwater Forest), ix86_expand_sse_movcc expands an FP select into (mask & a) | (~mask & b) right away, so combine can't turn cmp + select into minps/maxps. Emit UNSPEC_SSE_MOVCC instead, split by ix86_expand_sse_movcc_logic before reload, and let the min/max splitters match it like UNSPEC_BLENDV. It is costed as its split form. This also fixes pr88540.c, XFAILed since the vcond{,u,eq} patterns were removed. This improves 736.ocio_r on Clearwater Forest. gcc/ChangeLog: PR target/115517 PR target/115683 PR target/128923 * config/i386/i386.md (UNSPEC_SSE_MOVCC): New unspec. (BLENDV_OR_MOVCC): New int iterator. (blendv_or_movcc): New int attribute. (*sse_movcc_logic<mode>): New define_insn_and_split. (*ieee_max<mode>3_1): Rename to ... (*ieee_max<mode>3_1<blendv_or_movcc>): ... this. Also match UNSPEC_SSE_MOVCC. (*ieee_min<mode>3_1): Rename to ... (*ieee_min<mode>3_1<blendv_or_movcc>): ... this. Also match UNSPEC_SSE_MOVCC. * config/i386/sse.md (*minmax<mode>3_2): Rename to ... (*minmax<mode>3_2<blendv_or_movcc>): ... this. Also match UNSPEC_SSE_MOVCC. (*sse_movcc_logic<mode>): New define_insn_and_split. * config/i386/i386-expand.cc (ix86_expand_sse_movcc): Emit UNSPEC_SSE_MOVCC for FP modes instead of the logical sequence. * config/i386/i386.cc (ix86_rtx_costs): Handle UNSPEC_SSE_MOVCC. (ix86_unspec_may_trap_p): Likewise. gcc/testsuite/ChangeLog: PR target/115517 PR target/115683 PR target/128923 * gcc.target/i386/pr88540.c: Remove xfail. * gcc.target/i386/minmax-13.c: New test. * gcc.target/i386/minmax-14.c: New test. * gcc.target/i386/minmax-15.c: New test. * gcc.target/i386/minmax-16.c: New test.
