From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1059) id 23EA7393C85F; Thu, 27 Aug 2020 18:13:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23EA7393C85F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1598552001; bh=jTHkApQhQcLGGmPAlv/xGGHH4C8dEhXHrIHapwr5jwo=; h=From:To:Subject:Date:From; b=nxMcu2ZZ0x6tmQoYgwppyws1kGII19EBWEyUFRbef/KbdmtbXQkBcGXqcKWGLRces DECAedWwjgpPKgO3dj7ca7841Srf9vWwL61S8VzZP3GBsyjeZAox6rkWaBhKKaM3/C bliqa46pHq/gB7f2Uomn/dgEa0MuAS5k/y4HoMdY= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Nathan Sidwell To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/c++-modules] Don't use pinsr/pextr for struct initialization/extraction. X-Act-Checkin: gcc X-Git-Author: liuhongt X-Git-Refname: refs/heads/devel/c++-modules X-Git-Oldrev: 6d42cbe5ad7a7b46437f2576c9920e44dc14b386 X-Git-Newrev: 7d5de349d21479d7ec61dd0153e6f0958ad7384f Message-Id: <20200827181321.23EA7393C85F@sourceware.org> Date: Thu, 27 Aug 2020 18:13:21 +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: Thu, 27 Aug 2020 18:13:21 -0000 https://gcc.gnu.org/g:7d5de349d21479d7ec61dd0153e6f0958ad7384f commit 7d5de349d21479d7ec61dd0153e6f0958ad7384f Author: liuhongt Date: Wed Aug 12 10:48:17 2020 +0800 Don't use pinsr/pextr for struct initialization/extraction. gcc/ PR target/96562 PR target/93897 * config/i386/i386-expand.c (ix86_expand_pinsr): Don't use pinsr for TImode. (ix86_expand_pextr): Don't use pextr for TImode. gcc/testsuite/ * gcc.target/i386/pr96562-1.c: New test. Diff: --- gcc/config/i386/i386-expand.c | 2 - gcc/testsuite/gcc.target/i386/pr96562-1.c | 81 +++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index d8368bfd4a9..68fbe8385b3 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -20302,7 +20302,6 @@ ix86_expand_pextr (rtx *operands) case E_V4SImode: case E_V2DImode: case E_V1TImode: - case E_TImode: { machine_mode srcmode, dstmode; rtx d, pat; @@ -20398,7 +20397,6 @@ ix86_expand_pinsr (rtx *operands) case E_V4SImode: case E_V2DImode: case E_V1TImode: - case E_TImode: { machine_mode srcmode, dstmode; rtx (*pinsr)(rtx, rtx, rtx, rtx); diff --git a/gcc/testsuite/gcc.target/i386/pr96562-1.c b/gcc/testsuite/gcc.target/i386/pr96562-1.c new file mode 100644 index 00000000000..6ebeeb1fb17 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr96562-1.c @@ -0,0 +1,81 @@ +/* { dg-do compile} */ +/* { dg-options "-msse4.1 -O2" } */ +/* { dg-final { scan-assembler-not "pinsr" } } */ + +typedef struct +{ + long long a; + int b; +} st1; + +typedef struct +{ + long long a; + int b; + short c; +} st2; + +typedef struct +{ + long long a; + int b; + short c; + char d; +} st3; + +typedef struct +{ + int b; + long long a; +} st4; + +typedef struct +{ + short c; + int b; + long long a; +} st5; + +typedef struct +{ + char d; + short c; + int b; + long long a; +} st6; + +st1 +foo1 (long long a, int b) +{ + return (st1){a, b}; +} + +st2 +foo2 (long long a, int b, short c) +{ + return (st2){a, b, c}; +} + +st3 +foo3 (long long a, int b, short c, char d) +{ + return (st3){a, b, c, d}; +} + +st4 +foo4 (long long a, int b) +{ + return (st4){b, a}; +} + +st5 +foo5 (long long a, int b, short c) +{ + return (st5){c, b, a}; +} + +st6 +foo6 (long long a, int b, short c, char d) +{ + return (st6){d, c, b, a}; +}