https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112891
--- Comment #2 from Hongtao Liu <liuhongt at gcc dot gnu.org> --- (In reply to Hongtao Liu from comment #1) > Aaused by r10-3477-g2a2e3a0dfcbe08, Can be fixed by revert the patch. > > --- a/gcc/config/i386/i386.cc > +++ b/gcc/config/i386/i386.cc > @@ -15032,14 +15032,7 @@ ix86_avx_u128_mode_needed (rtx_insn *insn) > if (avx_upper_reg_found) > return AVX_U128_DIRTY; > > - /* If the function is known to preserve some SSE registers, > - RA and previous passes can legitimately rely on that for > - modes wider than 256 bits. It's only safe to issue a > - vzeroupper if all SSE registers are clobbered. */ > - const function_abi &abi = insn_callee_abi (insn); > - if (vzeroupper_pattern (PATTERN (insn), VOIDmode) > - || !hard_reg_set_subset_p (reg_class_contents[SSE_REGS], > - abi.mode_clobbers (V4DImode))) > + if (vzeroupper_pattern (PATTERN (insn), VOIDmode)) > return AVX_U128_ANY; > > return AVX_U128_CLEAN; Remove this regressed many testcases So it looks like we need to handle ix86_avx_u128_mode_after --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -15177,7 +15177,14 @@ ix86_avx_u128_mode_after (int mode, rtx_insn *insn) bool avx_upper_reg_found = false; note_stores (insn, ix86_check_avx_upper_stores, &avx_upper_reg_found); - return avx_upper_reg_found ? AVX_U128_DIRTY : AVX_U128_CLEAN; + if (avx_upper_reg_found) + return AVX_U128_DIRTY; + + const function_abi &abi = insn_callee_abi (insn); + if (!hard_reg_set_subset_p (reg_class_contents[SSE_REGS], + abi.mode_clobbers (V4DImode))) + return AVX_U128_ANY; + return AVX_U128_CLEAN; }