From patchwork Wed Aug 23 02:32:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 136625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp196917vqm; Tue, 22 Aug 2023 19:33:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGdtu4tqLazR58zFe9Aci75QWe2loArWxkInRyUFfPBfFHaVsKFuTc/CiAhoxjyjyviVinh X-Received: by 2002:a17:907:7788:b0:993:d617:bdc5 with SMTP id ky8-20020a170907778800b00993d617bdc5mr8954417ejc.37.1692757998756; Tue, 22 Aug 2023 19:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692757998; cv=none; d=google.com; s=arc-20160816; b=JDRbjSDii5E8RzVtEhMq1NJ1vJLhlV2lg1Q31YXtadcXZAdPYpLuRICyB2VaBejAw9 D1iXellPGmg6YQ72EsjLTjB84NPg3xjRhKq8RrDNHARws0gSwZPPjBvPs7+BSTMMKXBj Waj1w2WNP8KEkLpIHacfcvtAt7shej+DeOol2R3UMTs80RUPXnZ3AKpZEEhZLCOJ/Bkg icy3NP2kGNi3ZATklRW0gKZ6wlD60j4lF+uzTwIjpQNeVR9yt8vMHrdKPd6xscuWPM3K yy7KtyFbUf7ErsMKiuWd+w/r9mHI4kO5STZu+xv5RuQUVpgBST64MYYFWRMsXpV0V9zi LjNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender: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:dmarc-filter:delivered-to; bh=9pSGw+BXvlyvoqdYicd5no0dotORl+IM1fH1rDxTenA=; fh=NF4ZuEwBSZUzhDQca3vBRUazRF6p5arhTIdSttTSvE8=; b=OKwb6m7AShtx1p/yEYEN4+oEL1lnACOSsEzjxKYirv0mucsE/AY3oTj3nBTZHkzn0T GPViH/72wgWVzNBOrZawAqcDMLnGJr1ssW6x6tjjHIjWFsAp+J+CM+SsIG/bkAbDaTtV x6AFA3PcB0zBQ/lAE2F8T5O4HeDpRROIjvA7vu5IAeMTCm3nhjRjrHkJMTPenFUHH7yM X4G8kB4YCuwsEfrwolekChmML9J4icNzxCRDOeAcNjSCLR5xpr15BwXAT8r+PTPSMEAz JJD+dlyduLAK+SbjiDqS2fqKskKpmSszSKMW0dzjzP2I/UCdBncROP4ZmlummzSuaey0 Ls3w== ARC-Authentication-Results: i=1; mx.google.com; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id t3-20020a170906178300b0099d74066201si7511560eje.415.2023.08.22.19.33.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 19:33:18 -0700 (PDT) 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; 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 0A018385C6D4 for ; Wed, 23 Aug 2023 02:33:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgjp3.qq.com (smtpbgjp3.qq.com [54.92.39.34]) by sourceware.org (Postfix) with ESMTPS id AE0753857C5A for ; Wed, 23 Aug 2023 02:32:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE0753857C5A 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: bizesmtp89t1692757953t8578fhe Received: from rios-cad122.hadoop.rioslab.org ( [58.60.1.8]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 23 Aug 2023 10:32:32 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: cbck7jzG4waXT9o1xyNz2H2JrQ4X2N5mFOYidFGMy9aLJP8Xbtn+SL+h9FyzR BYKQ20BnPrysKVimr2RxgSgUOgi0YGwB+MgOfZg+rVsJH+jTgvmWu6CawOwiPygsCAe8EVB inF7pQ9WKVAyt+1ITEGJQvmpjA3TBOBOEI/PSbVo8U8V2LG7Rph6D7t/hrbO1x9lRhjDp/h oJUsaHXE503B5otNP2PPns+wlmK+DrESk3tRzZ2YCFuq3PvEb9Lhn3UzEUdhHb9ZCWhNLGh fa4DmlZ5Q7jN+G1drRzYJD6dIN2+cB3NbNwIE0WGr6baFiJO7Cbc5kMibTO/IWsctteCylM +lvL7LA8Duzu3tgjWq+jHTkwX6SFr85bJolmrzHhhuzhST9NCfStqFlrk0a8Uyd0G9CFc9y 3MSXw+2mNNQ= X-QQ-GoodBg: 2 X-BIZMAIL-ID: 16920191082436588362 From: Juzhe-Zhong To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, kito.cheng@sifive.com, Juzhe-Zhong Subject: [PATCH] RISC-V: Fix VTYPE fuse rule bug Date: Wed, 23 Aug 2023 10:32:30 +0800 Message-Id: <20230823023230.3501614-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 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_H3, RCVD_IN_MSPIKE_WL, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774985411276150670 X-GMAIL-MSGID: 1774985411276150670 This bug is exposed after refactor patch. Separate it and commited. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (ge_sew_ratio_unavailable_p): Fix fuse rule bug. * config/riscv/riscv-vsetvl.def (DEF_SEW_LMUL_FUSE_RULE): Ditto. --- gcc/config/riscv/riscv-vsetvl.cc | 10 ++++++++-- gcc/config/riscv/riscv-vsetvl.def | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 819a3918b3e..ec1aaa4b442 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1423,8 +1423,14 @@ static bool ge_sew_ratio_unavailable_p (const vector_insn_info &info1, const vector_insn_info &info2) { - if (!info2.demand_p (DEMAND_LMUL) && info2.demand_p (DEMAND_GE_SEW)) - return info1.get_sew () < info2.get_sew (); + if (!info2.demand_p (DEMAND_LMUL)) + { + if (info2.demand_p (DEMAND_GE_SEW)) + return info1.get_sew () < info2.get_sew (); + /* Demand GE_SEW should be available for non-demand SEW. */ + else if (!info2.demand_p (DEMAND_SEW)) + return false; + } return true; } diff --git a/gcc/config/riscv/riscv-vsetvl.def b/gcc/config/riscv/riscv-vsetvl.def index 7a73149f1da..7289c01efcf 100644 --- a/gcc/config/riscv/riscv-vsetvl.def +++ b/gcc/config/riscv/riscv-vsetvl.def @@ -319,7 +319,7 @@ DEF_SEW_LMUL_FUSE_RULE (/*SEW*/ DEMAND_TRUE, /*LMUL*/ DEMAND_FALSE, /*RATIO*/ DEMAND_TRUE, /*GE_SEW*/ DEMAND_FALSE, /*NEW_DEMAND_SEW*/ true, /*NEW_DEMAND_LMUL*/ false, - /*NEW_DEMAND_RATIO*/ false, + /*NEW_DEMAND_RATIO*/ true, /*NEW_DEMAND_GE_SEW*/ true, first_sew, vlmul_for_first_sew_second_ratio, second_ratio) DEF_SEW_LMUL_FUSE_RULE (/*SEW*/ DEMAND_TRUE, /*LMUL*/ DEMAND_FALSE,