From patchwork Mon Nov 20 04:26:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Meissner X-Patchwork-Id: 166946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1975188vqn; Sun, 19 Nov 2023 20:27:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHw/pmsAcYl/2ObAvlWZfQ+Xu2H4s7HVUKRp4KjdS/Ae93myM/95MhOVRNXrwCK3FaI2y7i X-Received: by 2002:a05:620a:11ab:b0:76f:c24:5450 with SMTP id c11-20020a05620a11ab00b0076f0c245450mr7027822qkk.2.1700454446373; Sun, 19 Nov 2023 20:27:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700454446; cv=pass; d=google.com; s=arc-20160816; b=DKuRY9Cgl+b47IET9xk9FpqVOD27t2SfaanAsXOPeNkLfWB+wNXfN6ZV3SMPnBrPPK Zq2zag0gVvkJ9AP++qa6y0r3OzqOqguz9mqTK6dMXhTz5Fk9MlcrtvyfpI+NXn7vjwiE J6V29LvOg7Yh8ylLxNCczZpCaBmBa2KAU3GCFqvPZRdoIOAdT63MHpepdyB55Qr3fNuW n+Aav0IDKFfY8LnODE11si57d4eYl1JrGAkZF7MPn/47qmPQR1y7yyFpdj4+P9u5ch4C Zz00Co6EQug15YhGk2Yp89+R/mQN+6qT7j6XDEcSO+M5qgItfmMuIe6dighRgmx+ZSmd uU5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:to:from :date:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=fNDdmrto4jIs2LQLr1yBd13YVix8H2eJq4IXmAN4WSU=; fh=jH+DijE7mz3ySVsRmzRqEe/ioBeGu3vnvA+jm2JjCm8=; b=hvK/hH1ZS0gzJc/vmYDqjMWtUjNjvqD2IWhwsX95p77LwD3xCrA8EktxET5JrsTrLz gwBjqPPwugfgrC/gzp0S4x3vuPl9YVpx+EHkce19zxpP7C1BxXXdPX7vlTsbK0oaMTDj z7+qwYytruUvVmO2m73dyC7n89NqDPZLIusr5VdcB03f/m9s0JfSeJoROrySe3N/h7i3 2X/PsTmWLoeNp5PAQtxIUcwiJbnblMCKDOOhoczwzkWG8ZbWEIY3UW14TsJmvv/28OzQ f0pEa5jthwEemN2cG6L7fj2CLNKt/C316m9VnhwbnZktKfAPS/hrbYWDXFsM2cSZ58Wv QXVQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=REFAr414; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q14-20020a05620a0d8e00b0077be8e63a21si6851702qkl.469.2023.11.19.20.27.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 20:27:26 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=REFAr414; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2823E3858423 for ; Mon, 20 Nov 2023 04:27:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 689383858C78 for ; Mon, 20 Nov 2023 04:27:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 689383858C78 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 689383858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700454424; cv=none; b=QvS5ypuGGtqeoiVEyxZEPxsDf2h9jPO3Otics6OWcFwCMXhejxdH2IM+v8DyPX9szd+4Xmf6kwB9cUzZZsO7er5JYXVtzCBhFGJXcf3/9F05cafI8kO/1/KHlmdQ1Yr99Ma58Y8c03VXf+jWB4B+NQNRalY2g46o12y7frskpRo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700454424; c=relaxed/simple; bh=KZEUMXLMpB7kDDUZL10/3loJaMAKQWJy7ZT6gnt3ppk=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=oiXfG75Me+9GV3SvlMTBSbYI2KY1ZTGR2DWUb/Lju05L4K6lbNQvUABHu/HAX2bE5xLg14b3fOgsezDRiBU/4mx2Fxr24ncIJYr5KQt8pccpCeZ8lYzIF9eEvgh+q3amfZ0A1uIuuRSjBb1rVSfwA3Cx0CqeMuU3UJ4yMNvURfw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AK41KoH026047; Mon, 20 Nov 2023 04:27:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=fNDdmrto4jIs2LQLr1yBd13YVix8H2eJq4IXmAN4WSU=; b=REFAr414yYlwt/+FP7fugfA9Knqn+7gnFsHfo+3FI1bHr+FQkrVPMSPlyGTAFU9gjZjH 4jIP3m+KyxK+iKP8/aFcBf2acdSad73VktAZnSfiixA80Yy1zsy8HPTobPcGM2mb5AN2 FmZNT90MixQxZTrLKq37hM8O+Y8klLciSENviD/XXgiCWsqRrjY7iC9A+SHYFQ3q9TPh RHXkx0tN1fcvXU2yTpF6P4z018E4D5r0TudHFwnXRla+7MgRR5s1kSKAx/tj0hG3KInA LerAq3+jF3dMBlaMYgYlHE+Lz3guz0/Fvotm2xi3b8WckMjVIhRD/XZOjZ5LS5jG7jcH og== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ufuwrvewc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 04:27:00 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AK4QNFF016304; Mon, 20 Nov 2023 04:27:00 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ufuwrvew6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 04:27:00 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AK1psDW015174; Mon, 20 Nov 2023 04:26:59 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3uf7ksq4jt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 04:26:59 +0000 Received: from smtpav02.dal12v.mail.ibm.com (smtpav02.dal12v.mail.ibm.com [10.241.53.101]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AK4QwqY8389332 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Nov 2023 04:26:58 GMT Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B3B7C5805A; Mon, 20 Nov 2023 04:26:58 +0000 (GMT) Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3770558051; Mon, 20 Nov 2023 04:26:58 +0000 (GMT) Received: from cowardly-lion.the-meissners.org (unknown [9.61.1.46]) by smtpav02.dal12v.mail.ibm.com (Postfix) with ESMTPS; Mon, 20 Nov 2023 04:26:58 +0000 (GMT) Date: Sun, 19 Nov 2023 23:26:56 -0500 From: Michael Meissner To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner Subject: [PATCH 4/4] Add vector pair tests to PowerPC Message-ID: Mail-Followup-To: Michael Meissner , gcc-patches@gcc.gnu.org, Segher Boessenkool , "Kewen.Lin" , David Edelsohn , Peter Bergner References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Xg7JkpKj1b_71WH-75jIDmCx70NihuJ4 X-Proofpoint-GUID: GKzjRZKTNzNSO-vCCbGfR_ykWGuxzmMv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-20_01,2023-11-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 suspectscore=0 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311200029 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783055721750387269 X-GMAIL-MSGID: 1783055721750387269 The first patch in the vector pair series was previous posted. This patch needs that first patch. The first patch implemented the basic modes, and it allows for initialization of the modes. In addition, I added some optimizations for extracting and setting fields within the vector pair. The second patch in the vector pair series implemented floating point support. The third patch in the vector pair series implemented integer point support. This fourth patch provide new tests to the test suite. When I test a saxpy type loop (a[i] += (b[i] * c[i])), I generally see a 10% improvement over either auto-factorization, or just using the vector types. I have tested these patches on a little endian power10 system. With -vector-size-32 disabled by default, there are no regressions in the test suite. I have also built and run the tests on both little endian power 9 and big endian 9 power systems, and there are no regressions. Can I check these patches into the master branch? 2023-11-19 Michael Meisner gcc/ * gcc.target/powerpc/vector-size-32-1.c: New test. * gcc.target/powerpc/vector-size-32-2.c: New test. * gcc.target/powerpc/vector-size-32-3.c: New test. * gcc.target/powerpc/vector-size-32-4.c: New test. * gcc.target/powerpc/vector-size-32-5.c: New test. * gcc.target/powerpc/vector-size-32-6.c: New test. * gcc.target/powerpc/vector-size-32-7.c: New test. --- .../gcc.target/powerpc/vector-size-32-1.c | 106 ++++++++++++++ .../gcc.target/powerpc/vector-size-32-2.c | 106 ++++++++++++++ .../gcc.target/powerpc/vector-size-32-3.c | 137 ++++++++++++++++++ .../gcc.target/powerpc/vector-size-32-4.c | 137 ++++++++++++++++++ .../gcc.target/powerpc/vector-size-32-5.c | 137 ++++++++++++++++++ .../gcc.target/powerpc/vector-size-32-6.c | 137 ++++++++++++++++++ .../gcc.target/powerpc/vector-size-32-7.c | 31 ++++ 7 files changed, 791 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/vector-size-32-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vector-size-32-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vector-size-32-3.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vector-size-32-4.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vector-size-32-5.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vector-size-32-6.c create mode 100644 gcc/testsuite/gcc.target/powerpc/vector-size-32-7.c diff --git a/gcc/testsuite/gcc.target/powerpc/vector-size-32-1.c b/gcc/testsuite/gcc.target/powerpc/vector-size-32-1.c new file mode 100644 index 00000000000..fd1e2decea7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vector-size-32-1.c @@ -0,0 +1,106 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-mdejagnu-cpu=power10 -O2 -mvector-size-32" } */ + +/* Test whether the __attrbiute__((__vector_size(32))) generates paired vector + loads and stores with the -mvector-size-32 option. This file tests 32-byte + vectors with 4 double elements. */ + +typedef double vectype_t __attribute__((__vector_size__(32))); + +void +test_add (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xvadddp, 1 stxvp. */ + *dest = *a + *b; +} + +void +test_sub (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xvsubdp, 1 stxvp. */ + *dest = *a - *b; +} + +void +test_multiply (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xvmuldp, 1 stxvp. */ + *dest = *a * *b; +} + +void +test_divide (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xvdivdp, 1 stxvp. */ + *dest = *a / *b; +} + +void +test_negate (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xvnegdp, 1 stxvp. */ + *dest = - *a; +} + +void +test_fma (vectype_t *dest, + vectype_t *a, + vectype_t *b, + vectype_t *c) +{ + /* 2 lxvp, 2 xvmadd{a,m}dp, 1 stxvp. */ + *dest = (*a * *b) + *c; +} + +void +test_fms (vectype_t *dest, + vectype_t *a, + vectype_t *b, + vectype_t *c) +{ + /* 2 lxvp, 2 xvmsub{a,m}dp, 1 stxvp. */ + *dest = (*a * *b) - *c; +} + +void +test_nfma (vectype_t *dest, + vectype_t *a, + vectype_t *b, + vectype_t *c) +{ + /* 2 lxvp, 2 xvnmadddp, 1 stxvp. */ + *dest = -((*a * *b) + *c); +} + +void +test_nfms (vectype_t *dest, + vectype_t *a, + vectype_t *b, + vectype_t *c) +{ + /* 2 lxvp, 2 xvnmsubdp, 1 stxvp. */ + *dest = -((*a * *b) - *c); +} + +/* { dg-final { scan-assembler-times {\mlxvp\M} 21 } } */ +/* { dg-final { scan-assembler-times {\mstxvp\M} 9 } } */ +/* { dg-final { scan-assembler-times {\mxvadddp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvdivdp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvmadd.dp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvmsub.dp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvmuldp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvnegdp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvnmadd.dp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvnmsub.dp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvsubdp\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vector-size-32-2.c b/gcc/testsuite/gcc.target/powerpc/vector-size-32-2.c new file mode 100644 index 00000000000..eccc9c7aabf --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vector-size-32-2.c @@ -0,0 +1,106 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-mdejagnu-cpu=power10 -O2 -mvector-size-32" } */ + +/* Test whether the __attrbiute__((__vector_size(32))) generates paired vector + loads and stores with the -mvector-size-32 option. This file tests 32-byte + vectors with 8 float elements. */ + +typedef float vectype_t __attribute__((__vector_size__(32))); + +void +test_add (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xvaddsp, 1 stxvp. */ + *dest = *a + *b; +} + +void +test_sub (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xvsubsp, 1 stxvp. */ + *dest = *a - *b; +} + +void +test_multiply (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xvmulsp, 1 stxvp. */ + *dest = *a * *b; +} + +void +test_divide (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xvdivsp, 1 stxvp. */ + *dest = *a / *b; +} + +void +test_negate (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xvnegsp, 1 stxvp. */ + *dest = - *a; +} + +void +test_fma (vectype_t *dest, + vectype_t *a, + vectype_t *b, + vectype_t *c) +{ + /* 2 lxvp, 2 xvmadd{a,m}sp, 1 stxvp. */ + *dest = (*a * *b) + *c; +} + +void +test_fms (vectype_t *dest, + vectype_t *a, + vectype_t *b, + vectype_t *c) +{ + /* 2 lxvp, 2 xvmsub{a,m}sp, 1 stxvp. */ + *dest = (*a * *b) - *c; +} + +void +test_nfma (vectype_t *dest, + vectype_t *a, + vectype_t *b, + vectype_t *c) +{ + /* 2 lxvp, 2 xvnmaddsp, 1 stxvp. */ + *dest = -((*a * *b) + *c); +} + +void +test_nfms (vectype_t *dest, + vectype_t *a, + vectype_t *b, + vectype_t *c) +{ + /* 2 lxvp, 2 xvnmsubsp, 1 stxvp. */ + *dest = -((*a * *b) - *c); +} + +/* { dg-final { scan-assembler-times {\mlxvp\M} 21 } } */ +/* { dg-final { scan-assembler-times {\mstxvp\M} 9 } } */ +/* { dg-final { scan-assembler-times {\mxvaddsp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvdivsp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvmadd.sp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvmsub.sp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvmulsp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvnegsp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvnmadd.sp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvnmsub.sp\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxvsubsp\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vector-size-32-3.c b/gcc/testsuite/gcc.target/powerpc/vector-size-32-3.c new file mode 100644 index 00000000000..b1952b046f9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vector-size-32-3.c @@ -0,0 +1,137 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-mdejagnu-cpu=power10 -O2 -mvector-size-32" } */ + +/* Test whether the __attrbiute__((__vector_size(32))) generates paired vector + loads and stores with the -mvector-size-32 option. This file tests 32-byte + vectors with 4 64-bit integer elements. */ + +typedef long long vectype_t __attribute__((__vector_size__(32))); + +void +test_add (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 vaddudm, 1 stxvp. */ + *dest = *a + *b; +} + +void +test_sub (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 vsubudm, 1 stxvp. */ + *dest = *a - *b; +} + +void +test_negate (vectype_t *dest, + vectype_t *a) +{ + /* 2 lxvp, 2 vnegd, 1 stxvp. */ + *dest = - *a; +} + +void +test_not (vectype_t *dest, + vectype_t *a) +{ + /* 2 lxvp, 2 xxlnor, 1 stxvp. */ + *dest = ~ *a; +} + +void +test_and (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxland, 1 stxvp. */ + *dest = *a & *b; +} + +void +test_or (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlor, 1 stxvp. */ + *dest = *a | *b; +} + +void +test_xor (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlxor, 1 stxvp. */ + *dest = *a ^ *b; +} + +void +test_andc_1 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlandc, 1 stxvp. */ + *dest = (~ *a) & *b; +} + +void +test_andc_2 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlandc, 1 stxvp. */ + *dest = *a & (~ *b); +} + +void +test_orc_1 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlorc, 1 stxvp. */ + *dest = (~ *a) | *b; +} + +void +test_orc_2 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlorc, 1 stxvp. */ + *dest = *a | (~ *b); +} + +void +test_nand (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlnand, 1 stxvp. */ + *dest = ~(*a & *b); +} + +void +test_nor (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlnor, 1 stxvp. */ + *dest = ~(*a | *b); +} + +/* { dg-final { scan-assembler-times {\mlxvp\M} 24 } } */ +/* { dg-final { scan-assembler-times {\mstxvp\M} 13 } } */ +/* { dg-final { scan-assembler-times {\mvaddudm\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mvnegd\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mvsubudm\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxland\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlandc\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlnand\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlnor\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlor\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlorc\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlxor\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vector-size-32-4.c b/gcc/testsuite/gcc.target/powerpc/vector-size-32-4.c new file mode 100644 index 00000000000..110292bb4df --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vector-size-32-4.c @@ -0,0 +1,137 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-mdejagnu-cpu=power10 -O2 -mvector-size-32" } */ + +/* Test whether the __attrbiute__((__vector_size(32))) generates paired vector + loads and stores with the -mvector-size-32 option. This file tests 32-byte + vectors with 4 64-bit integer elements. */ + +typedef int vectype_t __attribute__((__vector_size__(32))); + +void +test_add (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 vadduwm, 1 stxvp. */ + *dest = *a + *b; +} + +void +test_sub (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 vsubuwm, 1 stxvp. */ + *dest = *a - *b; +} + +void +test_negate (vectype_t *dest, + vectype_t *a) +{ + /* 2 lxvp, 2 vnegw, 1 stxvp. */ + *dest = - *a; +} + +void +test_not (vectype_t *dest, + vectype_t *a) +{ + /* 2 lxvp, 2 xxlnor, 1 stxvp. */ + *dest = ~ *a; +} + +void +test_and (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxland, 1 stxvp. */ + *dest = *a & *b; +} + +void +test_or (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlor, 1 stxvp. */ + *dest = *a | *b; +} + +void +test_xor (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlxor, 1 stxvp. */ + *dest = *a ^ *b; +} + +void +test_andc_1 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlandc, 1 stxvp. */ + *dest = (~ *a) & *b; +} + +void +test_andc_2 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlandc, 1 stxvp. */ + *dest = *a & (~ *b); +} + +void +test_orc_1 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlorc, 1 stxvp. */ + *dest = (~ *a) | *b; +} + +void +test_orc_2 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlorc, 1 stxvp. */ + *dest = *a | (~ *b); +} + +void +test_nand (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlnand, 1 stxvp. */ + *dest = ~(*a & *b); +} + +void +test_nor (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlnor, 1 stxvp. */ + *dest = ~(*a | *b); +} + +/* { dg-final { scan-assembler-times {\mlxvp\M} 24 } } */ +/* { dg-final { scan-assembler-times {\mstxvp\M} 13 } } */ +/* { dg-final { scan-assembler-times {\mvadduwm\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mvnegw\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mvsubuwm\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxland\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlandc\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlnand\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlnor\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlor\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlorc\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlxor\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vector-size-32-5.c b/gcc/testsuite/gcc.target/powerpc/vector-size-32-5.c new file mode 100644 index 00000000000..8921b04c468 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vector-size-32-5.c @@ -0,0 +1,137 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-mdejagnu-cpu=power10 -O2 -mvector-size-32" } */ + +/* Test whether the __attrbiute__((__vector_size(32))) generates paired vector + loads and stores with the -mvector-size-32 option. This file tests 32-byte + vectors with 4 64-bit integer elements. */ + +typedef short vectype_t __attribute__((__vector_size__(32))); + +void +test_add (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 vadduhm, 1 stxvp. */ + *dest = *a + *b; +} + +void +test_sub (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 vsubuhm, 1 stxvp. */ + *dest = *a - *b; +} + +void +test_negate (vectype_t *dest, + vectype_t *a) +{ + /* 2 lxvp, 1 xxspltib, 2 vsubuhm, 1 stxvp. */ + *dest = - *a; +} + +void +test_not (vectype_t *dest, + vectype_t *a) +{ + /* 2 lxvp, 2 xxlnor, 1 stxvp. */ + *dest = ~ *a; +} + +void +test_and (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxland, 1 stxvp. */ + *dest = *a & *b; +} + +void +test_or (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlor, 1 stxvp. */ + *dest = *a | *b; +} + +void +test_xor (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlxor, 1 stxvp. */ + *dest = *a ^ *b; +} + +void +test_andc_1 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlandc, 1 stxvp. */ + *dest = (~ *a) & *b; +} + +void +test_andc_2 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlandc, 1 stxvp. */ + *dest = *a & (~ *b); +} + +void +test_orc_1 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlorc, 1 stxvp. */ + *dest = (~ *a) | *b; +} + +void +test_orc_2 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlorc, 1 stxvp. */ + *dest = *a | (~ *b); +} + +void +test_nand (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlnand, 1 stxvp. */ + *dest = ~(*a & *b); +} + +void +test_nor (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlnor, 1 stxvp. */ + *dest = ~(*a | *b); +} + +/* { dg-final { scan-assembler-times {\mlxvp\M} 24 } } */ +/* { dg-final { scan-assembler-times {\mstxvp\M} 13 } } */ +/* { dg-final { scan-assembler-times {\mvadduhm\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mvsubuhm\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxland\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlandc\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlnand\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlnor\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlor\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlorc\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlxor\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxspltib\M} 1 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vector-size-32-6.c b/gcc/testsuite/gcc.target/powerpc/vector-size-32-6.c new file mode 100644 index 00000000000..a905e6b0a31 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vector-size-32-6.c @@ -0,0 +1,137 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-mdejagnu-cpu=power10 -O2 -mvector-size-32" } */ + +/* Test whether the __attrbiute__((__vector_size(32))) generates paired vector + loads and stores with the -mvector-size-32 option. This file tests 32-byte + vectors with 4 64-bit integer elements. */ + +typedef unsigned char vectype_t __attribute__((__vector_size__(32))); + +void +test_add (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 vaddubm, 1 stxvp. */ + *dest = *a + *b; +} + +void +test_sub (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 vsububm, 1 stxvp. */ + *dest = *a - *b; +} + +void +test_negate (vectype_t *dest, + vectype_t *a) +{ + /* 2 lxvp, 1 xxspltib, 2 vsububm, 1 stxvp. */ + *dest = - *a; +} + +void +test_not (vectype_t *dest, + vectype_t *a) +{ + /* 2 lxvp, 2 xxlnor, 1 stxvp. */ + *dest = ~ *a; +} + +void +test_and (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxland, 1 stxvp. */ + *dest = *a & *b; +} + +void +test_or (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlor, 1 stxvp. */ + *dest = *a | *b; +} + +void +test_xor (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlxor, 1 stxvp. */ + *dest = *a ^ *b; +} + +void +test_andc_1 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlandc, 1 stxvp. */ + *dest = (~ *a) & *b; +} + +void +test_andc_2 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlandc, 1 stxvp. */ + *dest = *a & (~ *b); +} + +void +test_orc_1 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlorc, 1 stxvp. */ + *dest = (~ *a) | *b; +} + +void +test_orc_2 (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlorc, 1 stxvp. */ + *dest = *a | (~ *b); +} + +void +test_nand (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlnand, 1 stxvp. */ + *dest = ~(*a & *b); +} + +void +test_nor (vectype_t *dest, + vectype_t *a, + vectype_t *b) +{ + /* 2 lxvp, 2 xxlnor, 1 stxvp. */ + *dest = ~(*a | *b); +} + +/* { dg-final { scan-assembler-times {\mlxvp\M} 24 } } */ +/* { dg-final { scan-assembler-times {\mstxvp\M} 13 } } */ +/* { dg-final { scan-assembler-times {\mvaddubm\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mvsububm\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxland\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlandc\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlnand\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlnor\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlor\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxlorc\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxlxor\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mxxspltib\M} 1 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vector-size-32-7.c b/gcc/testsuite/gcc.target/powerpc/vector-size-32-7.c new file mode 100644 index 00000000000..a6e8582ba4f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vector-size-32-7.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-mdejagnu-cpu=power10 -O2 -mvector-size-32" } */ + +/* Test whether we can load vector pair constants into registers without using + a load instruction. */ + +typedef double vectype_t __attribute__((__vector_size__(32))); + +void +zero (vectype_t *p) +{ + *p = (vectype_t) { 0.0, 0.0, 0.0, 0.0 }; +} + +void +one (vectype_t *p) +{ + *p = (vectype_t) { 1.0, 1.0, 1.0, 1.0 }; +} + +void +mixed (vectype_t *p) +{ + *p = (vectype_t) { 0.0, 0.0, 1.0, 1.0 }; +} + +/* { dg-final { scan-assembler-not {\mp?lxvpx?\M} } } */ +/* { dg-final { scan-assembler-times {\mp?stxvpx?\M} 3 } } */ +/* { dg-final { scan-assembler-times {\mxxspltib\M} 3 } } */ +/* { dg-final { scan-assembler-times {\mxxspltidp\M} 2 } } */