I had to fix a few things for x32 compatibility and I this is ready now. H.J. tested on machine with avx512 (including x32) and I've tested both native x32 and normal x86_64 with m64, m32 and mx32 and all is well. I've made more changes to the tests so I'm just submitting a version 2 of the whole patch set.
OK for trunk? 2017-08-22 Daniel Santos <daniel.san...@pobox.com> * config/i386/i386.h (ix86_frame::stack_realign_allocate_offset): Remove field. (ix86_frame::stack_realign_allocate): New field. (struct machine_frame_state): Modify comments. (machine_frame_state::sp_realigned_fp_end): New field. * config/i386/i386.c (ix86_compute_frame_layout): Rework stack frame layout calculation. (sp_valid_at): Add assertion to assure no attempt to access invalid offset of a realigned stack. (fp_valid_at): Likewise. (choose_baseaddr): Modify comments. (ix86_emit_outlined_ms2sysv_save): Adjust to changes in ix86_expand_prologue. (ix86_expand_prologue): Modify stack realignment and allocation. (ix86_expand_epilogue): Modify comments. 2017-08-22 Daniel Santos <daniel.san...@pobox.com> * gcc.target/i386/pr80969-1.c: New testcase. * gcc.target/i386/pr80969-2a.c: Likewise. * gcc.target/i386/pr80969-2.c: Likewise. * gcc.target/i386/pr80969-3.c: Likewise. * gcc.target/i386/pr80969-4a.c: Likewise. * gcc.target/i386/pr80969-4b.c: Likewise. * gcc.target/i386/pr80969-4.c: Likewise. * gcc.target/i386/pr80969-4.h: New header common to pr80969-4*.c Thanks, Daniel