https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112891
Hongtao Liu <liuhongt at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target| |x86_64-*-* i?86-*-* --- Comment #1 from Hongtao Liu <liuhongt at gcc dot gnu.org> --- 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; It looks like abi.mode_clobbers is not equal to there's ymm/zmm live through the callee, it just means callee doens't need to clobber those registers according to RA. So when there's no 256/512-bit registers live through the callee there're would be some mistake for the mode. since ix86_avx_u128_mode_after will return AVX_U128_CLEAN is there's no 256/512-bit registers are returned, but actaully it 's still dirty for upper bits since there's no vzeroupper inserted.