From patchwork Mon Feb 28 05:37:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 51416 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4F389385841F for ; Mon, 28 Feb 2022 05:38:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F389385841F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1646026709; bh=2Q1w0UoEfQNgBv9L94yqa7JaR+4etnQ9YqsTqa58w/Y=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=na3UQvNMJXdY1Eankcv9ZyzB+hTgHVFoHEytf+HepsOStjzIEaSeL4pqrS7nUlXSP 716phFRi+5uUnktPeeC6D6R61fGHImCO76CbXhHZICYZ7F6Hi5M0c+sfN4RsWGqDPB XMTT11svwIKisEKLnqyJPhQNbib//xzbWTnsCIO4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 50A6B3858C83 for ; Mon, 28 Feb 2022 05:37:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 50A6B3858C83 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21S4fWnU001527; Mon, 28 Feb 2022 05:37:57 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3egqkagxx0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Feb 2022 05:37:57 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21S5W8Rq017304; Mon, 28 Feb 2022 05:37:57 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3egqkagxwb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Feb 2022 05:37:56 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 21S5XLJU029940; Mon, 28 Feb 2022 05:37:54 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 3efbu969bp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Feb 2022 05:37:54 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21S5bpQj47841550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Feb 2022 05:37:51 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 61D794C040; Mon, 28 Feb 2022 05:37:51 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9F3364C044; Mon, 28 Feb 2022 05:37:49 +0000 (GMT) Received: from [9.200.153.15] (unknown [9.200.153.15]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 28 Feb 2022 05:37:49 +0000 (GMT) Message-ID: <1cc2e963-b189-4dde-e7cd-b6a97162afe2@linux.ibm.com> Date: Mon, 28 Feb 2022 13:37:48 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: GCC Patches Subject: [PATCH] rs6000/test: Adjust p9-vec-length-7 sensitive to unroll [PR103196] X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 4FdayNemsAZ7zN71VmzqzygRzLTJH3HC X-Proofpoint-GUID: fQtwVloRQUeHmaE_1p-6gV4WW04Y1H0V X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-02-28_01,2022-02-26_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 phishscore=0 clxscore=1015 spamscore=0 bulkscore=0 adultscore=0 suspectscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202280032 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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-Patchwork-Original-From: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: Peter Bergner , Bill Schmidt , David Edelsohn , Segher Boessenkool Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, As PR103196 shows, p9-vec-length-full-7.c needs to be adjusted as the complete unrolling can happen on some of its loops. This patch is to use pragma "GCC unroll 0" to disable all possible loop unrollings. Hope it can help the case not that fragile. There are some other p9-vec-length* cases, I noticed that some of them use either bigger or unknown loop iteration counts, and "p9-vec-length-3*" have considered the effects of complete unrolling. So I just leave them alone for now. Tested on powerpc64-linux-gnu P8 and powerpc64le-linux-gnu P9 and P10. Is it ok for trunk? BR, Kewen ----- PR testsuite/103196 gcc/testsuite/ChangeLog: * gcc.target/powerpc/p9-vec-length-7.h: Add DO_PRAGMA macro. * gcc.target/powerpc/p9-vec-length-epil-7.c: Use unroll pragma to disable any unrollings. * gcc.target/powerpc/p9-vec-length-full-7.c: Remove useless option. * gcc.target/powerpc/p9-vec-length.h: Likewise. --- .../gcc.target/powerpc/p9-vec-length-7.h | 17 +++++++++++------ .../gcc.target/powerpc/p9-vec-length-epil-7.c | 2 +- .../gcc.target/powerpc/p9-vec-length-full-7.c | 2 +- .../gcc.target/powerpc/p9-vec-length.h | 2 ++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-7.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-7.h index 4ef8f974a04..4f338565619 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-7.h +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-7.h @@ -7,14 +7,19 @@ #define START 1 #define END 59 +/* Note that we use pragma unroll to disable any loop unrollings. */ + #define test(TYPE) \ - TYPE x_##TYPE[N] __attribute__((aligned(16))); \ - void __attribute__((noinline, noclone)) test_npeel_##TYPE() { \ + TYPE x_##TYPE[N] __attribute__ ((aligned (16))); \ + void __attribute__ ((noinline, noclone)) test_npeel_##TYPE () \ + { \ TYPE v = 0; \ - for (unsigned int i = START; i < END; i++) { \ - x_##TYPE[i] = v; \ - v += 1; \ - } \ + DO_PRAGMA (GCC unroll 0) \ + for (unsigned int i = START; i < END; i++) \ + { \ + x_##TYPE[i] = v; \ + v += 1; \ + } \ } TEST_ALL (test) diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c index a27ee347ca1..859fedd5679 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c @@ -1,5 +1,5 @@ /* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ -/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -ffast-math" } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c index 89ff38443e7..5fe542bba20 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c @@ -1,5 +1,5 @@ /* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ -/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -ffast-math" } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -ffast-math" } */ /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length.h b/gcc/testsuite/gcc.target/powerpc/p9-vec-length.h index 83418b0b641..7aefc9b308d 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length.h +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length.h @@ -1,5 +1,7 @@ #include +#define DO_PRAGMA(x) _Pragma (#x) + #define TEST_ALL(T) \ T (int8_t) \ T (uint8_t) \