From patchwork Tue Jan 18 03:06:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 50130 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 731FE385801A for ; Tue, 18 Jan 2022 03:07:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 731FE385801A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1642475225; bh=3D8cLtMD56ByV3pKmigLfNf/DVYqWu4W0x86C/Fct0k=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Ii9u/C1fUeQCnKiP8m5RfxEz1J0AptMgaG8dpyfW3R72gFrijd0POVDLEE1wc683S OD/4D4D6z6OhMIsLcLoLU8igEJI/SwjXM1Dz33U5xO0gjI/CfXRYtWTY74+9ekEJdK 9ba15BdWFsP4sKlI8AY01o4yaBEntCJO5mq1soSI= 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 B93D23858406 for ; Tue, 18 Jan 2022 03:06:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B93D23858406 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20I1Rix7010245; Tue, 18 Jan 2022 03:06:30 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dnkwh98gq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 03:06:30 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 20I2tcWd026605; Tue, 18 Jan 2022 03:06:29 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 3dnkwh98g8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 03:06:29 +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 20I2vFVj015387; Tue, 18 Jan 2022 03:06:27 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06fra.de.ibm.com with ESMTP id 3dknhhy8m7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 03:06:27 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20I36OFD35914102 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jan 2022 03:06:24 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 92F674C04E; Tue, 18 Jan 2022 03:06:24 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41F8A4C044; Tue, 18 Jan 2022 03:06:22 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.197.240.108]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 18 Jan 2022 03:06:21 +0000 (GMT) To: GCC Patches Subject: [PATCH] testsuite: Adjust possibly fragile slp-perm-9.c [PR104015] Message-ID: <508683d0-ab11-c1dd-7a27-1f734328e0c4@linux.ibm.com> Date: Tue, 18 Jan 2022 11:06:20 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ioyPjzuinM0zFi-_Bv7uJKhO9TiN45YV X-Proofpoint-GUID: RXiFpyjQZZxLjJgN9gXUpGQESZqFgRLY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 mlxscore=0 bulkscore=0 phishscore=0 impostorscore=0 spamscore=0 adultscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201180018 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 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: Segher Boessenkool , Richard Sandiford , Bill Schmidt , David Edelsohn Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, As discussed in PR104015, the test case slp-perm-9.c can be fragile when vectorizer tries to use different vectorisation strategies. As Richard suggested, this patch tries to make the check not sensitive on the re-trying times by removing the times checking. To still retain the test coverage on unnecessary re-trying, for example this exposed PR104015 on Power9, I added two test cases to powerpc test bucket. Tested on x86_64-redhat-linux, aarch64-linux-gnu and powerpc64-linux-gnu Power8 and powerpc64le-linux-gnu Power9/Power10. Is it ok for trunk? BR, Kewen ----- gcc/testsuite/ChangeLog: PR tree-optimization/104015 * gcc.dg/vect/slp-perm-9.c: Adjust. * gcc.target/powerpc/pr104015-1.c: New test. * gcc.target/powerpc/pr104015-2.c: New test. --- gcc/testsuite/gcc.dg/vect/slp-perm-9.c | 4 +-- gcc/testsuite/gcc.target/powerpc/pr104015-1.c | 28 +++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/pr104015-2.c | 28 +++++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr104015-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/pr104015-2.c diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c index 873eddf223e..154c00af598 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c @@ -61,9 +61,7 @@ int main (int argc, const char* argv[]) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { { vect_perm_short || vect32 } || vect_load_lanes } } } } */ /* We don't try permutes with a group size of 3 for variable-length vectors. */ -/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target { vect_perm_short && { { ! vect_perm3_short } && { ! vect_partial_vectors_usage_1 } } } xfail vect_variable_length } } } */ -/* Try to vectorize the epilogue using partial vectors. */ -/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 2 "vect" { target { vect_perm_short && { { ! vect_perm3_short } && vect_partial_vectors_usage_1 } } xfail vect_variable_length } } } */ +/* { dg-final { scan-tree-dump "permutation requires at least three vectors" "vect" { target { vect_perm_short && { ! vect_perm3_short } } xfail vect_variable_length } } } */ /* { dg-final { scan-tree-dump-not "permutation requires at least three vectors" "vect" { target vect_perm3_short } } } */ /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { { ! { vect_perm3_short || vect32 } } || vect_load_lanes } } } } */ /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { { vect_perm3_short || vect32 } && { ! vect_load_lanes } } } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr104015-1.c b/gcc/testsuite/gcc.target/powerpc/pr104015-1.c new file mode 100644 index 00000000000..895c243aaf8 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr104015-1.c @@ -0,0 +1,28 @@ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fdump-tree-vect-details" } */ + +/* As PR104015, we don't expect vectorizer will re-try some vector modes + for epilogues on Power9, since Power9 doesn't support partial vector + by defaut. */ + +#include +#define N 200 + +void __attribute__((noinline)) +foo (unsigned short *__restrict__ pInput, unsigned short *__restrict__ pOutput) +{ + unsigned short i, a, b, c; + + for (i = 0; i < N / 3; i++) + { + a = *pInput++; + b = *pInput++; + c = *pInput++; + + *pOutput++ = a + b + c + 3; + *pOutput++ = a + b + c + 12; + *pOutput++ = a + b + c + 1; + } +} + +/* { dg-final { scan-tree-dump-not "Re-trying epilogue analysis with vector mode" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr104015-2.c b/gcc/testsuite/gcc.target/powerpc/pr104015-2.c new file mode 100644 index 00000000000..1b66a64f47c --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr104015-2.c @@ -0,0 +1,28 @@ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-mdejagnu-cpu=power10 -O2 -ftree-vectorize -fno-vect-cost-model -fdump-tree-vect-details" } */ + +/* Power10 support partial vector for epilogue by default, it's expected + vectorizer would re-try for it once. */ + +#include +#define N 200 + +void __attribute__((noinline)) +foo (unsigned short *__restrict__ pInput, unsigned short *__restrict__ pOutput) +{ + unsigned short i, a, b, c; + + for (i = 0; i < N / 3; i++) + { + a = *pInput++; + b = *pInput++; + c = *pInput++; + + *pOutput++ = a + b + c + 3; + *pOutput++ = a + b + c + 12; + *pOutput++ = a + b + c + 1; + } +} + +/* Vector with length instructions lxvl/stxvl are only enabled for 64 bit. */ +/* { dg-final { scan-tree-dump-times "Re-trying epilogue analysis with vector mode" 1 "vect" {target { ! ilp32 } } } } */