From patchwork Fri Jun 2 02:04:26 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: 102277 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp739660vqr; Thu, 1 Jun 2023 19:05:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5hI24BPlxWOE2z48o/oLBeeatWiAO88nrRXdbBt0uDQbBFsTrarvByG791YLg5o3zC9R/o X-Received: by 2002:a17:907:8687:b0:96a:53e6:eab5 with SMTP id qa7-20020a170907868700b0096a53e6eab5mr8535513ejc.41.1685671538348; Thu, 01 Jun 2023 19:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685671538; cv=none; d=google.com; s=arc-20160816; b=rYOSpjqhxdBIhaGga4JmjacjrdKGISx0IP9j71/sptkntPgdcYeVYhZU0PnsJhuCpK uAImVljSrQch2eHLuGRc/l+ACG0HR/XPm7aFdIsuVCydaqXh728yfN6BzK6NbAKdX8So 1kVGqXw7UmeSHYR3LJc1vtVPpouWLPzEYJ+nUG5+UrLj6Zj5Kcn+Bz13FSU9F4Ycqjxq NaW7SBuWyj+L6Z4S5PkqqTVPfsMv5HvZ7n75EgttAhgE1b0QVDDsJ3PPEh4FA1Z6yCkV oop/NpwTLxRV1Jj69umRpd18VEufAiNYi8HXQdzLPuaXFNsmv6JgL8O+SKMcAFmEbGw0 zw8w== 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=eLu3ZnnBk6Bx+UeO0aWUid80tBfSAl+8qn6gz3UtrGg=; b=HCzDG3libyPWg6JTdkkt5Kozd+zGT9wAWW7Nqi8sy0quz0IRSCCIquYJLxbXG9/lby 3OljCTYzpE3kYLrpbvz6vxuL29qWa/esdOoxJm1JeIzJM/quj52tXhn5I/CZtqL9McC9 pVchxT+ZLg0YhkM867LSuC1f9zezkfZZVw9YTFNFWNOxghYtZ1HEE6PLowcEEeR7cAaA 8rtef3glg5OsPxEVdKTOmZOOIBGRZtq2pPouIuesl9AiNQuClydG/BBImgZ4mvPs7sAX a4mLjDIsDHGc0zDyzPAX/IrnIwvt4oJZ2dMkUNHv8OadfcPYrpoRCro54lFvj8Ng9Eoh c47w== 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 sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id k11-20020a1709065fcb00b0096f4deef5basi119782ejv.649.2023.06.01.19.05.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 19:05:38 -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 1BEC13855593 for ; Fri, 2 Jun 2023 02:05:20 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbgeu2.qq.com (smtpbgeu2.qq.com [18.194.254.142]) by sourceware.org (Postfix) with ESMTPS id C004C3858C2C for ; Fri, 2 Jun 2023 02:04:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C004C3858C2C 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: bizesmtp66t1685671469tnf1p1m3 Received: from server1.localdomain ( [58.60.1.22]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 02 Jun 2023 10:04:27 +0800 (CST) X-QQ-SSF: 01400000000000F0R000000A0000000 X-QQ-FEAT: QityeSR92A0ZWW2EKTri1zaSlQQwqOww6o/Jzah8UB5N5zhh1XMrE3ngMZHOB GlQMODITw+Gi191OT+/QfTQJfipEq4aLP2xHIzr4PbOHLSJF/A29uaALosFbkeIvufrwlPU CFsZEM8RiTA4sHQZ+X7nxxn9PsLZWQkLXJDeGWt7nmc6QAEtdmhdEUuj2e1v5smc3Ry/O1T geelukiczoH8wBheq69Fycs8XVWRqXdAtDo1/W0030gApl1J1romRC0rbe11WUydlLQhwY8 KWJmsHbPReM5LysZJUAlHST5zUWbfts1qVgloxbAm4dCzxWVgFdjxxf1oT9ni4aOntEN+Cu NmAiPMxRe+4Z57OI6sap+voPktRRSNZPehXOoEftBV93TlF9pdLlRf8wOIZJ1YdxzisYAv/ X-QQ-GoodBg: 2 X-BIZMAIL-ID: 13763677039875333546 From: juzhe.zhong@rivai.ai To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, kito.cheng@sifive.com, palmer@dabbelt.com, palmer@rivosinc.com, jeffreyalaw@gmail.com, rdapp.gcc@gmail.com, best124612@gmail.com, Juzhe-Zhong Subject: [PATCH] RISC-V: Add _mu C++ overloaded intrinsics for load && viota && vid Date: Fri, 2 Jun 2023 10:04:26 +0800 Message-Id: <20230602020426.63191-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.1 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_H5, RCVD_IN_MSPIKE_WL, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, T_SPF_HELO_TEMPERROR 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767543383473792404?= X-GMAIL-MSGID: =?utf-8?q?1767554718915971649?= From: Juzhe-Zhong Base on these: https://github.com/riscv-non-isa/rvv-intrinsic-doc/issues/232 https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/233 Add _mu C++ overloaded intrinsics for load && viota && vid. Co-authored-by: KuanLin Chen gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc: Add _mu overloaded intrinsics. * config/riscv/riscv-vector-builtins-shapes.cc (struct fault_load_def): Ditto. --- gcc/config/riscv/riscv-vector-builtins-bases.cc | 17 +++++++++++------ .../riscv/riscv-vector-builtins-shapes.cc | 5 ++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc b/gcc/config/riscv/riscv-vector-builtins-bases.cc index 3f92084929d..09870c327fa 100644 --- a/gcc/config/riscv/riscv-vector-builtins-bases.cc +++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc @@ -164,7 +164,7 @@ public: { if (STORE_P || LST_TYPE == LST_INDEXED) return true; - return pred != PRED_TYPE_none && pred != PRED_TYPE_mu; + return pred != PRED_TYPE_none; } rtx expand (function_expander &e) const override @@ -967,7 +967,7 @@ public: bool can_be_overloaded_p (enum predication_type_index pred) const override { return pred == PRED_TYPE_tu || pred == PRED_TYPE_tum - || pred == PRED_TYPE_tumu; + || pred == PRED_TYPE_tumu || pred == PRED_TYPE_mu; } rtx expand (function_expander &e) const override @@ -983,7 +983,7 @@ public: bool can_be_overloaded_p (enum predication_type_index pred) const override { return pred == PRED_TYPE_tu || pred == PRED_TYPE_tum - || pred == PRED_TYPE_tumu; + || pred == PRED_TYPE_tumu || pred == PRED_TYPE_mu; } rtx expand (function_expander &e) const override @@ -1715,6 +1715,11 @@ public: return CP_READ_MEMORY | CP_WRITE_CSR; } + bool can_be_overloaded_p (enum predication_type_index pred) const override + { + return pred != PRED_TYPE_none; + } + gimple *fold (gimple_folder &f) const override { return fold_fault_load (f); @@ -1753,7 +1758,7 @@ public: bool can_be_overloaded_p (enum predication_type_index pred) const override { - return pred != PRED_TYPE_none && pred != PRED_TYPE_mu; + return pred != PRED_TYPE_none; } rtx expand (function_expander &e) const override @@ -1798,7 +1803,7 @@ public: bool can_be_overloaded_p (enum predication_type_index pred) const override { - return pred != PRED_TYPE_none && pred != PRED_TYPE_mu; + return pred != PRED_TYPE_none; } rtx expand (function_expander &e) const override @@ -1888,7 +1893,7 @@ public: bool can_be_overloaded_p (enum predication_type_index pred) const override { - return pred != PRED_TYPE_none && pred != PRED_TYPE_mu; + return pred != PRED_TYPE_none; } gimple *fold (gimple_folder &f) const override diff --git a/gcc/config/riscv/riscv-vector-builtins-shapes.cc b/gcc/config/riscv/riscv-vector-builtins-shapes.cc index 76262f07ce4..c8daae01f91 100644 --- a/gcc/config/riscv/riscv-vector-builtins-shapes.cc +++ b/gcc/config/riscv/riscv-vector-builtins-shapes.cc @@ -550,9 +550,8 @@ struct fault_load_def : public build_base char *get_name (function_builder &b, const function_instance &instance, bool overloaded_p) const override { - if (overloaded_p) - if (instance.pred == PRED_TYPE_none || instance.pred == PRED_TYPE_mu) - return nullptr; + if (overloaded_p && !instance.base->can_be_overloaded_p (instance.pred)) + return nullptr; tree type = builtin_types[instance.type.index].vector; machine_mode mode = TYPE_MODE (type); int sew = GET_MODE_BITSIZE (GET_MODE_INNER (mode));