Message ID | 20231107084725.178816-1-juzhe.zhong@rivai.ai |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp98029vqo; Tue, 7 Nov 2023 00:48:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFb1YnTPTeIhlNgAWfpYiEmpdTmnje2vNHOeEDOIbQChmSBvy40+h1fKi5bLSDd7CC+0rYv X-Received: by 2002:a05:620a:27d5:b0:773:bf62:b274 with SMTP id i21-20020a05620a27d500b00773bf62b274mr35451200qkp.61.1699346880689; Tue, 07 Nov 2023 00:48:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699346880; cv=pass; d=google.com; s=arc-20160816; b=jXxMzJ3VJxaXO/eBcYGk7bZcbwEEjoq/JFdn7tFOATA4fluU+8F2lOq9vcHZY349Vy 86f6oPzkEXYLnri/78CC6X0qlRzKVW5HOJmd1fib/LtafeP1s5ajufTPyMLUKM7bJpck MedkoOvXkyGghtWwqogg69fINydbQ7Vt7aLb/HRLdleI0xiWbS2gYgkwSAvPPJbL9GsW Y0HJ8lw+88CmoGzo8bAm3FLueK4B32EltlzFVpclWKOv8uW+DYrqx1Ti1aoLyFU/8JsT 19DIwt+Tn1c+RGO4tSIlg6k7sAZGHQ29AM5skMgAjDa4nliWop/0pLM3RiP5ymVjLuzD 9kgg== 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:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:arc-filter:dmarc-filter:delivered-to; bh=ia9teKcVNuqsOYtQbRb7Kt2mzzb11cIGXts9jHvpy9Y=; fh=Ytz0BgUryGxSKnlvo5iIYZYov/AuWMbdn9WUJJDE2rE=; b=gf1O7p8/P2W5rChlBeR4GNfc6a3lYvVH+LgG+rgXAYb+3ncWXkoXKqIwZ6kXRerLse YChvi1UjVCpHCkCHzNn5rsyUDC75Gl3vhxduN640pf0FhKULtHz54KC+RjwZZtK5eKG7 T20BFm/kU1hL4KeD9e+8YQY7ip6sswkLgr5lXPUEHZC9zUQWxjmFX6/uajYlTwXoWZTJ xJnrgeguhFTG5fFTqgosDuhPNFNgCefjbd4YwqfVQjLQ8jVKoZVfaZSJeu6zPcUoNcy+ /mP8rCKvss81yK0vS8ju8gKFVREtNgqII1djs6UBNylqf2YbMZ34rBiD/029MLD4TaSr iqvw== ARC-Authentication-Results: i=2; mx.google.com; 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" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e15-20020a05620a014f00b007757861298asi6421779qkn.114.2023.11.07.00.48.00 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 00:48:00 -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; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 752EB3858428 for <ouuuleilei@gmail.com>; Tue, 7 Nov 2023 08:48:00 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgau2.qq.com (smtpbgau2.qq.com [54.206.34.216]) by sourceware.org (Postfix) with ESMTPS id 8759B3858D3C for <gcc-patches@gcc.gnu.org>; Tue, 7 Nov 2023 08:47:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8759B3858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8759B3858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=54.206.34.216 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699346856; cv=none; b=ZIK4M1xiJzVBBGqVX6SeGVNVHqMcJQ0TY7XdpuwhmAzsyWY/7cqo7MEM+Rsdu/alz63RquwXBI0/N1oZdTheLJ6+D85tnakdWY7KmcakDhbj33PlcZpIGPgon6KySZ+R2ryRXxqIIDtSMp9vr9ooRcCkosoeF+bxScOKHwwcEIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699346856; c=relaxed/simple; bh=2jU/kD6/i30He77SzxcdueO3NxovtR263f97aAoD6cI=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=CYeL5LV/QuLs+KmCYfgC9CA2QSZylr+px/JU7sAFUGf9HVRDtrIiOJrJICmM/NQKFFDvUbUhVwVcuYJsDHJRnb2hVbZ26JmhLifpMcsrsSQfivY7tSfTffVo7hSTOFyyPQtBsfs9jvJ+cKw/sSq5S0sxxh/JKXAFssd6FIpIco0= ARC-Authentication-Results: i=1; server2.sourceware.org X-QQ-mid: bizesmtp87t1699346847t37dofqi Received: from rios-cad121.hadoop.rioslab.org ( [58.60.1.9]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 07 Nov 2023 16:47:26 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: +ynUkgUhZJkNmoe5Ng/uu3e0Dvsk7kmP3/mUoW88jpLtotNHRkqr83XgQr7/B 7MMWFklTt6bYhSOuWt/H1wDamdLTlqSvcDUosOHIDPPapnUK5A23qDcBnxaRnymEBUC34VM NXo0r6qkrksgLi+/DM3aeoLWgeZtGyAPuI4E8tFoHXzcnKMkeTuHS9iQcNca2GzHmjvERBK NdaB4ml//Nbk1C+j24L5q3SmZJTdl7AwiRLwSd4s7I2smH3YU/mw89CODcbqdJ8aNb1LYRI n5EQCsWS84hegLYAoOOWaZKLqZH573OsrgEexvPHv/YPAjYVsPhHhTXSctJfrYrHz1EYfTm yP0p5c7/a+Wyx3TXzu0lTqzo3HyvKoFuCsQAQ+q+xRFu085/DWu9b/qOryh+AihTMow32hH El7j4s4l61cYg+833EHzAw== X-QQ-GoodBg: 2 X-BIZMAIL-ID: 6111232937757237321 From: Juzhe-Zhong <juzhe.zhong@rivai.ai> To: gcc-patches@gcc.gnu.org Cc: rguenther@suse.de, jeffreyalaw@gmail.com, Juzhe-Zhong <juzhe.zhong@rivai.ai> Subject: [PATCH] test: Fix bb-slp-33.c for RVV Date: Tue, 7 Nov 2023 16:47:25 +0800 Message-Id: <20231107084725.178816-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz7a-one-0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781894354730741513 X-GMAIL-MSGID: 1781894354730741513 |
Series |
test: Fix bb-slp-33.c for RVV
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
juzhe.zhong@rivai.ai
Nov. 7, 2023, 8:47 a.m. UTC
As https://godbolt.org/z/hPsqahEa5 shows. RVV failed dump check since "vectorizing stmts using SLP" shows 3 times instead of 2. The root cause is this code in main: if (a[0] != 1 || a[1] != 2 || a[2] != 3 || a[3] != 4 || a[4] != 7 || a[5] != 0 || a[6] != 0 || a[7] != 0 || a[8] != 0) abort (); is vectorized. So add -fno-tree-vectorize avoid the confusing check. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-33.c: Add -fno-tree-vectorize to main. --- gcc/testsuite/gcc.dg/vect/bb-slp-33.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Tue, 7 Nov 2023, Juzhe-Zhong wrote: > As https://godbolt.org/z/hPsqahEa5 shows. > RVV failed dump check since "vectorizing stmts using SLP" shows 3 times instead of 2. > > The root cause is this code in main: > > if (a[0] != 1 > || a[1] != 2 > || a[2] != 3 > || a[3] != 4 > || a[4] != 7 > || a[5] != 0 > || a[6] != 0 > || a[7] != 0 > || a[8] != 0) > abort (); > > is vectorized. So add -fno-tree-vectorize avoid the confusing check. Uh, please don't add optimize attributes. If you see this vectorized (as reduction?) then please instead rewrite the condition as if (a[0] != 1) abort (); __asm__ volatile (""); if (a[1] != 2) abort (); ... > gcc/testsuite/ChangeLog: > > * gcc.dg/vect/bb-slp-33.c: Add -fno-tree-vectorize to main. > > --- > gcc/testsuite/gcc.dg/vect/bb-slp-33.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-33.c b/gcc/testsuite/gcc.dg/vect/bb-slp-33.c > index bbb13ef798e..f44cbdcfbcf 100644 > --- a/gcc/testsuite/gcc.dg/vect/bb-slp-33.c > +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-33.c > @@ -17,7 +17,8 @@ test(int *__restrict__ a, int *__restrict__ b) > a[8] = 0; > } > > -int main() > +int __attribute__((optimize(("-fno-tree-vectorize")))) > +main() > { > int a[9]; > int b[4]; >
Thanks Richi. Adapt condtion in V2: https://gcc.gnu.org/pipermail/gcc-patches/2023-November/635589.html juzhe.zhong@rivai.ai From: Richard Biener Date: 2023-11-07 21:48 To: Juzhe-Zhong CC: gcc-patches; jeffreyalaw Subject: Re: [PATCH] test: Fix bb-slp-33.c for RVV On Tue, 7 Nov 2023, Juzhe-Zhong wrote: > As https://godbolt.org/z/hPsqahEa5 shows. > RVV failed dump check since "vectorizing stmts using SLP" shows 3 times instead of 2. > > The root cause is this code in main: > > if (a[0] != 1 > || a[1] != 2 > || a[2] != 3 > || a[3] != 4 > || a[4] != 7 > || a[5] != 0 > || a[6] != 0 > || a[7] != 0 > || a[8] != 0) > abort (); > > is vectorized. So add -fno-tree-vectorize avoid the confusing check. Uh, please don't add optimize attributes. If you see this vectorized (as reduction?) then please instead rewrite the condition as if (a[0] != 1) abort (); __asm__ volatile (""); if (a[1] != 2) abort (); ... > gcc/testsuite/ChangeLog: > > * gcc.dg/vect/bb-slp-33.c: Add -fno-tree-vectorize to main. > > --- > gcc/testsuite/gcc.dg/vect/bb-slp-33.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-33.c b/gcc/testsuite/gcc.dg/vect/bb-slp-33.c > index bbb13ef798e..f44cbdcfbcf 100644 > --- a/gcc/testsuite/gcc.dg/vect/bb-slp-33.c > +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-33.c > @@ -17,7 +17,8 @@ test(int *__restrict__ a, int *__restrict__ b) > a[8] = 0; > } > > -int main() > +int __attribute__((optimize(("-fno-tree-vectorize")))) > +main() > { > int a[9]; > int b[4]; > -- Richard Biener <rguenther@suse.de> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-33.c b/gcc/testsuite/gcc.dg/vect/bb-slp-33.c index bbb13ef798e..f44cbdcfbcf 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-33.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-33.c @@ -17,7 +17,8 @@ test(int *__restrict__ a, int *__restrict__ b) a[8] = 0; } -int main() +int __attribute__((optimize(("-fno-tree-vectorize")))) +main() { int a[9]; int b[4];