https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82002
--- Comment #11 from dansan at gcc dot gnu.org --- Author: dansan Date: Sat Nov 4 22:38:43 2017 New Revision: 254412 URL: https://gcc.gnu.org/viewcvs?rev=254412&root=gcc&view=rev Log: PR target/82002 Part 2: Correct non-immediate offset/invalid INSN When we are realigning the stack pointer, making an ms_abi to sysv_abi call and allocating 2GiB or more on the stack we end up with an invalid INSN due to a non-immediate offset. This occurs both with and without -mcall-ms2sysv-xlogues. Additionally, the stack allocation with -mcall-ms2sysv-xlogues is ignoring (silently disabling) stack checking, stack clash checking and probing. This patch fixes these problems by: 1. No longer allocate stack space in ix86_emit_outlined_ms2sysv_save. 2. Rearrange where we emit SSE saves or stub call: a. Before frame allocation when offset from frame to save area is >= 2GiB. b. After frame allocation when frame is < 2GiB. (Stack allocations prior to the stub call can't be combined with those afterwards, so this is better when possible.) 3. Modify choose_baseaddr to take an optional scratch_regno argument and never return rtx that cannot be used as an immediate. gcc: config/i386/i386.c (choose_basereg): Use optional scratch register and add assertion. (x86_emit_outlined_ms2sysv_save): Use scratch register when needed, and don't allocate stack. (ix86_expand_prologue): Rearrange where SSE saves/stub call is emitted, correct wrong allocation with -mcall-ms2sysv-xlogues. (ix86_emit_outlined_ms2sysv_restore): Fix non-immediate offsets. gcc/testsuite: gcc.target/i386/pr82002-2a.c: Change from xfail to fail. gcc.target/i386/pr82002-2b.c: Likewise. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.target/i386/pr82002-2a.c trunk/gcc/testsuite/gcc.target/i386/pr82002-2b.c