Message ID | 20230910035538.2034153-1-juzhe.zhong@rivai.ai |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp1413386vqo; Sat, 9 Sep 2023 20:56:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeqtRizeXZ5Zg2wHzYDKKwY3v5m32GEvcuormH4cqztMkYTSTu6KyW6+5oISL1LpRsUEIQ X-Received: by 2002:ac2:4c31:0:b0:4f4:d071:be48 with SMTP id u17-20020ac24c31000000b004f4d071be48mr4316433lfq.14.1694318180001; Sat, 09 Sep 2023 20:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694318179; cv=none; d=google.com; s=arc-20160816; b=R8r9hSWxzS8FqIK1t7QZI2j5lX5m+UtO3ALflIl/q/1NL//VqvYWzGIuhJuufplG+I VkgR5mLX6NGKogDDUaV02K9naQgcsIFTItlMK3udI+7B09PrBtYx5qyiZUY4uQQfkrPP OBzHfgRbSfOnDQZcnNwawztGiFSrQ5bRo4OJQH3K5pOvfzQYKW/VVtp2+R4W6AGiGzUW VDRcdSho2SjKMOlTaCE8KFjvfkAneHOWqsFGR7hikX8YpPo2VpfxhQqGC+Kfj0k6Yjsa U2rx+rBNhV7K0JCHOOO4SM1hqtim3MZaRt9TWMJfW8GeJ0H5LMIX20kX8ClawlDdh+qZ xMlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:to :from:dmarc-filter:delivered-to; bh=GabpQCh8wEghNtSwiQQfS0qqfg4zzl8YNXhX41gDq9g=; fh=arl273cIQBNH1P6XLxHQvF0scgitfd773vOV+bwQx3o=; b=IrOHnYuf3LfC/IVEDrMQVQ1k712wbYGwzOmjBsusHg8PjW0G8G5DWHinEJO8HvVK5k dDePvZrsIOnQ29th/73+NCHjTWQIpCzrfAczob+dlFtQESHap2chEF15QLSslvku0PvY zPn3LuXaAKt8glqAZwi49aFeBkKIsneFs/dV4/KPDRF6AKQa6ZTkQLrbzwanzuz48Hea pnBmp1/S4nmkBT4331Q9wUs+tPN+HPGrOqHz8c4cR4AKp6/sPR09BbGWkHn85Jhht+yN GyBu9iKTpY1vTUXcICAH1+hez0mrDOqlhyJzyZWkn7vpXzDoKf4piNExhFN3KgTUUXLw h2gg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d7-20020aa7ce07000000b0052e7e8ba1desi4456617edv.488.2023.09.09.20.56.19 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Sep 2023 20:56:19 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 49DDA3857C40 for <ouuuleilei@gmail.com>; Sun, 10 Sep 2023 03:56:15 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) by sourceware.org (Postfix) with ESMTPS id 397C23858D1E for <gcc-patches@gcc.gnu.org>; Sun, 10 Sep 2023 03:55:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 397C23858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp77t1694318140t6bpuqqk Received: from rios-cad122.hadoop.rioslab.org ( [58.60.1.26]) by bizesmtp.qq.com (ESMTP) with id ; Sun, 10 Sep 2023 11:55:39 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: LE7C6P2vL8QN6uXsi6vOsUpmTwenRZ4IRcSv46kUAV8GOvvFXPcyAZ2P98P+T Fsw83HNIfaIyyqKNWGriAU1s6xR9iJnZOCjympwbX6KJ0KtR81dy06SLVuy1TOxP3woZEra /V61+p6hlsWiv6rAgD+DXBb7RYja1xhMEef8LZ4nn3khuU7TK5qSZvXS7X9tcmkK/LIfZqB icLd83i0cysmPbP/CCRreWbT8rn1Zw/4gso088oHWTeav3n/uofW7Xozqk5/qgqx33t7g7g C3jkDrr565l+cVsBTUQcwanmEunbfIspmmGBP1JzdB+N8f0FxJAQwmvsRTRRlbCMDgY4052 GmCkwdFL7Yhyt6Ws0ztE7U47IBTB+u4G/4lR0vOZWgv6o1sLdNNusgn8AK5CPaH/7WLr9YF X-QQ-GoodBg: 2 X-BIZMAIL-ID: 9717630236521583121 From: Juzhe-Zhong <juzhe.zhong@rivai.ai> To: gcc-patches@gcc.gnu.org Subject: [PATCH] RISC-V: Avoid unnecessary slideup in compress pattern of vec_perm Date: Sun, 10 Sep 2023 11:55:38 +0800 Message-Id: <20230910035538.2034153-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=-10.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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> Cc: kito.cheng@sifive.com, kito.cheng@gmail.com, Juzhe-Zhong <juzhe.zhong@rivai.ai> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776621379975172237 X-GMAIL-MSGID: 1776621379975172237 |
Series |
RISC-V: Avoid unnecessary slideup in compress pattern of vec_perm
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
juzhe.zhong@rivai.ai
Sept. 10, 2023, 3:55 a.m. UTC
If a const vector all elements are same, the slide up is unnecessary. gcc/ChangeLog: * config/riscv/riscv-v.cc (shuffle_compress_patterns): Avoid unnecessary slideup. --- gcc/config/riscv/riscv-v.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 9/9/23 21:55, Juzhe-Zhong wrote: > If a const vector all elements are same, the slide up is unnecessary. > > gcc/ChangeLog: > > * config/riscv/riscv-v.cc (shuffle_compress_patterns): Avoid unnecessary slideup. > > --- > gcc/config/riscv/riscv-v.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc > index bee60de1d26..7ef884907b8 100644 > --- a/gcc/config/riscv/riscv-v.cc > +++ b/gcc/config/riscv/riscv-v.cc > @@ -2697,7 +2697,7 @@ shuffle_compress_patterns (struct expand_vec_perm_d *d) > rtx mask = force_reg (mask_mode, builder.build ()); > > rtx merge = d->op1; > - if (need_slideup_p) > + if (need_slideup_p && !const_vec_duplicate_p (d->op1)) > { > int slideup_cnt = vlen - (d->perm[vlen - 1].to_constant () % vlen) - 1; > rtx ops[] = {d->target, d->op1, gen_int_mode (slideup_cnt, Pmode)}; Would it be better to adjust how we compute need_slidup_p to check !const_vec_duplicate_p (d->op1) instead of doing it here? That way the name "need_slideup_p" stays consistent with the intent of the code. It would also mean we wouldn't need to duplicate the additional check if we wanted to model the use of slideup in the cost calculations. Jeff
Address comment: [PATCH V2] RISC-V: Avoid unnecessary slideup in compress pattern of vec_perm (gnu.org) juzhe.zhong@rivai.ai From: Jeff Law Date: 2023-09-10 21:34 To: Juzhe-Zhong; gcc-patches CC: kito.cheng; kito.cheng; rdapp.gcc Subject: Re: [PATCH] RISC-V: Avoid unnecessary slideup in compress pattern of vec_perm On 9/9/23 21:55, Juzhe-Zhong wrote: > If a const vector all elements are same, the slide up is unnecessary. > > gcc/ChangeLog: > > * config/riscv/riscv-v.cc (shuffle_compress_patterns): Avoid unnecessary slideup. > > --- > gcc/config/riscv/riscv-v.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc > index bee60de1d26..7ef884907b8 100644 > --- a/gcc/config/riscv/riscv-v.cc > +++ b/gcc/config/riscv/riscv-v.cc > @@ -2697,7 +2697,7 @@ shuffle_compress_patterns (struct expand_vec_perm_d *d) > rtx mask = force_reg (mask_mode, builder.build ()); > > rtx merge = d->op1; > - if (need_slideup_p) > + if (need_slideup_p && !const_vec_duplicate_p (d->op1)) > { > int slideup_cnt = vlen - (d->perm[vlen - 1].to_constant () % vlen) - 1; > rtx ops[] = {d->target, d->op1, gen_int_mode (slideup_cnt, Pmode)}; Would it be better to adjust how we compute need_slidup_p to check !const_vec_duplicate_p (d->op1) instead of doing it here? That way the name "need_slideup_p" stays consistent with the intent of the code. It would also mean we wouldn't need to duplicate the additional check if we wanted to model the use of slideup in the cost calculations. Jeff
diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index bee60de1d26..7ef884907b8 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -2697,7 +2697,7 @@ shuffle_compress_patterns (struct expand_vec_perm_d *d) rtx mask = force_reg (mask_mode, builder.build ()); rtx merge = d->op1; - if (need_slideup_p) + if (need_slideup_p && !const_vec_duplicate_p (d->op1)) { int slideup_cnt = vlen - (d->perm[vlen - 1].to_constant () % vlen) - 1; rtx ops[] = {d->target, d->op1, gen_int_mode (slideup_cnt, Pmode)};