From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1039) id 9F49C386480A; Wed, 4 Aug 2021 19:58:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F49C386480A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: H.J. Lu To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2747] x86: Avoid stack realignment when copying data with SSE register X-Act-Checkin: gcc X-Git-Author: H.J. Lu X-Git-Refname: refs/heads/master X-Git-Oldrev: 361da782a25031c6ae3967bf8c10a8119845255c X-Git-Newrev: 09dba016db937e61be21ef1e9581065a9ed2847d Message-Id: <20210804195809.9F49C386480A@sourceware.org> Date: Wed, 4 Aug 2021 19:58:09 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2021 19:58:09 -0000 https://gcc.gnu.org/g:09dba016db937e61be21ef1e9581065a9ed2847d commit r12-2747-g09dba016db937e61be21ef1e9581065a9ed2847d Author: H.J. Lu Date: Wed Aug 4 06:15:04 2021 -0700 x86: Avoid stack realignment when copying data with SSE register To avoid stack realignment, call ix86_gen_scratch_sse_rtx to get a scratch SSE register to copy data with with SSE register from one memory location to another. gcc/ PR target/101772 * config/i386/i386-expand.c (ix86_expand_vector_move): Call ix86_gen_scratch_sse_rtx to get a scratch SSE register to copy data with SSE register from one memory location to another. gcc/testsuite/ PR target/101772 * gcc.target/i386/eh_return-2.c: New test. Diff: --- gcc/config/i386/i386-expand.c | 6 +++++- gcc/testsuite/gcc.target/i386/eh_return-2.c | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index 1d469bf7221..bd21efa9530 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -613,7 +613,11 @@ ix86_expand_vector_move (machine_mode mode, rtx operands[]) arguments in memory. */ if (!register_operand (op0, mode) && !register_operand (op1, mode)) - op1 = force_reg (mode, op1); + { + rtx scratch = ix86_gen_scratch_sse_rtx (mode); + emit_move_insn (scratch, op1); + op1 = scratch; + } tmp[0] = op0; tmp[1] = op1; ix86_expand_vector_move_misalign (mode, tmp); diff --git a/gcc/testsuite/gcc.target/i386/eh_return-2.c b/gcc/testsuite/gcc.target/i386/eh_return-2.c new file mode 100644 index 00000000000..f23f4492dac --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/eh_return-2.c @@ -0,0 +1,16 @@ +/* PR target/101772 */ +/* { dg-do compile } */ +/* { dg-additional-options "-O0 -march=x86-64 -mstackrealign" } */ + +struct _Unwind_Context _Unwind_Resume_or_Rethrow_this_context; + +void offset (int); + +struct _Unwind_Context { + void *reg[7]; +} _Unwind_Resume_or_Rethrow() { + struct _Unwind_Context cur_contextcur_context = + _Unwind_Resume_or_Rethrow_this_context; + offset(0); + __builtin_eh_return ((long) offset, 0); +}