https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127773
--- 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:1e1d34b23316f7cc87773edcda5567764af41cc8 commit r17-5179-g1e1d34b23316f7cc87773edcda5567764af41cc8 Author: liuhongt <[email protected]> Date: Fri Oct 9 22:37:16 2026 -0700 i386: Improve vzeroupper placement with IPA-RA [PR127773] The restriction introduced in r10-3477 prevents vzeroupper from clobbering wide values kept in callee-preserved SSE registers. r14-6447 also stopped assuming clean upper state after calls to callees that preserve SSE upper halves. This is too conservative when no preserved SSE register is live across the call. With -fipa-ra, cleanup then goes after a legacy SSE call, leaving the callee to pay the AVX/SSE transition penalties in PR127773. TARGET_MODE_NEEDED now provides LIVE. Use it, excluding registers that die at the call, to retain the correctness protection only when a preserved SSE register is live across the call. Keep the incoming mode after calls with partial clobbers to avoid repeating cleanup afterward. Leave upper state unchanged before calls that clobber no SSE registers, so integer-only callees do not force cleanup in AVX loops. Fixed registers are not counted as clobbered by the callee, e.g. xmm8-xmm15 for ia32 or an SSE register given by -ffixed-xmmN. gcc/ChangeLog: PR target/127773 * config/i386/i386.cc (ix86_avx_u128_mode_needed): Add LIVE argument. Check live preserved SSE registers before requiring AVX_U128_CLEAN. Do not require clean upper state for callees that clobber no SSE registers, ignoring fixed registers. (ix86_mode_needed): Pass LIVE. (ix86_avx_u128_mode_after): Keep MODE after partial-clobber calls. gcc/testsuite/ChangeLog: PR target/127773 * gcc.target/i386/pr127773-1.c: New test. * gcc.target/i386/pr127773-2.c: New test. * gcc.target/i386/pr127773-3.c: New test. * gcc.target/i386/pr127773-4.c: New test. * gcc.target/i386/pr127773-5.c: New test. * gcc.target/i386/pr127773-6.c: New test.
