From nobody Tue Nov 26 11:48:04 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17085521735364.39095959244878; Wed, 21 Feb 2024 13:49:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcuSk-00076p-Ip; Wed, 21 Feb 2024 16:49:10 -0500 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 1rcuSi-0006y5-0g; Wed, 21 Feb 2024 16:49:08 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcuSg-0007Xf-5X; Wed, 21 Feb 2024 16:49:07 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 539A74F870; Thu, 22 Feb 2024 00:47:47 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id F0F16869F1; Thu, 22 Feb 2024 00:47:24 +0300 (MSK) Received: (nullmailer pid 2339883 invoked by uid 1000); Wed, 21 Feb 2024 21:47:23 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , Gustavo Romero , Peter Maydell , Michael Tokarev Subject: [Stable-7.2.10 20/33] target/arm: Fix nregs computation in do_{ld, st}_zpa Date: Thu, 22 Feb 2024 00:47:03 +0300 Message-Id: <20240221214723.2339742-20-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1708552174837100001 Content-Type: text/plain; charset="utf-8" From: Richard Henderson The field is encoded as [0-3], which is convenient for indexing our array of function pointers, but the true value is [1-4]. Adjust before calling do_mem_zpa. Add an assert, and move the comment re passing ZT to the helper back next to the relevant code. Cc: qemu-stable@nongnu.org Fixes: 206adacfb8d ("target/arm: Add mte helpers for sve scalar + int loads= ") Signed-off-by: Richard Henderson Tested-by: Gustavo Romero Message-id: 20240207025210.8837-3-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell (cherry picked from commit 64c6e7444dff64b42d11b836b9aec9acfbe8ecc2) Signed-off-by: Michael Tokarev diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 621a2abb22..7388e1dbc7 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4587,11 +4587,7 @@ static void do_mem_zpa(DisasContext *s, int zt, int = pg, TCGv_i64 addr, TCGv_ptr t_pg; int desc =3D 0; =20 - /* - * For e.g. LD4, there are not enough arguments to pass all 4 - * registers as pointers, so encode the regno into the data field. - * For consistency, do this even for LD1. - */ + assert(mte_n >=3D 1 && mte_n <=3D 4); if (s->mte_active[0]) { int msz =3D dtype_msz(dtype); =20 @@ -4605,6 +4601,11 @@ static void do_mem_zpa(DisasContext *s, int zt, int = pg, TCGv_i64 addr, addr =3D clean_data_tbi(s, addr); } =20 + /* + * For e.g. LD4, there are not enough arguments to pass all 4 + * registers as pointers, so encode the regno into the data field. + * For consistency, do this even for LD1. + */ desc =3D simd_desc(vsz, vsz, zt | desc); t_pg =3D tcg_temp_new_ptr(); =20 @@ -4744,7 +4745,7 @@ static void do_ld_zpa(DisasContext *s, int zt, int pg, * accessible via the instruction encoding. */ assert(fn !=3D NULL); - do_mem_zpa(s, zt, pg, addr, dtype, nreg, false, fn); + do_mem_zpa(s, zt, pg, addr, dtype, nreg + 1, false, fn); } =20 static bool trans_LD_zprr(DisasContext *s, arg_rprr_load *a) @@ -5320,14 +5321,13 @@ static void do_st_zpa(DisasContext *s, int zt, int = pg, TCGv_i64 addr, if (nreg =3D=3D 0) { /* ST1 */ fn =3D fn_single[s->mte_active[0]][be][msz][esz]; - nreg =3D 1; } else { /* ST2, ST3, ST4 -- msz =3D=3D esz, enforced by encoding */ assert(msz =3D=3D esz); fn =3D fn_multiple[s->mte_active[0]][be][nreg - 1][msz]; } assert(fn !=3D NULL); - do_mem_zpa(s, zt, pg, addr, msz_dtype(s, msz), nreg, true, fn); + do_mem_zpa(s, zt, pg, addr, msz_dtype(s, msz), nreg + 1, true, fn); } =20 static bool trans_ST_zprr(DisasContext *s, arg_rprr_store *a) --=20 2.39.2