From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 2BF5B3858403 for ; Thu, 25 Nov 2021 05:31:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2BF5B3858403 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1AP4s9mW002789; Thu, 25 Nov 2021 05:31:47 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3chyvxm8jg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Nov 2021 05:31:47 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1AP5UuDA014144; Thu, 25 Nov 2021 05:31:47 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 3chyvxm8j2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Nov 2021 05:31:46 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1AP5RAgU009297; Thu, 25 Nov 2021 05:31:44 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma06fra.de.ibm.com with ESMTP id 3cer9k5p7j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Nov 2021 05:31:44 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1AP5OTQa12452252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Nov 2021 05:24:29 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 10216A405C; Thu, 25 Nov 2021 05:31:42 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 277DEA405F; Thu, 25 Nov 2021 05:31:40 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.200.58.140]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Nov 2021 05:31:39 +0000 (GMT) Subject: Re: [PATCH] rs6000/test: Add emulated gather test case To: Hongtao Liu Cc: GCC Patches , Bill Schmidt , David Edelsohn , Segher Boessenkool References: From: "Kewen.Lin" Message-ID: <69c61c69-91ca-9be6-4060-01bc9ce7f94b@linux.ibm.com> Date: Thu, 25 Nov 2021 13:31:38 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: B4y0quYrE9c2Pr4umUF0hwJk0jH1o3RU X-Proofpoint-GUID: ZlqBDMdw0N2asJ6M44gcZEj605kMMbhB Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-25_03,2021-11-24_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 clxscore=1015 mlxscore=0 spamscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111250031 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2021 05:31:51 -0000 on 2021/11/25 下午1:17, Hongtao Liu wrote: > On Thu, Nov 25, 2021 at 11:21 AM Kewen.Lin via Gcc-patches > wrote: >> >> Hi, >> >> This patch is to add a test case similar to the one in i386 >> to add testing coverage for 510.parest_r hotspots. >> >> As evaluated, the emulated gather capability of vectorizer >> (r12-2733) can help to speed up SPEC2017 510.parest_r on >> Power8/9/10 by 5% to 9% with option sets Ofast unroll and >> Ofast lto. But since rs6000 missed unpacking support for >> unsigned int before, it can only vectorize the hotspots >> until r12-3134. >> >> By checking why r12-2733 doesn't immediately show its impact >> for SPEC2017 510.parest_r while the associated test case >> already can get vectorized on rs6000 at that time, I realized >> the associated test case use int as INDEXTYPE while the >> hotspots actually use unsigned int. So different from the one >> in i386, this patch uses unsigned int as INDEXTYPE since the >> unpack support for unsigned int (r12-3134) also matters for >> the hotspots vectorization. Not sure if it's worth to updating >> the one in i386 as well? > It looks like the same testcase added in > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88531 Thanks for the information! Good to know that there are already some cases to cover. :) BR, Kewen >> >> Tested on powerpc64le-linux-gnu P9 and powerpc64-linux-gnu P8. >> >> Is it ok for trunk? >> >> BR, >> Kewen >> ----- >> gcc/testsuite/ChangeLog: >> >> * gcc.target/powerpc/vect-gather-1.c: New test. >> >> diff --git a/gcc/testsuite/gcc.target/powerpc/vect-gather-1.c b/gcc/testsuite/gcc.target/powerpc/vect-gather-1.c >> new file mode 100644 >> index 00000000000..bf98045ab03 >> --- /dev/null >> +++ b/gcc/testsuite/gcc.target/powerpc/vect-gather-1.c >> @@ -0,0 +1,20 @@ >> +/* { dg-do compile } */ >> +/* Profitable from Power8 since it supports efficient unaligned load. */ >> +/* { dg-options "-Ofast -mdejagnu-cpu=power8 -fdump-tree-vect-details -fdump-tree-forwprop4" } */ >> + >> +#ifndef INDEXTYPE >> +#define INDEXTYPE unsigned int >> +#endif >> +double vmul(INDEXTYPE *rowstart, INDEXTYPE *rowend, >> + double *luval, double *dst) >> +{ >> + double res = 0; >> + for (const INDEXTYPE * col = rowstart; col != rowend; ++col, ++luval) >> + res += *luval * dst[*col]; >> + return res; >> +} >> + >> +/* With gather emulation this should be profitable to vectorize from Power8. */ >> +/* { dg-final { scan-tree-dump "loop vectorized" "vect" } } */ >> +/* The index vector loads and promotions should be scalar after forwprop. */ >> +/* { dg-final { scan-tree-dump-not "vec_unpack" "forwprop4" } } */ >> -- >> 2.25.1 >> > >