From nobody Tue Feb 10 03:16:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=git.sr.ht Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1648005281603657.0977633141205; Tue, 22 Mar 2022 20:14:41 -0700 (PDT) Received: from localhost ([::1]:33296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWrSK-0002oU-AZ for importer@patchew.org; Tue, 22 Mar 2022 23:14:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWrMq-0002fD-35; Tue, 22 Mar 2022 23:09:00 -0400 Received: from mail-b.sr.ht ([173.195.146.151]:36424) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWrMo-00039n-Ls; Tue, 22 Mar 2022 23:08:59 -0400 Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id 00E9211F103; Wed, 23 Mar 2022 03:08:53 +0000 (UTC) Authentication-Results: mail-b.sr.ht; dkim=none From: ~eopxd Date: Mon, 07 Mar 2022 04:21:37 -0800 Subject: [PATCH qemu v2 11/13] target/riscv: rvv: Add tail agnostic for vector reduction instructions Message-ID: <164800493107.31817.14053311036718644936-11@git.sr.ht> X-Mailer: git.sr.ht In-Reply-To: <164800493107.31817.14053311036718644936-0@git.sr.ht> To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=173.195.146.151; envelope-from=outgoing@sr.ht; helo=mail-b.sr.ht X-Spam_score_int: 36 X-Spam_score: 3.6 X-Spam_bar: +++ X-Spam_report: (3.6 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, FREEMAIL_FORGED_REPLYTO=2.095, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ~eopxd Cc: WeiWei Li , Frank Chang , eop Chen , Bin Meng , Alistair Francis , Palmer Dabbelt Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1648005282643100001 From: eopXD Signed-off-by: eop Chen Reviewed-by: Frank Chang --- target/riscv/vector_helper.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 697c74e8cc..2a8ecf40f5 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -4543,6 +4543,9 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, = \ { \ uint32_t vm =3D vext_vm(desc); \ uint32_t vl =3D env->vl; \ + uint32_t esz =3D sizeof(TD); \ + uint32_t vlenb =3D env_archcpu(env)->cfg.vlen >> 3; \ + uint32_t vta =3D vext_vta(desc); \ uint32_t i; \ TD s1 =3D *((TD *)vs1 + HD(0)); \ \ @@ -4555,6 +4558,9 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1, = \ } \ *((TD *)vd + HD(0)) =3D s1; \ env->vstart =3D 0; \ + /* set tail elements to 1s */ \ + vext_set_elems_1s_fns[ctzl(esz)](vd, vta, 1, esz, \ + vlenb); \ } =20 /* vd[0] =3D sum(vs1[0], vs2[*]) */ @@ -4660,6 +4666,9 @@ void HELPER(vfwredsum_vs_h)(void *vd, void *v0, void = *vs1, { uint32_t vm =3D vext_vm(desc); uint32_t vl =3D env->vl; + uint32_t esz =3D sizeof(uint32_t); + uint32_t vlenb =3D env_archcpu(env)->cfg.vlen >> 3; + uint32_t vta =3D vext_vta(desc); uint32_t i; uint32_t s1 =3D *((uint32_t *)vs1 + H4(0)); =20 @@ -4673,6 +4682,8 @@ void HELPER(vfwredsum_vs_h)(void *vd, void *v0, void = *vs1, } *((uint32_t *)vd + H4(0)) =3D s1; env->vstart =3D 0; + /* set tail elements to 1s */ + vext_set_elems_1s_fns[ctzl(esz)](vd, vta, 1, esz, vlenb); } =20 void HELPER(vfwredsum_vs_w)(void *vd, void *v0, void *vs1, @@ -4680,6 +4691,9 @@ void HELPER(vfwredsum_vs_w)(void *vd, void *v0, void = *vs1, { uint32_t vm =3D vext_vm(desc); uint32_t vl =3D env->vl; + uint32_t esz =3D sizeof(uint64_t); + uint32_t vlenb =3D env_archcpu(env)->cfg.vlen >> 3; + uint32_t vta =3D vext_vta(desc); uint32_t i; uint64_t s1 =3D *((uint64_t *)vs1); =20 @@ -4693,6 +4707,8 @@ void HELPER(vfwredsum_vs_w)(void *vd, void *v0, void = *vs1, } *((uint64_t *)vd) =3D s1; env->vstart =3D 0; + /* set tail elements to 1s */ + vext_set_elems_1s_fns[ctzl(esz)](vd, vta, 1, esz, vlenb); } =20 /* --=20 2.34.1