From patchwork Fri Jun 2 02:04:47 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: 102278 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp739791vqr; Thu, 1 Jun 2023 19:05:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6P8xhwde3afarhEs1bsKsMiKLC8oyO21I3JalCrQ2TjMuSSxmeZTNbsMzMhR3ztrh4aReD X-Received: by 2002:a17:907:1c02:b0:96f:bc31:5e0b with SMTP id nc2-20020a1709071c0200b0096fbc315e0bmr10891576ejc.64.1685671559641; Thu, 01 Jun 2023 19:05:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685671559; cv=none; d=google.com; s=arc-20160816; b=bGpogt6tVlUIfVOid7YiDCVyPguwsQPVMrhlq5t0Fxfn7yIhaWQ283WLj46wNoVTyf AirvFNaOvXWU5P2DF7J/UfauIqXV4TUd2+frCD5FEhJjfh1csW8IALUMQooRyz3XrJVx fykLfZnb1GhgeLHRS9b5D1DNfOoHqqjvtytei9I7DIhnEpDNXmjiv3wqyXVFLvFsAewR U/JgOUz7Mu3EqXrKax1XcuV6wn3AQl2PTdhgYgiSauC1SjE9ywz0mwX+i+sy2LlyPEWG 5mEHh6wFWY6nGJUZrDfZRTG2ez909zsBjHtpHASh4NZxI66bsNKoVnQXdmhExjI+Z5bV dDWA== 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=b09IItx1Hcmg/3TWVZinqU8SSOP56osrM2zCbeqTu5JXyihWx2kJWrLYcVubeBqhAs 5kyudLKijJP8FEhLgNfQ2zviVfMyiHpegokc9amwIzOzybU+o/I6IDIW7zbNgmIhVfc5 ndAYV1J0fulR/sTc9kcE3VxfaIhloGc1YrNUG/9sX9FiTkYGZxtMkTySrKDTBQ32gCAY 9g5GyVAOAtXDgYYg1TcnfHyLwi/AN7OqFl/G4NwSkAMxEKJdMYzYn22x/MZdgVojhkrZ X4vF6WMorH9UOMiYrwim8VJf2M9NcZsfnhw3Uz7KtIM9wSoL4Th79yO7ZMEW+pB2zP/v /yzA== 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 fq19-20020a1709069d9300b0096f8afcdf85si113541ejc.966.2023.06.01.19.05.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 19:05:59 -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 AEFB9385703C for ; Fri, 2 Jun 2023 02:05:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbguseast3.qq.com (smtpbguseast3.qq.com [54.243.244.52]) by sourceware.org (Postfix) with ESMTPS id EFDD43856DFB for ; Fri, 2 Jun 2023 02:05:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EFDD43856DFB 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: bizesmtp62t1685671489tvxehio3 Received: from server1.localdomain ( [58.60.1.22]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 02 Jun 2023 10:04:48 +0800 (CST) X-QQ-SSF: 01400000000000F0R000000A0000000 X-QQ-FEAT: DQ0OCu3gog2sTnwB01K8+BqiBWhnQ9Ci+mCJSpSRMQXWfFoEGuPVnaHuxPgQ0 bj1K29DyUvy5pNRkNv3yHmaNBepA9jlolgmz1Xzs2A2a+7kwh4E/iAV0moVDidnuPJt7nAp gnzC2WihjjKX74NFaZvfsvlV4jwTdE93uuEuP6D7WWo0Q4hRgl64nUzwvqVXFFgi57IzOHs N8uF6bI7ETkIsJ6e6FVxWUFoUbFsTZhahkj6Fl4/SPdLfohod6px4qEtzsosscNSS7R97Xy 2DBHMnh3nXKu5w8HdN5e//y7g6I1O2nlnhdZhK8A8chIRO/j9g2apxSjPnbjfv+jFsWEpJx SqL6bdkOwZ1uDgaeazYNIpceiYsRhk/vGie05ykoEhB1PeZcr8x+cfbxdZ2BHhEHh2Dchga RbefUMxr9I4= X-QQ-GoodBg: 2 X-BIZMAIL-ID: 10875403137186929648 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 V2] RISC-V: Add _mu C++ overloaded intrinsics for load && viota && vid Date: Fri, 2 Jun 2023 10:04:47 +0800 Message-Id: <20230602020447.63264-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_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.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?1767554740868523302?= 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));