From nobody Mon Sep 16 19:04:35 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.alibaba.com ARC-Seal: i=1; a=rsa-sha256; t=1712908156; cv=none; d=zohomail.com; s=zohoarc; b=fLcJ2v84mQyG/bOTQFGrC92+3D/2fxTN3jVYPiDpn2rVxDgiCz7OyuMVf7+zAp0wyKrsoK9Whx1FuD4SDnr8UBymhyOIXB3d8XDm1tYsva2Ggxc1qbqOxilqwxyzHA3WY87PpG0k7oowzty+wdnoxEsITlXDt/wzosnYX9SuVv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712908155; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TPNW4bmOn9CGG7L/DlfyVOtIHAJR8iGvrg4tz/S9gjQ=; b=KtYdv7Xtc7u7K2WL43VySq/EJTeRxU/NtZ+ZtTUs4+//FMrDOEMxWHMVAVtXJzCnZNmpK2H57YasBcuJfVTR9jU+Kno1mRSZoHGmNbyorZVPayLRKsXczOGlJyhrncJTqQjLYpAEOOU6BHAeH+dP/q6KuPP6Zlm2gVU3KaxM45Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1712908155966371.7453494103737; Fri, 12 Apr 2024 00:49:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rvBeK-0004OW-S3; Fri, 12 Apr 2024 03:48:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rvBeH-0004Nq-MO; Fri, 12 Apr 2024 03:48:37 -0400 Received: from out30-110.freemail.mail.aliyun.com ([115.124.30.110]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rvBeF-0001Je-It; Fri, 12 Apr 2024 03:48:37 -0400 Received: from localhost.localdomain(mailfrom:eric.huang@linux.alibaba.com fp:SMTPD_---0W4Nbehz_1712908107) by smtp.aliyun-inc.com; Fri, 12 Apr 2024 15:48:28 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1712908109; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=TPNW4bmOn9CGG7L/DlfyVOtIHAJR8iGvrg4tz/S9gjQ=; b=qQqTP8myMhEjkFfzxjMl5hqHKTrI4W60uh44/aYcvD5yRub1hpVQadkVcjI1YnswOdOqzaBb7WtN0PgDYr22mYN4gGs0gPkGOHrby3u20DZDXmTBahOr6s1nWQXh6/Vsrxuw8JK0niddujdbUj8fPwfZcm8cdGafxeP7TE7j1iI= X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R421e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=ay29a033018045168; MF=eric.huang@linux.alibaba.com; NM=1; PH=DS; RN=9; SR=0; TI=SMTPD_---0W4Nbehz_1712908107; From: Huang Tao To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, zhiwei_liu@linux.alibaba.com, dbarboza@ventanamicro.com, liwei1518@gmail.com, bin.meng@windriver.com, alistair.francis@wdc.com, palmer@dabbelt.com, Huang Tao Subject: [PATCH 05/65] target/riscv: Add mlen in DisasContext Date: Fri, 12 Apr 2024 15:36:35 +0800 Message-ID: <20240412073735.76413-6-eric.huang@linux.alibaba.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240412073735.76413-1-eric.huang@linux.alibaba.com> References: <20240412073735.76413-1-eric.huang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=115.124.30.110; envelope-from=eric.huang@linux.alibaba.com; helo=out30-110.freemail.mail.aliyun.com X-Spam_score_int: -174 X-Spam_score: -17.5 X-Spam_bar: ----------------- X-Spam_report: (-17.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linux.alibaba.com) X-ZM-MESSAGEID: 1712908158299100003 Content-Type: text/plain; charset="utf-8" The mask register layout of XTheadVector is different from that of RVV1.0. For RVV1.0, the mask bits for element i are located in bit[i] of the mask register. While for XTheadVector, the mask bits for element i are located bit[MLEN*i] of the mask register. (MLEN =3D SEW/LMUL) So we add mlen in DisasContext to indicate the mask bit and reduce the calculation of mlen. Signed-off-by: Huang Tao --- target/riscv/translate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 7eb8c9cd31..a22fdb59df 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -106,6 +106,7 @@ typedef struct DisasContext { bool cfg_vta_all_1s; bool vstart_eq_zero; bool vl_eq_vlmax; + uint16_t mlen; CPUState *cs; TCGv zero; /* PointerMasking extension */ @@ -1207,6 +1208,9 @@ static void riscv_tr_init_disas_context(DisasContextB= ase *dcbase, CPUState *cs) ctx->zero =3D tcg_constant_tl(0); ctx->virt_inst_excp =3D false; ctx->decoders =3D cpu->decoders; + if (cpu->cfg.ext_xtheadvector) { + ctx->mlen =3D 1 << (ctx->sew + 3 - ctx->lmul); + } } =20 static void riscv_tr_tb_start(DisasContextBase *db, CPUState *cpu) --=20 2.44.0