From patchwork Wed Aug 16 06:20:57 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: 135726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:3f2:4152:657d with SMTP id x8csp907365vqo; Tue, 15 Aug 2023 23:21:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+QxlJRaEn7RpNEOaVH5aXWJUqYkBR1PFDaPG8Kwzpul7flDvz9RlA3k8FuqzPm/w5fdAc X-Received: by 2002:a05:6402:8d4:b0:525:45dc:40b7 with SMTP id d20-20020a05640208d400b0052545dc40b7mr683437edz.17.1692166911186; Tue, 15 Aug 2023 23:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692166911; cv=none; d=google.com; s=arc-20160816; b=TM3lI9Ie+xU6vKIIz/RcV7+DeMAn1Wj99NRaGkUddZB37cIAYaGbjt2tZTkPe4D/Jv GikBDWDUjk4/mkj8Ndbo5eff4i5+PxxWkryHicD+iyLdCXReS3w/VfdSmGH4MVBG0ll/ 6RTEWcyd3MxERZTDh/uYEnFK+3Seuuhv3LPMs2CBqXB2X0n0KSaEaGWmXehubhUAbZiJ IwsDsPucqOLyDztUnjTa/Pm1l7lQVsGurA9h6AYyWEduHxWwM3Uu65b0N3SKd+wLM55e QZbyGdRxwviaddAYoWOv9u0I9K0zaoUxZwL71J76HK9LvP7kslRmrx9+JzcKc5RCl9DA YoKw== 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=pLFQbLgZ0BqZgYPWutT5cEvC/GZKUQ/1Y4E/yS+/N5k=; fh=9EZcvfVI324lLsRm78AR5trG4A9hqVpSpoTtyXFX1N4=; b=Ugto0CfOj1SdE1KRzsjp6z76gIXaBZTWLy8X5QAMoXtRLomfOAMFwCNJaR1i6izUfD J0b28AKslgJPFF4h3IievSWHfA8ppw5xcjJkWv51UeB2ubcWpcD9SkAPIO9+N+f/1E2d DzsekO6Sco954MLdepXgB7zxFlUZaidCqtgo7ApdMuNjfU9eGs81nUnJ8uID/mMZH51a VycU+dsGkli788h26e0RK5ldEmdLmUyTLU9c8IZiANQQbopLbnnxWmP0tzraf95SLTPw gMw5cb0VXk/z40mNSCf9gKuyOEGDYPpnfy68/T5y0EnrowfFjVV37XdsX2+No1QT83zU 3EIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="c/sSP470"; 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 m3-20020aa7c2c3000000b0052364408abasi10578330edp.120.2023.08.15.23.21.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 23:21:51 -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="c/sSP470"; 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 4F50F3855581 for ; Wed, 16 Aug 2023 06:21:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F50F3855581 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692166909; bh=pLFQbLgZ0BqZgYPWutT5cEvC/GZKUQ/1Y4E/yS+/N5k=; 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=c/sSP4707K+jEdH/tJ3Hl8oNvs4uRExyvOhKlhXw3MEa1XFsMjrbqxGp2bGo/7xb/ nPwgm1Z+yTC7Jwf3IK3y+CGCHt/1r/l46tP5q7w2e3Qh71t2bmdjwoCEOhXAhrigqX ZDOzStmBzFGPauWLgd5BfHDbi+AeiDVOKxL7T0eg= 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 1194B3858C52 for ; Wed, 16 Aug 2023 06:21:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1194B3858C52 X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="458805305" X-IronPort-AV: E=Sophos;i="6.01,176,1684825200"; d="scan'208";a="458805305" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2023 23:21:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="683931793" X-IronPort-AV: E=Sophos;i="6.01,176,1684825200"; d="scan'208";a="683931793" Received: from shvmail02.sh.intel.com ([10.239.244.9]) by orsmga003.jf.intel.com with ESMTP; 15 Aug 2023 23:20:59 -0700 Received: from pli-ubuntu.sh.intel.com (pli-ubuntu.sh.intel.com [10.239.159.47]) by shvmail02.sh.intel.com (Postfix) with ESMTP id DF3F21006F11; Wed, 16 Aug 2023 14:20:58 +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 v2] RISC-V: Support RVV VFCVT.XU.F.V rounding mode intrinsic API Date: Wed, 16 Aug 2023 14:20:57 +0800 Message-Id: <20230816062057.379965-1-pan2.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230815050146.204188-1-pan2.li@intel.com> References: <20230815050146.204188-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: 1774270035692289115 X-GMAIL-MSGID: 1774365611353794813 From: Pan Li This patch would like to support the rounding mode API for the VFCVT.XU.F.V as the below samples. * __riscv_vfcvt_xu_f_v_u32m1_rm * __riscv_vfcvt_xu_f_v_u32m1_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 (vfcvt_xu_frm): New intrinsic function def.. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/float-point-cvt-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-cvt-xu.c | 29 +++++++++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/float-point-cvt-xu.c diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc b/gcc/config/riscv/riscv-vector-builtins-bases.cc index 817d2ed016a..421f4096db8 100644 --- a/gcc/config/riscv/riscv-vector-builtins-bases.cc +++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc @@ -2478,6 +2478,7 @@ static CONSTEXPR const vmv_v vfmv_v_obj; static CONSTEXPR const vfcvt_x vfcvt_x_obj; static CONSTEXPR const vfcvt_x vfcvt_x_frm_obj; static CONSTEXPR const vfcvt_x vfcvt_xu_obj; +static CONSTEXPR const vfcvt_x vfcvt_xu_frm_obj; static CONSTEXPR const vfcvt_rtz_x vfcvt_rtz_x_obj; static CONSTEXPR const vfcvt_rtz_x vfcvt_rtz_xu_obj; static CONSTEXPR const vfcvt_f vfcvt_f_obj; @@ -2728,6 +2729,7 @@ BASE (vfmv_v) BASE (vfcvt_x) BASE (vfcvt_x_frm) BASE (vfcvt_xu) +BASE (vfcvt_xu_frm) BASE (vfcvt_rtz_x) BASE (vfcvt_rtz_xu) BASE (vfcvt_f) diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.h b/gcc/config/riscv/riscv-vector-builtins-bases.h index 50a7d7ffb6f..98b61655692 100644 --- a/gcc/config/riscv/riscv-vector-builtins-bases.h +++ b/gcc/config/riscv/riscv-vector-builtins-bases.h @@ -207,6 +207,7 @@ extern const function_base *const vfmv_v; extern const function_base *const vfcvt_x; extern const function_base *const vfcvt_x_frm; extern const function_base *const vfcvt_xu; +extern const function_base *const vfcvt_xu_frm; extern const function_base *const vfcvt_rtz_x; extern const function_base *const vfcvt_rtz_xu; extern const function_base *const vfcvt_f; diff --git a/gcc/config/riscv/riscv-vector-builtins-functions.def b/gcc/config/riscv/riscv-vector-builtins-functions.def index 8b6a7cc49f3..613bbe7a855 100644 --- a/gcc/config/riscv/riscv-vector-builtins-functions.def +++ b/gcc/config/riscv/riscv-vector-builtins-functions.def @@ -446,6 +446,7 @@ DEF_RVV_FUNCTION (vfcvt_f, alu, full_preds, i_to_f_x_v_ops) DEF_RVV_FUNCTION (vfcvt_f, alu, full_preds, u_to_f_xu_v_ops) DEF_RVV_FUNCTION (vfcvt_x_frm, alu_frm, full_preds, f_to_i_f_v_ops) +DEF_RVV_FUNCTION (vfcvt_xu_frm, alu_frm, full_preds, f_to_u_f_v_ops) // 13.18. Widening Floating-Point/Integer Type-Convert Instructions DEF_RVV_FUNCTION (vfwcvt_x, alu, full_preds, f_to_wi_f_v_ops) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/float-point-cvt-xu.c b/gcc/testsuite/gcc.target/riscv/rvv/base/float-point-cvt-xu.c new file mode 100644 index 00000000000..bb164b2b001 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/float-point-cvt-xu.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64 -O3 -Wno-psabi" } */ + +#include "riscv_vector.h" + +vuint32m1_t +test_riscv_vfcvt_xu_f_v_u32m1_rm (vfloat32m1_t op1, size_t vl) { + return __riscv_vfcvt_xu_f_v_u32m1_rm (op1, 0, vl); +} + +vuint32m1_t +test_vfcvt_xu_f_v_u32m1_rm_m (vbool32_t mask, vfloat32m1_t op1, size_t vl) { + return __riscv_vfcvt_xu_f_v_u32m1_rm_m (mask, op1, 1, vl); +} + +vuint32m1_t +test_riscv_vfcvt_xu_f_vv_u32m1 (vfloat32m1_t op1, size_t vl) { + return __riscv_vfcvt_xu_f_v_u32m1 (op1, vl); +} + +vuint32m1_t +test_vfcvt_xu_f_v_u32m1_m (vbool32_t mask, vfloat32m1_t op1, size_t vl) { + return __riscv_vfcvt_xu_f_v_u32m1_m (mask, op1, vl); +} + +/* { dg-final { scan-assembler-times {vfcvt\.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 } } */