From patchwork Wed Aug 16 08:10:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 135735 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:3f2:4152:657d with SMTP id x8csp950723vqo; Wed, 16 Aug 2023 01:11:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCKsTlnwlQnIf7bLpBzwxXHP7sCY2EfFUapa5w++4kednsFmUiJKqv1s/pO8zJNi8qaKtA X-Received: by 2002:a05:6402:26d3:b0:522:ab20:368a with SMTP id x19-20020a05640226d300b00522ab20368amr4960276edd.13.1692173465728; Wed, 16 Aug 2023 01:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692173465; cv=none; d=google.com; s=arc-20160816; b=YPGfEf3PBtbds24ntYBmMSmhHu8/jllh/y9WTcnvLbP0Tbbn/aq9JYl+jNv8oeTIFO MAGkwG+M+MyxIEfBzJt/zqNSnjFLtsBqruN7Xz4Askf4a8+9fnxV6VAvONAWUl3esPfD AwZGf1vBVSUZbyvmt+OVeiec6OYOWnUixt0w4wDyBLbeGlzL//ivmjqzK2d7HX/8wjYr D5tf8Aq0WCXrm2BABDaRAGLO2A1kzIyCxRzOQml+1UI2TQiefKqEkhntMa85X8C3em9A huAEMn3G6y4rxtG5nOAqA55AvUB2fG9g8emspnlrIntKsd94JUfXTCASGh2No3qU5F+O p6MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=ghSr75Kh21K8EgX4QgC3xR5oSvlSJY8ZtCw5dEpHhTw=; fh=/JJEj+I5j40/Spkll6HT+Gte92Mjc5mpTnWowlKfaJ8=; b=gwFAs2AOUH8LEe67mQvtWMId6+gcwpFp3+24nwmRDZ0NnOV/MGNPP1N38a8sRUtjv/ 94B4M58C4EkUFPnBQN+uIBVDL+FIv6EbRQbby+MaNykxP8bKf12QwH+0MIkDEnBh1CBq UXdfbYvJuXKX3a2W+IKy5PluLV1//EoHi7pJ+OzD1MCqzeStyRhYIN4owj3jiOBf5ml/ m4+vVmcVa0rW3p46AZMD13uriPnuA9Kb5r9jFQfWbKLI6UTMzpLZTDrJplGJC0kg3RZy CS1UBhQllz/Bo+l3m4USsS/5nxDUXs3e4iKrEe/GC8Fi2/rrl0vLJKvvixEqWealyjWo 1WGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=TmrwkkWr; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 l8-20020aa7c308000000b0051de11a08e9si11037230edq.246.2023.08.16.01.11.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Aug 2023 01:11:05 -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; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=TmrwkkWr; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 74B103857027 for ; Wed, 16 Aug 2023 08:11:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74B103857027 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692173464; bh=ghSr75Kh21K8EgX4QgC3xR5oSvlSJY8ZtCw5dEpHhTw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=TmrwkkWrqq7anLVbaucWldkCAoyfAs2Ak1iCsOvdrDPYCGm6r9TC6TqnHVRGsGWPL z2EZPvL2NY0ZQP9ix5YSmm3Z9CrsMxMnV1l2yt+W/CH/dcE35Bs33QTIxBe336jVXB AkwObGtoTrXquQGPSXeN1D6ZSnb3MLUbbsjTX2e4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by sourceware.org (Postfix) with ESMTPS id 022C63858C52 for ; Wed, 16 Aug 2023 08:10:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 022C63858C52 X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="369945112" X-IronPort-AV: E=Sophos;i="6.01,176,1684825200"; d="scan'208";a="369945112" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2023 01:10:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="857721410" X-IronPort-AV: E=Sophos;i="6.01,176,1684825200"; d="scan'208";a="857721410" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by orsmga004.jf.intel.com with ESMTP; 16 Aug 2023 01:10:09 -0700 Received: from pli-ubuntu.sh.intel.com (pli-ubuntu.sh.intel.com [10.239.159.47]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 1035F1005138; Wed, 16 Aug 2023 16:10:09 +0800 (CST) To: gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai, kito.cheng@sifive.com, pan2.li@intel.com, yanzhang.wang@intel.com Subject: [PATCH v2] RISC-V: Support RVV VFWCVT.XU.F.V rounding mode intrinsic API Date: Wed, 16 Aug 2023 16:10:07 +0800 Message-Id: <20230816081007.1211587-1-pan2.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815090730.2537591-1-pan2.li@intel.com> References: <20230815090730.2537591-1-pan2.li@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, 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: , X-Patchwork-Original-From: Pan Li via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: pan2.li@intel.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774285494151329986 X-GMAIL-MSGID: 1774372483995070112 From: Pan Li This patch would like to support the rounding mode API for the VFWCVT.X.F.V as the below samples. * __riscv_vfwcvt_xu_f_v_u64m2_rm * __riscv_vfwcvt_xu_f_v_u64m2_rm_m Signed-off-by: Pan Li gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc (BASE): New declaration. * config/riscv/riscv-vector-builtins-bases.h: Ditto. * config/riscv/riscv-vector-builtins-functions.def (vfwcvt_xu_frm): New intrinsic function def. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/float-point-wcvt-xu.c: New test. --- .../riscv/riscv-vector-builtins-bases.cc | 2 ++ .../riscv/riscv-vector-builtins-bases.h | 1 + .../riscv/riscv-vector-builtins-functions.def | 1 + .../riscv/rvv/base/float-point-wcvt-xu.c | 29 +++++++++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/float-point-wcvt-xu.c diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc b/gcc/config/riscv/riscv-vector-builtins-bases.cc index 22640745398..6621c77c3f2 100644 --- a/gcc/config/riscv/riscv-vector-builtins-bases.cc +++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc @@ -2497,6 +2497,7 @@ static CONSTEXPR const vfcvt_f vfcvt_f_frm_obj; static CONSTEXPR const vfwcvt_x vfwcvt_x_obj; static CONSTEXPR const vfwcvt_x vfwcvt_x_frm_obj; static CONSTEXPR const vfwcvt_x vfwcvt_xu_obj; +static CONSTEXPR const vfwcvt_x vfwcvt_xu_frm_obj; static CONSTEXPR const vfwcvt_rtz_x vfwcvt_rtz_x_obj; static CONSTEXPR const vfwcvt_rtz_x vfwcvt_rtz_xu_obj; static CONSTEXPR const vfwcvt_f vfwcvt_f_obj; @@ -2750,6 +2751,7 @@ BASE (vfcvt_f_frm) BASE (vfwcvt_x) BASE (vfwcvt_x_frm) BASE (vfwcvt_xu) +BASE (vfwcvt_xu_frm) BASE (vfwcvt_rtz_x) BASE (vfwcvt_rtz_xu) BASE (vfwcvt_f) diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.h b/gcc/config/riscv/riscv-vector-builtins-bases.h index dd711846cbe..6565740c597 100644 --- a/gcc/config/riscv/riscv-vector-builtins-bases.h +++ b/gcc/config/riscv/riscv-vector-builtins-bases.h @@ -215,6 +215,7 @@ extern const function_base *const vfcvt_f_frm; extern const function_base *const vfwcvt_x; extern const function_base *const vfwcvt_x_frm; extern const function_base *const vfwcvt_xu; +extern const function_base *const vfwcvt_xu_frm; extern const function_base *const vfwcvt_rtz_x; extern const function_base *const vfwcvt_rtz_xu; extern const function_base *const vfwcvt_f; diff --git a/gcc/config/riscv/riscv-vector-builtins-functions.def b/gcc/config/riscv/riscv-vector-builtins-functions.def index 4e6cc793447..22c039c8cbb 100644 --- a/gcc/config/riscv/riscv-vector-builtins-functions.def +++ b/gcc/config/riscv/riscv-vector-builtins-functions.def @@ -460,6 +460,7 @@ DEF_RVV_FUNCTION (vfwcvt_f, alu, full_preds, u_to_wf_xu_v_ops) DEF_RVV_FUNCTION (vfwcvt_f, alu, full_preds, f_to_wf_f_v_ops) DEF_RVV_FUNCTION (vfwcvt_x_frm, alu_frm, full_preds, f_to_wi_f_v_ops) +DEF_RVV_FUNCTION (vfwcvt_xu_frm, alu_frm, full_preds, f_to_wu_f_v_ops) // 13.19. Narrowing Floating-Point/Integer Type-Convert Instructions DEF_RVV_FUNCTION (vfncvt_x, narrow_alu, full_preds, f_to_ni_f_w_ops) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/float-point-wcvt-xu.c b/gcc/testsuite/gcc.target/riscv/rvv/base/float-point-wcvt-xu.c new file mode 100644 index 00000000000..29449e79b69 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/float-point-wcvt-xu.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64 -O3 -Wno-psabi" } */ + +#include "riscv_vector.h" + +vuint64m2_t +test_riscv_vfwcvt_xu_f_v_u64m2_rm (vfloat32m1_t op1, size_t vl) { + return __riscv_vfwcvt_xu_f_v_u64m2_rm (op1, 0, vl); +} + +vuint64m2_t +test_vfwcvt_xu_f_v_u64m2_rm_m (vbool32_t mask, vfloat32m1_t op1, size_t vl) { + return __riscv_vfwcvt_xu_f_v_u64m2_rm_m (mask, op1, 1, vl); +} + +vuint64m2_t +test_riscv_vfwcvt_xu_f_v_u64m2 (vfloat32m1_t op1, size_t vl) { + return __riscv_vfwcvt_xu_f_v_u64m2 (op1, vl); +} + +vuint64m2_t +test_vfwcvt_xu_f_v_u64m2_m (vbool32_t mask, vfloat32m1_t op1, size_t vl) { + return __riscv_vfwcvt_xu_f_v_u64m2_m (mask, op1, vl); +} + +/* { dg-final { scan-assembler-times {vfwcvt\.xu\.f\.v\s+v[0-9]+,\s*v[0-9]+} 4 } } */ +/* { dg-final { scan-assembler-times {frrm\s+[axs][0-9]+} 2 } } */ +/* { dg-final { scan-assembler-times {fsrm\s+[axs][0-9]+} 2 } } */ +/* { dg-final { scan-assembler-times {fsrmi\s+[01234]} 2 } } */