From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14394 invoked by alias); 10 Feb 2020 06:25:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 14386 invoked by uid 89); 10 Feb 2020 06:25:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,MIME_CHARSET_FARAWAY,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Feb 2020 06:25:03 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01A6P1pE118354 for ; Mon, 10 Feb 2020 01:25:02 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y1umr7tu1-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 10 Feb 2020 01:25:01 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 10 Feb 2020 06:24:43 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 10 Feb 2020 06:24:41 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01A6OeBw66584604 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Feb 2020 06:24:40 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7A6C411C05C; Mon, 10 Feb 2020 06:24:40 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E57BB11C04A; Mon, 10 Feb 2020 06:24:17 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.200.54.24]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 10 Feb 2020 06:24:17 +0000 (GMT) Subject: [PATCH 4/4 v2 GCC11] rs6000: P9 D-form test cases To: Segher Boessenkool Cc: GCC Patches , Bill Schmidt , "bin.cheng" , Richard Guenther References: <91209c2f-50f8-556b-bde4-3a4f93c8accd@linux.ibm.com> <20200120131948.GY3191@gate.crashing.org> From: "Kewen.Lin" Date: Mon, 10 Feb 2020 06:25:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200120131948.GY3191@gate.crashing.org> Content-Type: multipart/mixed; boundary="------------8BC26B7D613ED3ED085591B0" x-cbid: 20021006-0008-0000-0000-0000035165F6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20021006-0009-0000-0000-00004A7201E9 Message-Id: X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00518.txt.bz2 This is a multi-part message in MIME format. --------------8BC26B7D613ED3ED085591B0 Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 8bit Content-length: 1009 Hi Segher, Updated as below according to your suggestion. BR, Kewen -------- gcc/testsuite/ChangeLog 2020-02-10 Kelvin Nilsen Kewen Lin * gcc.target/powerpc/p9-dform-0.c: New test. * gcc.target/powerpc/p9-dform-1.c: New test. * gcc.target/powerpc/p9-dform-2.c: New test. * gcc.target/powerpc/p9-dform-3.c: New test. * gcc.target/powerpc/p9-dform-4.c: New test. * gcc.target/powerpc/p9-dform-generic.h: New test. on 2020/1/20 ÏÂÎç9:19, Segher Boessenkool wrote: > Hi! > > On Thu, Jan 16, 2020 at 05:42:41PM +0800, Kewen.Lin wrote: >> +/* At time the dform optimization pass was merged with trunk, 12 >> + lxv instructions were emitted in place of the same number of lxvx >> + instructions. No need to require exactly this number, as it may >> + change when other optimization passes evolve. */ >> + >> +/* { dg-final { scan-assembler {\mlxv\M} } } */ > > Maybe you can also test there ar no lxvx insns generated? > Done, thanks! --------------8BC26B7D613ED3ED085591B0 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="0004_v2_not.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0004_v2_not.patch" Content-length: 7515 --- gcc/testsuite/gcc.target/powerpc/p9-dform-0.c | 44 +++++++++++++++++ gcc/testsuite/gcc.target/powerpc/p9-dform-1.c | 57 ++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/p9-dform-2.c | 14 ++++++ gcc/testsuite/gcc.target/powerpc/p9-dform-3.c | 17 +++++++ gcc/testsuite/gcc.target/powerpc/p9-dform-4.c | 14 ++++++ .../gcc.target/powerpc/p9-dform-generic.h | 34 +++++++++++++ 6 files changed, 180 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-dform-0.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-dform-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-dform-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-dform-3.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-dform-4.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p9-dform-generic.h diff --git a/gcc/testsuite/gcc.target/powerpc/p9-dform-0.c b/gcc/testsuite/gcc.target/powerpc/p9-dform-0.c new file mode 100644 index 0000000..68b0434 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-dform-0.c @@ -0,0 +1,44 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-O3 -mdejagnu-cpu=power9 -funroll-loops" } */ + +/* This test confirms that the dform instructions are selected in the + translation of this main program. */ + +extern void first_dummy (); +extern void dummy (double sacc, int n); +extern void other_dummy (); + +extern float opt_value; +extern char *opt_desc; + +#define M 128 +#define N 512 + +double x [N]; +double y [N]; + +int main (int argc, char *argv []) { + double sacc; + + first_dummy (); + for (int j = 0; j < M; j++) { + + sacc = 0.00; + for (unsigned long long int i = 0; i < N; i++) { + sacc += x[i] * y[i]; + } + dummy (sacc, N); + } + opt_value = ((float) N) * 2 * ((float) M); + opt_desc = "flops"; + other_dummy (); +} + +/* At time the dform optimization pass was merged with trunk, 12 + lxv instructions were emitted in place of the same number of lxvx + instructions. No need to require exactly this number, as it may + change when other optimization passes evolve. */ + +/* { dg-final { scan-assembler {\mlxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-dform-1.c b/gcc/testsuite/gcc.target/powerpc/p9-dform-1.c new file mode 100644 index 0000000..b80ffbc --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-dform-1.c @@ -0,0 +1,57 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-O3 -mdejagnu-cpu=power9 -funroll-loops" } */ + +/* This test confirms that the dform instructions are selected in the + translation of this main program. */ + +extern void first_dummy (); +extern void dummy (double sacc, int n); +extern void other_dummy (); + +extern float opt_value; +extern char *opt_desc; + +#define M 128 +#define N 512 + +double x [N]; +double y [N]; +double z [N]; + +int main (int argc, char *argv []) { + double sacc; + + first_dummy (); + for (int j = 0; j < M; j++) { + + sacc = 0.00; + for (unsigned long long int i = 0; i < N; i++) { + z[i] = x[i] * y[i]; + sacc += z[i]; + } + dummy (sacc, N); + } + opt_value = ((float) N) * 2 * ((float) M); + opt_desc = "flops"; + other_dummy (); +} + + + +/* At time the dform optimization pass was merged with trunk, 12 + lxv instructions were emitted in place of the same number of lxvx + instructions. No need to require exactly this number, as it may + change when other optimization passes evolve. */ + +/* { dg-final { scan-assembler {\mlxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ + +/* At time the dform optimization pass was merged with trunk, 6 + stxv instructions were emitted in place of the same number of stxvx + instructions. No need to require exactly this number, as it may + change when other optimization passes evolve. */ + +/* { dg-final { scan-assembler {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mstxvx\M} } } */ + diff --git a/gcc/testsuite/gcc.target/powerpc/p9-dform-2.c b/gcc/testsuite/gcc.target/powerpc/p9-dform-2.c new file mode 100644 index 0000000..51789d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-dform-2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-O3 -mdejagnu-cpu=power9 -funroll-loops" } */ + +#define TYPE int +#include "p9-dform-generic.h" + +/* The precise number of lxv and stxv instructions may be impacted by + complex interactions between optimization passes, but we expect at + least one of each. */ +/* { dg-final { scan-assembler {\mlxv\M} } } */ +/* { dg-final { scan-assembler {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ +/* { dg-final { scan-assembler-not {\mstxvx\M} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-dform-3.c b/gcc/testsuite/gcc.target/powerpc/p9-dform-3.c new file mode 100644 index 0000000..1a4b6c5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-dform-3.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-O3 -mdejagnu-cpu=power9 -funroll-loops" } */ + +#define TYPE double +#include "p9-dform-generic.h" + +/* At time the dform optimization pass was merged with trunk, 6 + lxv instructions were emitted in place of the same number of lxvx + instructions and 8 stxv instructions replace the same number of + stxvx instructions. No need to require exactly this number, as it + may change when other optimization passes evolve. */ + +/* { dg-final { scan-assembler {\mlxv\M} } } */ +/* { dg-final { scan-assembler {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ +/* { dg-final { scan-assembler-not {\mstxvx\M} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-dform-4.c b/gcc/testsuite/gcc.target/powerpc/p9-dform-4.c new file mode 100644 index 0000000..752f987 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-dform-4.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=power9 -funroll-loops -mfloat128" } */ + +#define TYPE __float128 +#include "p9-dform-generic.h" + +/* The precise number of lxv and stxv instructions may be impacted by + complex interactions between optimization passes, but we expect at + least one of each. */ +/* { dg-final { scan-assembler {\mlxv\M} } } */ +/* { dg-final { scan-assembler {\mstxv\M} } } */ +/* { dg-final { scan-assembler-not {\mlxvx\M} } } */ +/* { dg-final { scan-assembler-not {\mstxvx\M} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-dform-generic.h b/gcc/testsuite/gcc.target/powerpc/p9-dform-generic.h new file mode 100644 index 0000000..3caed25 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p9-dform-generic.h @@ -0,0 +1,34 @@ + +#define ITERATIONS 1000000 + +#define SIZE (16384/sizeof(TYPE)) + +static TYPE x[SIZE] __attribute__ ((aligned (16))); +static TYPE y[SIZE] __attribute__ ((aligned (16))); +static TYPE a; + +void obfuscate(void *a, ...); + +static void __attribute__((noinline)) do_one(void) +{ + unsigned long i; + + obfuscate(x, y, &a); + + for (i = 0; i < SIZE; i++) + y[i] = a * x[i]; + + obfuscate(x, y, &a); + +} + +int main(void) +{ + unsigned long i; + + for (i = 0; i < ITERATIONS; i++) + do_one(); + + return 0; + +} -- 2.7.4 --------------8BC26B7D613ED3ED085591B0--