https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127773

--- Comment #2 from Michiel van Slobbe <michiel.van.slobbe at gmail dot com> ---
(In reply to Richard Biener from comment #1)
> Confirmed.  I think this is likely a target issue in interpreting IPA RA
> info?

Yes, I think so. The call gets AVX_U128_ANY instead of AVX_U128_CLEAN in
ix86_avx_u128_mode_needed, because of the "only safe to issue a vzeroupper if
all SSE registers are clobbered" check. With -fipa-ra (the default at -O2), f's
ABI clobbers only xmm0, so vzeroupper ends up after the call. With -fno-ipa-ra
it comes before the call.

ix86_mode_needed gets the live hard registers as its third argument (live_now
in mode-switching.cc) but ignores it. As an experiment, I returned
AVX_U128_CLEAN for the call unless an SSE register that the callee preserves is
live. That fixes the testcase: no assists, and a 256-bit value kept in a
register across the call is still preserved. But a redundant vzeroupper stays
after the call, because ix86_avx_u128_mode_after still returns ANY, so
pr112891-2.c sees 2. It also adds many vzerouppers in other gcc.target/i386
tests. I don't know this code well enough to say if this is the right
direction.

Reply via email to