From patchwork Tue Aug 15 09:07:30 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: 135636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:3f2:4152:657d with SMTP id x8csp301444vqo; Tue, 15 Aug 2023 02:08:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSkwiCov2gHMgB30Ya9M7eJDG2FDoS0DalDetcDFqFIu/yrDavRNYr7Dt13rxfH/VnbtfR X-Received: by 2002:aa7:c7c6:0:b0:522:4dd0:de72 with SMTP id o6-20020aa7c7c6000000b005224dd0de72mr8846775eds.27.1692090506158; Tue, 15 Aug 2023 02:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692090506; cv=none; d=google.com; s=arc-20160816; b=JSiiF65B6+McM5iakrlpyIMKiULlJ44tXZ7ZdvG5WVannuUU6Qwk8AuVVX3t1EijAd bZ7LuL94oxEr1I3GtMySZeXeViTO7msvrY2+aWfxzxurhz2N6u9ZULcYPgLuTQRDs4wA D6URCUXOpZ158lGepYo9l7laZnec9EXKOZNoRmcF3Iwisje3p962Xw0P461+Us2Wuc4q fDt1cCx+f8SWV8tueLRN1ay/FfgQp+FnhZBmZaGJRtBstwR9v6clzCPo1ZEbrGN0ZwiJ 90Z7eFGSLMvZIM+ECb8X+BFdjoswHXCCHNs8S48xvjjdYsRnQY4Ktf44f98iaHeZEKAU JHCg== 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:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=7PAr+H4KPX4zZnMUgwWqRjPAG5FV5I8H9ndR7riXMoM=; fh=9EZcvfVI324lLsRm78AR5trG4A9hqVpSpoTtyXFX1N4=; b=E/SXyTbF6Sqnlg1ylkg7yOVSLsleUJwqKhd6f78O9lvHosOpOYOmx7fVBER4BoH+Yu xk7V91WEvJpoD3i8fRObmasq47lJ9q7b/V4rQHkhM5sa+ecvnbQLrgNICUFGqXIsHmh9 Sfsz7XKi9ACB5fzPPRFLzgVb/1U+Bubgr3CEyakxA3ySaAq7mbVoIuaAmYMFe3X018qw V/zzZgUjl+s3s6C2ilm8dQLmawhieoJRFhx+0VAJTKKYGCFJasFX3p4K4vld5JOC/y7M 5/F4AoapmadcDMNpdlywWhgC1sYXvBrrYoY1YJnHaJS6BrCX1W/rAUbmZ9EGmvgtCHoE +H+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=nhDlQaV3; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 z20-20020aa7d414000000b0052338b247b1si9381700edq.315.2023.08.15.02.08.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 02:08:26 -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; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=nhDlQaV3; 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"; 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 1A71B385701E for ; Tue, 15 Aug 2023 09:08:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A71B385701E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692090505; bh=7PAr+H4KPX4zZnMUgwWqRjPAG5FV5I8H9ndR7riXMoM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=nhDlQaV3GIsLGe4lzgcv/KV+C8x5QnqopVwTptFH6I1zaWG1i+U6fG1voCHzx8OiY XTECFwzK33TidbHFcdPPkcWA8kUiUI8Wq/v1WTJadmyEdrzBESTO7dE3HQkrM1YBt4 dndGwL+KSKn+LOxB5Tvg+VcCkxCUmQt4y245GiiA= 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.43]) by sourceware.org (Postfix) with ESMTPS id 00F563858422 for ; Tue, 15 Aug 2023 09:07:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 00F563858422 X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="458591530" X-IronPort-AV: E=Sophos;i="6.01,174,1684825200"; d="scan'208";a="458591530" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2023 02:07:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="857384891" X-IronPort-AV: E=Sophos;i="6.01,174,1684825200"; d="scan'208";a="857384891" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by orsmga004.jf.intel.com with ESMTP; 15 Aug 2023 02:07:31 -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 222821005608; Tue, 15 Aug 2023 17:07:31 +0800 (CST) To: gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai, pan2.li@intel.com, yanzhang.wang@intel.com, kito.cheng@gmail.com Subject: [PATCH v1] RISC-V: Support RVV VFWCVT.XU.F.V rounding mode intrinsic API Date: Tue, 15 Aug 2023 17:07:30 +0800 Message-Id: <20230815090730.2537591-1-pan2.li@intel.com> X-Mailer: git-send-email 2.34.1 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: 1774285494151329986 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 (vfwcvt_xu_frm_obj): New declaration. (BASE): Ditto. * config/riscv/riscv-vector-builtins-bases.h: Ditto. * config/riscv/riscv-vector-builtins-functions.def (vfwcvt_xu_frm): New intrinsic function definition. 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 7bd72653b9c..5acb9404d4a 100644 --- a/gcc/config/riscv/riscv-vector-builtins-bases.cc +++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc @@ -2526,6 +2526,7 @@ static CONSTEXPR const vfcvt_f_frm vfcvt_f_frm_obj; static CONSTEXPR const vfwcvt_x vfwcvt_x_obj; static CONSTEXPR const vfwcvt_x_frm vfwcvt_x_frm_obj; static CONSTEXPR const vfwcvt_x vfwcvt_xu_obj; +static CONSTEXPR const vfwcvt_x_frm 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; @@ -2779,6 +2780,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 } } */