https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88717
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |9.0 --- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> --- Like this diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index d01278d866f..9b49a2c1d9c 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -19100,7 +19100,11 @@ ix86_avx_u128_mode_entry (void) rtx incoming = DECL_INCOMING_RTL (arg); if (incoming && ix86_check_avx_upper_register (incoming)) - return AVX_U128_DIRTY; + { + /* Caller is AVX_U128_DIRTY. */ + cfun->machine->caller_avx_u128_dirty = true; + return AVX_U128_DIRTY; + } } return AVX_U128_CLEAN; @@ -19130,6 +19134,10 @@ ix86_mode_entry (int entity) static int ix86_avx_u128_mode_exit (void) { + /* Exit mode is set to AVX_U128_DIRTY if caller is AVX_U128_DIRTY. */ + if (cfun->machine->caller_avx_u128_dirty) + return AVX_U128_DIRTY; + rtx reg = crtl->return_rtx; /* Exit mode is set to AVX_U128_DIRTY if there are 256bit diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 83b025e0cf5..c053b657a55 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2747,6 +2747,9 @@ struct GTY(()) machine_function { /* If true, ENDBR is queued at function entrance. */ BOOL_BITFIELD endbr_queued_at_entrance : 1; + /* If true, caller is AVX_U128_DIRTY. */ + BOOL_BITFIELD caller_avx_u128_dirty : 1; + /* The largest alignment, in bytes, of stack slot actually used. */ unsigned int max_used_stack_alignment;