From patchwork Thu Nov 2 00:54:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Xu X-Patchwork-Id: 160743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp52563vqu; Wed, 1 Nov 2023 17:55:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEClLASXSfPrh0k+QGApMT1MQdjlkVeU5hBXU/nzq3EPGACIkNaERGKjyaCaNQ1bz2wbm5e X-Received: by 2002:a05:622a:d3:b0:41e:1974:7cf1 with SMTP id p19-20020a05622a00d300b0041e19747cf1mr20508767qtw.18.1698886522817; Wed, 01 Nov 2023 17:55:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698886522; cv=pass; d=google.com; s=arc-20160816; b=uXgY+8QTGKhei+YrdA2Vgd+xqvjIELXcZOUUcnL2ElNwRDkQf5KZBkaFuYt4L3I/2e P4yj966zHs8sUT/x3iAFWKVRTKQx+GV2X9AXrsfF2FYUKSETMOS2hDZ9hG9v4DKvs5r3 nQ4wihUC1TqtykfQ0yLWX2Q0n1tcgfNW7ciEICngwhGBugZ/u9bgDlKX8w58KZ1K1g9q xPDIZXQVUxhzOGrqrBRCjESBn8IWJ1Lk41TF6xMgRNLScF2SRGrlK3v/KxG11A8Xh/3U zRGvq/OZASSvy9mOqwx4ClBg4i043/TnbQT8cKaCYEvbHHmCGYyYTAhXUfr6Yj6j5Cic swhQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:date:subject:cc:to :from:arc-filter:dmarc-filter:delivered-to; bh=DRkBsjhZ49VE+h6kmbrcHP8sF1ZgDOdzYKVrkF1hs+M=; fh=Qb/t3bub0qUevN32JfR0ksI5uuULifWToHOJuO7VEBY=; b=r2XLl/yMWiJGtn0CWizNJwpxmJgjQ/iHAfs+0zjjD0vbaAEQ1xLrWHW9ukYDZgzViJ cNdsJK2+4/yZDuTZ64VRj6+pmp9qjw6WXUpNQyMJZm3521VQF3aQWaVl8U/q2LH1uXzO WYSQ3qSbd58IuQOEvOdE4yImJqz40ygohoxxf6lLifu6O0GcvNN4FFUIXmqGVEAA7K+G KrzjjwDe3choDpV50bc1JvpOo2S1x0v4CzrupH9UHm942KJTFr5tMm0oInutE2OxMnuu FAWUnW6L5v5NccB2yz/HFUjXerIt6HWkspCpuZ3GsC0+kTXgTJl13dKAUYFLCm1uCSK1 qlCw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); 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" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id u10-20020a05622a198a00b004188c21b6f8si3563983qtc.192.2023.11.01.17.55.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 17:55:22 -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; arc=pass (i=1); 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 917CD385840C for ; Thu, 2 Nov 2023 00:55:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from zg8tmja2lje4os4yms4ymjma.icoremail.net (zg8tmja2lje4os4yms4ymjma.icoremail.net [206.189.21.223]) by sourceware.org (Postfix) with ESMTP id C41FB3858414 for ; Thu, 2 Nov 2023 00:54:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C41FB3858414 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eswincomputing.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C41FB3858414 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=206.189.21.223 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698886496; cv=none; b=aVDQ4JLw7CWPQ62Vbg7CVK9z+qZ8z4e4qdo0czbV0sjDtR3HWsEmBbiiT4QqyDQsj4x1aZ5X4WbRfADv7RGa7MgO2F6z2+SUKKMkfTal8d7AjQZGCE9GV90d5f7Z/kI1bI8EQwkJVJ0iz5UQiJJfO5JSvMqFQ4fhRuCdES5Emao= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698886496; c=relaxed/simple; bh=hLDvOg376Ddit/29/xvgfL5T7273cS2fQGGN3WTGYcg=; h=From:To:Subject:Date:Message-Id; b=uvtZCVFsfG9AYfSxvehIvK/vqPNze5czkobhnTO+e3VdHb4t8qAkvaJCv2bfhODYgVJ/KRYCERDMRPcTflj/uoqnOwJ0COssagJWP1AK+miqa0nCr+KGCRND8T7SdH+FkAKzCIPSQte8vpn/L3rsBIXzf0IcpXdOWdCi7w94KM8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from host014-ubuntu-1804.lxd (unknown [10.12.130.31]) by app2 (Coremail) with SMTP id TQJkCgAn5UI780JlmcgBAA--.21542S4; Thu, 02 Nov 2023 08:54:20 +0800 (CST) From: Li Xu To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com, juzhe.zhong@rivai.ai, xuli Subject: [PATCH] RISC-V: Support vcreate intrinsics for non-tuple types Date: Thu, 2 Nov 2023 00:54:32 +0000 Message-Id: <20231102005432.21119-1-xuli1@eswincomputing.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: TQJkCgAn5UI780JlmcgBAA--.21542S4 X-Coremail-Antispam: 1UD129KBjvAXoWfZrW5Wr45Aw48ZrW7Kw45ZFb_yoW8tFy5Zo WkGrsYy3ZxGw1xArnYg3Z5Wr4kWF4xCws8Jry5Gr98Z3ZrJw18XanxJa10yF1Skr4agay3 u3saqr48XFsrArs5n29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73VFW2AGmfu7bjvjm3 AaLaJ3UjIYCTnIWjp_UUUYe7AC8VAFwI0_Gr0_Xr1l1xkIjI8I6I8E6xAIw20EY4v20xva j40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2 x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8 Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI 0_Cr1j6rxdM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xf McIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7 v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVCm -wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r 1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij 64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr 0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7VUbXdbUUUUUU== X-CM-SenderInfo: 50xoxi46hv4xpqfrz1xxwl0woofrz/ X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, 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.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781411634181680782 X-GMAIL-MSGID: 1781411634181680782 From: xuli https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/288 gcc/ChangeLog: * config/riscv/riscv-vector-builtins-bases.cc: Expand non-tuple intrinsics. * config/riscv/riscv-vector-builtins-functions.def (vcreate): Define non-tuple intrinsics. * config/riscv/riscv-vector-builtins-shapes.cc (struct vcreate_def): Ditto. * config/riscv/riscv-vector-builtins.cc: Add arg types. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/tuple_create.c: Rename to vcreate.c. * gcc.target/riscv/rvv/base/vcreate.c: New test. --- .../riscv/riscv-vector-builtins-bases.cc | 21 +- .../riscv/riscv-vector-builtins-functions.def | 6 + .../riscv/riscv-vector-builtins-shapes.cc | 25 +- gcc/config/riscv/riscv-vector-builtins.cc | 53 ++++ .../gcc.target/riscv/rvv/base/tuple_create.c | 123 --------- .../gcc.target/riscv/rvv/base/vcreate.c | 260 ++++++++++++++++++ 6 files changed, 357 insertions(+), 131 deletions(-) delete mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/tuple_create.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/vcreate.c diff --git a/gcc/config/riscv/riscv-vector-builtins-bases.cc b/gcc/config/riscv/riscv-vector-builtins-bases.cc index 0b1409a52e0..25ba31e2659 100644 --- a/gcc/config/riscv/riscv-vector-builtins-bases.cc +++ b/gcc/config/riscv/riscv-vector-builtins-bases.cc @@ -1798,6 +1798,10 @@ public: { unsigned int nargs = gimple_call_num_args (f.call); tree lhs_type = TREE_TYPE (f.lhs); + /* LMUL > 1 non-tuple vector types are not structure, + we can't use __val[index] to set the subpart. */ + if (!riscv_v_ext_tuple_mode_p (TYPE_MODE (lhs_type))) + return NULL; /* Replace the call with a clobber of the result (to prevent it from becoming upwards exposed) followed by stores into each individual @@ -1823,9 +1827,22 @@ public: return clobber; } - rtx expand (function_expander &) const override + rtx expand (function_expander &e) const override { - gcc_unreachable (); + if (!e.target) + return NULL_RTX; + gcc_assert (riscv_v_ext_vector_mode_p (GET_MODE (e.target))); + unsigned int nargs = call_expr_nargs (e.exp); + for (unsigned int i = 0; i < nargs; i++) + { + rtx src = expand_normal (CALL_EXPR_ARG (e.exp, i)); + poly_int64 offset = i * GET_MODE_SIZE (GET_MODE (src)); + rtx subreg = simplify_gen_subreg (GET_MODE (src), e.target, + GET_MODE (e.target), offset); + emit_move_insn (subreg, src); + } + + return e.target; } }; diff --git a/gcc/config/riscv/riscv-vector-builtins-functions.def b/gcc/config/riscv/riscv-vector-builtins-functions.def index 911fd520195..1c37fd5fffe 100644 --- a/gcc/config/riscv/riscv-vector-builtins-functions.def +++ b/gcc/config/riscv/riscv-vector-builtins-functions.def @@ -617,6 +617,12 @@ DEF_RVV_FUNCTION (vget, vget, none_preds, all_v_vget_lmul1_x8_ops) DEF_RVV_FUNCTION (vget, vget, none_preds, all_v_vget_lmul2_x2_ops) DEF_RVV_FUNCTION (vget, vget, none_preds, all_v_vget_lmul2_x4_ops) DEF_RVV_FUNCTION (vget, vget, none_preds, all_v_vget_lmul4_x2_ops) +DEF_RVV_FUNCTION (vcreate, vcreate, none_preds, all_v_vcreate_lmul1_x2_ops) +DEF_RVV_FUNCTION (vcreate, vcreate, none_preds, all_v_vcreate_lmul1_x4_ops) +DEF_RVV_FUNCTION (vcreate, vcreate, none_preds, all_v_vcreate_lmul1_x8_ops) +DEF_RVV_FUNCTION (vcreate, vcreate, none_preds, all_v_vcreate_lmul2_x2_ops) +DEF_RVV_FUNCTION (vcreate, vcreate, none_preds, all_v_vcreate_lmul2_x4_ops) +DEF_RVV_FUNCTION (vcreate, vcreate, none_preds, all_v_vcreate_lmul4_x2_ops) // Tuple types DEF_RVV_FUNCTION (vset, vset, none_preds, all_v_vset_tuple_ops) diff --git a/gcc/config/riscv/riscv-vector-builtins-shapes.cc b/gcc/config/riscv/riscv-vector-builtins-shapes.cc index 0bda934ae16..72b0d6a96a3 100644 --- a/gcc/config/riscv/riscv-vector-builtins-shapes.cc +++ b/gcc/config/riscv/riscv-vector-builtins-shapes.cc @@ -728,13 +728,17 @@ struct vcreate_def : public build_base if (!return_type) continue; - machine_mode mode = TYPE_MODE (return_type); - unsigned int nf = get_nf (mode); + tree arg_type = function_instance.op_info->args[0].get_tree_type ( + function_instance.type.index); - for (unsigned int i = 0; i < nf; i++) - argument_types.quick_push ( - function_instance.op_info->args[0].get_tree_type ( - function_instance.type.index)); + machine_mode outer_mode = TYPE_MODE (return_type); + machine_mode inner_mode = TYPE_MODE (arg_type); + unsigned int nargs + = exact_div (GET_MODE_SIZE (outer_mode), GET_MODE_SIZE (inner_mode)) + .to_constant (); + + for (unsigned int i = 0; i < nargs; i++) + argument_types.quick_push (arg_type); b.add_unique_function (function_instance, (*group.shape), return_type, argument_types); @@ -748,6 +752,15 @@ struct vcreate_def : public build_base return nullptr; b.append_base_name (instance.base_name); b.append_name (operand_suffixes[instance.op_info->op]); + + if (instance.op_info->ret.base_type != RVV_BASE_vector) + { + vector_type_index arg_type_idx + = instance.op_info->args[0].get_function_type_index ( + instance.type.index); + b.append_name (type_suffixes[arg_type_idx].vector); + } + vector_type_index ret_type_idx = instance.op_info->ret.get_function_type_index (instance.type.index); b.append_name (type_suffixes[ret_type_idx].vector); diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc index 2e33bf73549..650a1dc83bc 100644 --- a/gcc/config/riscv/riscv-vector-builtins.cc +++ b/gcc/config/riscv/riscv-vector-builtins.cc @@ -877,6 +877,11 @@ static CONSTEXPR const rvv_arg_type_info tuple_vset_args[] static CONSTEXPR const rvv_arg_type_info tuple_vcreate_args[] = {rvv_arg_type_info (RVV_BASE_tuple_subpart), rvv_arg_type_info_end}; +/* A list of args for vector_type func (vector_type) function. */ +static CONSTEXPR const rvv_arg_type_info ext_vcreate_args[] + = {rvv_arg_type_info (RVV_BASE_vector), + rvv_arg_type_info_end}; + /* A list of none preds that will be registered for intrinsic functions. */ static CONSTEXPR const predication_type_index none_preds[] = {PRED_TYPE_none, NUM_PRED_TYPES}; @@ -2517,6 +2522,54 @@ static CONSTEXPR const rvv_op_info all_none_void_tuple_ops rvv_arg_type_info (RVV_BASE_vector), /* Return type */ void_args /* Args */}; +/* A static operand information for vector_type func (vector_type) + * function registration. */ +static CONSTEXPR const rvv_op_info all_v_vcreate_lmul1_x2_ops + = {lmul1_ops, /* Types */ + OP_TYPE_v, /* Suffix */ + rvv_arg_type_info (RVV_BASE_vlmul_ext_x2), /* Return type */ + ext_vcreate_args /* Args */}; + +/* A static operand information for vector_type func (vector_type) + * function registration. */ +static CONSTEXPR const rvv_op_info all_v_vcreate_lmul1_x4_ops + = {lmul1_ops, /* Types */ + OP_TYPE_v, /* Suffix */ + rvv_arg_type_info (RVV_BASE_vlmul_ext_x4), /* Return type */ + ext_vcreate_args /* Args */}; + +/* A static operand information for vector_type func (vector_type) + * function registration. */ +static CONSTEXPR const rvv_op_info all_v_vcreate_lmul1_x8_ops + = {lmul1_ops, /* Types */ + OP_TYPE_v, /* Suffix */ + rvv_arg_type_info (RVV_BASE_vlmul_ext_x8), /* Return type */ + ext_vcreate_args /* Args */}; + +/* A static operand information for vector_type func (vector_type) + * function registration. */ +static CONSTEXPR const rvv_op_info all_v_vcreate_lmul2_x2_ops + = {lmul2_ops, /* Types */ + OP_TYPE_v, /* Suffix */ + rvv_arg_type_info (RVV_BASE_vlmul_ext_x2), /* Return type */ + ext_vcreate_args /* Args */}; + +/* A static operand information for vector_type func (vector_type) + * function registration. */ +static CONSTEXPR const rvv_op_info all_v_vcreate_lmul2_x4_ops + = {lmul2_ops, /* Types */ + OP_TYPE_v, /* Suffix */ + rvv_arg_type_info (RVV_BASE_vlmul_ext_x4), /* Return type */ + ext_vcreate_args /* Args */}; + +/* A static operand information for vector_type func (vector_type) + * function registration. */ +static CONSTEXPR const rvv_op_info all_v_vcreate_lmul4_x2_ops + = {lmul4_ops, /* Types */ + OP_TYPE_v, /* Suffix */ + rvv_arg_type_info (RVV_BASE_vlmul_ext_x2), /* Return type */ + ext_vcreate_args /* Args */}; + /* A list of all RVV base function types. */ static CONSTEXPR const function_type_info function_types[] = { #define DEF_RVV_TYPE_INDEX( \ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple_create.c b/gcc/testsuite/gcc.target/riscv/rvv/base/tuple_create.c deleted file mode 100644 index b252b2f3cd4..00000000000 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/tuple_create.c +++ /dev/null @@ -1,123 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-march=rv64gcv_zvfh -mabi=lp64 -O3 -Wno-psabi" } */ - -#include "riscv_vector.h" - -vfloat16mf4x2_t test_vcreate_v_f16mf4x2(vfloat16mf4_t v0, vfloat16mf4_t v1) { - return __riscv_vcreate_v_f16mf4x2(v0, v1); -} - -vfloat16mf4x3_t test_vcreate_v_f16mf4x3(vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2) { - return __riscv_vcreate_v_f16mf4x3(v0, v1, v2); -} - -vfloat16mf4x4_t test_vcreate_v_f16mf4x4(vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2, vfloat16mf4_t v3) { - return __riscv_vcreate_v_f16mf4x4(v0, v1, v2, v3); -} - -vfloat16mf4x5_t test_vcreate_v_f16mf4x5(vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2, vfloat16mf4_t v3, vfloat16mf4_t v4) { - return __riscv_vcreate_v_f16mf4x5(v0, v1, v2, v3, v4); -} - -vfloat16mf4x6_t test_vcreate_v_f16mf4x6(vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2, vfloat16mf4_t v3, vfloat16mf4_t v4, vfloat16mf4_t v5) { - return __riscv_vcreate_v_f16mf4x6(v0, v1, v2, v3, v4, v5); -} - -vfloat16mf4x7_t test_vcreate_v_f16mf4x7(vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2, vfloat16mf4_t v3, vfloat16mf4_t v4, vfloat16mf4_t v5, vfloat16mf4_t v6) { - return __riscv_vcreate_v_f16mf4x7(v0, v1, v2, v3, v4, v5, v6); -} - -vfloat16mf4x8_t test_vcreate_v_f16mf4x8(vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2, vfloat16mf4_t v3, vfloat16mf4_t v4, vfloat16mf4_t v5, vfloat16mf4_t v6, vfloat16mf4_t v7) { - return __riscv_vcreate_v_f16mf4x8(v0, v1, v2, v3, v4, v5, v6, v7); -} - -vfloat32m1x2_t test_vcreate_v_f32m1x2(vfloat32m1_t v0, vfloat32m1_t v1) { - return __riscv_vcreate_v_f32m1x2(v0, v1); -} - -vfloat32m1x3_t test_vcreate_v_f32m1x3(vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2) { - return __riscv_vcreate_v_f32m1x3(v0, v1, v2); -} - -vfloat32m1x4_t test_vcreate_v_f32m1x4(vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2, vfloat32m1_t v3) { - return __riscv_vcreate_v_f32m1x4(v0, v1, v2, v3); -} - -vfloat32m1x5_t test_vcreate_v_f32m1x5(vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2, vfloat32m1_t v3, vfloat32m1_t v4) { - return __riscv_vcreate_v_f32m1x5(v0, v1, v2, v3, v4); -} - -vfloat32m1x6_t test_vcreate_v_f32m1x6(vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2, vfloat32m1_t v3, vfloat32m1_t v4, vfloat32m1_t v5) { - return __riscv_vcreate_v_f32m1x6(v0, v1, v2, v3, v4, v5); -} - -vfloat32m1x7_t test_vcreate_v_f32m1x7(vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2, vfloat32m1_t v3, vfloat32m1_t v4, vfloat32m1_t v5, vfloat32m1_t v6) { - return __riscv_vcreate_v_f32m1x7(v0, v1, v2, v3, v4, v5, v6); -} - -vfloat32m1x8_t test_vcreate_v_f32m1x8(vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2, vfloat32m1_t v3, vfloat32m1_t v4, vfloat32m1_t v5, vfloat32m1_t v6, vfloat32m1_t v7) { - return __riscv_vcreate_v_f32m1x8(v0, v1, v2, v3, v4, v5, v6, v7); -} - -vfloat64m2x2_t test_vcreate_v_f64m2x2(vfloat64m2_t v0, vfloat64m2_t v1) { - return __riscv_vcreate_v_f64m2x2(v0, v1); -} - -vfloat64m2x3_t test_vcreate_v_f64m2x3(vfloat64m2_t v0, vfloat64m2_t v1, vfloat64m2_t v2) { - return __riscv_vcreate_v_f64m2x3(v0, v1, v2); -} - -vfloat64m2x4_t test_vcreate_v_f64m2x4(vfloat64m2_t v0, vfloat64m2_t v1, vfloat64m2_t v2, vfloat64m2_t v3) { - return __riscv_vcreate_v_f64m2x4(v0, v1, v2, v3); -} - -vfloat64m4x2_t test_vcreate_v_f64m4x2(vfloat64m4_t v0, vfloat64m4_t v1) { - return __riscv_vcreate_v_f64m4x2(v0, v1); -} - -vint8m2x2_t test_vcreate_v_i8m2x2(vint8m2_t v0, vint8m2_t v1) { - return __riscv_vcreate_v_i8m2x2(v0, v1); -} - -vint8m2x3_t test_vcreate_v_i8m2x3(vint8m2_t v0, vint8m2_t v1, vint8m2_t v2) { - return __riscv_vcreate_v_i8m2x3(v0, v1, v2); -} - -vint8m2x4_t test_vcreate_v_i8m2x4(vint8m2_t v0, vint8m2_t v1, vint8m2_t v2, vint8m2_t v3) { - return __riscv_vcreate_v_i8m2x4(v0, v1, v2, v3); -} - -vint8m4x2_t test_vcreate_v_i8m4x2(vint8m4_t v0, vint8m4_t v1) { - return __riscv_vcreate_v_i8m4x2(v0, v1); -} - -vint16m4x2_t test_vcreate_v_i16m4x2(vint16m4_t v0, vint16m4_t v1) { - return __riscv_vcreate_v_i16m4x2(v0, v1); -} - -vint32m4x2_t test_vcreate_v_i32m4x2(vint32m4_t v0, vint32m4_t v1) { - return __riscv_vcreate_v_i32m4x2(v0, v1); -} - -vint64m2x2_t test_vcreate_v_i64m2x2(vint64m2_t v0, vint64m2_t v1) { - return __riscv_vcreate_v_i64m2x2(v0, v1); -} - -vint64m2x3_t test_vcreate_v_i64m2x3(vint64m2_t v0, vint64m2_t v1, vint64m2_t v2) { - return __riscv_vcreate_v_i64m2x3(v0, v1, v2); -} - -vint64m2x4_t test_vcreate_v_i64m2x4(vint64m2_t v0, vint64m2_t v1, vint64m2_t v2, vint64m2_t v3) { - return __riscv_vcreate_v_i64m2x4(v0, v1, v2, v3); -} - -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 7 } } */ -/* { dg-final { scan-assembler-times {vle16\.v\s+v[0-9]+,\s*0\([0-9ax]+\)} 35 } } */ -/* { dg-final { scan-assembler-times {vse16\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 35 } } */ -/* { dg-final { scan-assembler-times {vl2re8\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 9 } } */ -/* { dg-final { scan-assembler-times {vl1re32\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 35 } } */ -/* { dg-final { scan-assembler-times {vl2re64\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 18 } } */ -/* { dg-final { scan-assembler-times {vl4re64\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 2 } } */ -/* { dg-final { scan-assembler-times {vs1r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 35 } } */ -/* { dg-final { scan-assembler-times {vs2r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 27 } } */ -/* { dg-final { scan-assembler-times {vs4r\.v\s+v[0-9]+,\s*0\([a-x][0-9]+\)} 8 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/vcreate.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vcreate.c new file mode 100644 index 00000000000..158eec04e22 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vcreate.c @@ -0,0 +1,260 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvfh -mabi=lp64 -O3 -Wno-psabi" } */ + +#include "riscv_vector.h" + +vfloat16m2_t +test_vcreate_v_f16m1_f16m2 (vfloat16m1_t v0, vfloat16m1_t v1) +{ + return __riscv_vcreate_v_f16m1_f16m2 (v0, v1); +} + +vfloat32m2_t +test_vcreate_v_f32m1_f32m2 (vfloat32m1_t v0, vfloat32m1_t v1) +{ + return __riscv_vcreate_v_f32m1_f32m2 (v0, v1); +} + +vfloat64m4_t +test_vcreate_v_f64m1_f64m4 (vfloat64m1_t v0, vfloat64m1_t v1, vfloat64m1_t v2, + vfloat64m1_t v3) +{ + return __riscv_vcreate_v_f64m1_f64m4 (v0, v1, v2, v3); +} + +vint8m2_t +test_vcreate_v_i8m1_i8m2 (vint8m1_t v0, vint8m1_t v1) +{ + return __riscv_vcreate_v_i8m1_i8m2 (v0, v1); +} + +vint16m8_t +test_vcreate_v_i16m1_i16m8 (vint16m1_t v0, vint16m1_t v1, vint16m1_t v2, + vint16m1_t v3, vint16m1_t v4, vint16m1_t v5, + vint16m1_t v6, vint16m1_t v7) +{ + return __riscv_vcreate_v_i16m1_i16m8 (v0, v1, v2, v3, v4, v5, v6, v7); +} + +vint32m4_t +test_vcreate_v_i32m2_i32m4 (vint32m2_t v0, vint32m2_t v1) +{ + return __riscv_vcreate_v_i32m2_i32m4 (v0, v1); +} + +vint64m8_t +test_vcreate_v_i64m2_i64m8 (vint64m2_t v0, vint64m2_t v1, vint64m2_t v2, + vint64m2_t v3) +{ + return __riscv_vcreate_v_i64m2_i64m8 (v0, v1, v2, v3); +} + +vuint8m2_t +test_vcreate_v_u8m1_u8m2 (vuint8m1_t v0, vuint8m1_t v1) +{ + return __riscv_vcreate_v_u8m1_u8m2 (v0, v1); +} + +vuint16m8_t +test_vcreate_v_u16m1_u16m8 (vuint16m1_t v0, vuint16m1_t v1, vuint16m1_t v2, + vuint16m1_t v3, vuint16m1_t v4, vuint16m1_t v5, + vuint16m1_t v6, vuint16m1_t v7) +{ + return __riscv_vcreate_v_u16m1_u16m8 (v0, v1, v2, v3, v4, v5, v6, v7); +} + +vuint32m8_t +test_vcreate_v_u32m2_u32m8 (vuint32m2_t v0, vuint32m2_t v1, vuint32m2_t v2, + vuint32m2_t v3) +{ + return __riscv_vcreate_v_u32m2_u32m8 (v0, v1, v2, v3); +} + +vuint64m4_t +test_vcreate_v_u64m2_u64m4 (vuint64m2_t v0, vuint64m2_t v1) +{ + return __riscv_vcreate_v_u64m2_u64m4 (v0, v1); +} + +vfloat16mf4x2_t +test_vcreate_v_f16mf4x2 (vfloat16mf4_t v0, vfloat16mf4_t v1) +{ + return __riscv_vcreate_v_f16mf4x2 (v0, v1); +} + +vfloat16mf4x3_t +test_vcreate_v_f16mf4x3 (vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2) +{ + return __riscv_vcreate_v_f16mf4x3 (v0, v1, v2); +} + +vfloat16mf4x4_t +test_vcreate_v_f16mf4x4 (vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2, + vfloat16mf4_t v3) +{ + return __riscv_vcreate_v_f16mf4x4 (v0, v1, v2, v3); +} + +vfloat16mf4x5_t +test_vcreate_v_f16mf4x5 (vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2, + vfloat16mf4_t v3, vfloat16mf4_t v4) +{ + return __riscv_vcreate_v_f16mf4x5 (v0, v1, v2, v3, v4); +} + +vfloat16mf4x6_t +test_vcreate_v_f16mf4x6 (vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2, + vfloat16mf4_t v3, vfloat16mf4_t v4, vfloat16mf4_t v5) +{ + return __riscv_vcreate_v_f16mf4x6 (v0, v1, v2, v3, v4, v5); +} + +vfloat16mf4x7_t +test_vcreate_v_f16mf4x7 (vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2, + vfloat16mf4_t v3, vfloat16mf4_t v4, vfloat16mf4_t v5, + vfloat16mf4_t v6) +{ + return __riscv_vcreate_v_f16mf4x7 (v0, v1, v2, v3, v4, v5, v6); +} + +vfloat16mf4x8_t +test_vcreate_v_f16mf4x8 (vfloat16mf4_t v0, vfloat16mf4_t v1, vfloat16mf4_t v2, + vfloat16mf4_t v3, vfloat16mf4_t v4, vfloat16mf4_t v5, + vfloat16mf4_t v6, vfloat16mf4_t v7) +{ + return __riscv_vcreate_v_f16mf4x8 (v0, v1, v2, v3, v4, v5, v6, v7); +} + +vfloat32m1x2_t +test_vcreate_v_f32m1x2 (vfloat32m1_t v0, vfloat32m1_t v1) +{ + return __riscv_vcreate_v_f32m1x2 (v0, v1); +} + +vfloat32m1x3_t +test_vcreate_v_f32m1x3 (vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2) +{ + return __riscv_vcreate_v_f32m1x3 (v0, v1, v2); +} + +vfloat32m1x4_t +test_vcreate_v_f32m1x4 (vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2, + vfloat32m1_t v3) +{ + return __riscv_vcreate_v_f32m1x4 (v0, v1, v2, v3); +} + +vfloat32m1x5_t +test_vcreate_v_f32m1x5 (vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2, + vfloat32m1_t v3, vfloat32m1_t v4) +{ + return __riscv_vcreate_v_f32m1x5 (v0, v1, v2, v3, v4); +} + +vfloat32m1x6_t +test_vcreate_v_f32m1x6 (vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2, + vfloat32m1_t v3, vfloat32m1_t v4, vfloat32m1_t v5) +{ + return __riscv_vcreate_v_f32m1x6 (v0, v1, v2, v3, v4, v5); +} + +vfloat32m1x7_t +test_vcreate_v_f32m1x7 (vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2, + vfloat32m1_t v3, vfloat32m1_t v4, vfloat32m1_t v5, + vfloat32m1_t v6) +{ + return __riscv_vcreate_v_f32m1x7 (v0, v1, v2, v3, v4, v5, v6); +} + +vfloat32m1x8_t +test_vcreate_v_f32m1x8 (vfloat32m1_t v0, vfloat32m1_t v1, vfloat32m1_t v2, + vfloat32m1_t v3, vfloat32m1_t v4, vfloat32m1_t v5, + vfloat32m1_t v6, vfloat32m1_t v7) +{ + return __riscv_vcreate_v_f32m1x8 (v0, v1, v2, v3, v4, v5, v6, v7); +} + +vfloat64m2x2_t +test_vcreate_v_f64m2x2 (vfloat64m2_t v0, vfloat64m2_t v1) +{ + return __riscv_vcreate_v_f64m2x2 (v0, v1); +} + +vfloat64m2x3_t +test_vcreate_v_f64m2x3 (vfloat64m2_t v0, vfloat64m2_t v1, vfloat64m2_t v2) +{ + return __riscv_vcreate_v_f64m2x3 (v0, v1, v2); +} + +vfloat64m2x4_t +test_vcreate_v_f64m2x4 (vfloat64m2_t v0, vfloat64m2_t v1, vfloat64m2_t v2, + vfloat64m2_t v3) +{ + return __riscv_vcreate_v_f64m2x4 (v0, v1, v2, v3); +} + +vfloat64m4x2_t +test_vcreate_v_f64m4x2 (vfloat64m4_t v0, vfloat64m4_t v1) +{ + return __riscv_vcreate_v_f64m4x2 (v0, v1); +} + +vint8m2x2_t +test_vcreate_v_i8m2x2 (vint8m2_t v0, vint8m2_t v1) +{ + return __riscv_vcreate_v_i8m2x2 (v0, v1); +} + +vint8m2x3_t +test_vcreate_v_i8m2x3 (vint8m2_t v0, vint8m2_t v1, vint8m2_t v2) +{ + return __riscv_vcreate_v_i8m2x3 (v0, v1, v2); +} + +vint8m2x4_t +test_vcreate_v_i8m2x4 (vint8m2_t v0, vint8m2_t v1, vint8m2_t v2, vint8m2_t v3) +{ + return __riscv_vcreate_v_i8m2x4 (v0, v1, v2, v3); +} + +vint8m4x2_t +test_vcreate_v_i8m4x2 (vint8m4_t v0, vint8m4_t v1) +{ + return __riscv_vcreate_v_i8m4x2 (v0, v1); +} + +vint16m4x2_t +test_vcreate_v_i16m4x2 (vint16m4_t v0, vint16m4_t v1) +{ + return __riscv_vcreate_v_i16m4x2 (v0, v1); +} + +vint32m4x2_t +test_vcreate_v_i32m4x2 (vint32m4_t v0, vint32m4_t v1) +{ + return __riscv_vcreate_v_i32m4x2 (v0, v1); +} + +vint64m2x2_t +test_vcreate_v_i64m2x2 (vint64m2_t v0, vint64m2_t v1) +{ + return __riscv_vcreate_v_i64m2x2 (v0, v1); +} + +vint64m2x3_t +test_vcreate_v_i64m2x3 (vint64m2_t v0, vint64m2_t v1, vint64m2_t v2) +{ + return __riscv_vcreate_v_i64m2x3 (v0, v1, v2); +} + +vint64m2x4_t +test_vcreate_v_i64m2x4 (vint64m2_t v0, vint64m2_t v1, vint64m2_t v2, + vint64m2_t v3) +{ + return __riscv_vcreate_v_i64m2x4 (v0, v1, v2, v3); +} + +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 7 } } */ +/* { dg-final { scan-assembler-times {v[ls]e16\.v\s+v[0-9]+,\s*0\([0-9a-x]+\)} 70 } } */ +/* { dg-final { scan-assembler-times {vl[0-9]+re[0-9]+\.v\s+v[0-9]+,\s*0\([0-9a-x]+\)} 110 } } */ +/* { dg-final { scan-assembler-times {vs[0-9]+r\.v\s+v[0-9]+,\s*0\([a-x0-9]+\)} 81 } } */