From patchwork Wed Feb 21 08:20:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 774506 Delivered-To: patch@linaro.org Received: by 2002:a5d:6ac2:0:b0:33b:4db1:f5b3 with SMTP id u2csp317701wrw; Wed, 21 Feb 2024 07:47:43 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU46pkfItSQqgCD5swH0tENpjk7oI2pb7Z1YFP3GKOzg16AfCaIaeq5qhanOL9iaqrgUoed3OBeKRCiqtJyCbe+ X-Google-Smtp-Source: AGHT+IFGWgOgzjwkzJ5j3dkB5fIyggSeBvno+UdgjHE1jJ+725Q1Wwd3c61HmUNo9jrzWNM55Gjv X-Received: by 2002:a05:6830:10d3:b0:6e4:3e21:1e2d with SMTP id z19-20020a05683010d300b006e43e211e2dmr15184034oto.8.1708530463547; Wed, 21 Feb 2024 07:47:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708530463; cv=none; d=google.com; s=arc-20160816; b=xIJHs3X24r3xl23mgg6QFJeQsGhrQOAyQJXrOMhkLp/+LTXMxhYUlZ2CXaggr9s7i2 n2b2yET+NzB4V84bU+WzfTuRwUUadq7jeKP5Y2EReMrK+gl0KRYagjuaUtniZSz8JYv9 OMNk36WM8NQTtqYXPX6SBkgbzqTKepwI0vvUIvjfIfdQbxRvAv3IOMmNOWn5P3ZMCcXt GfR2HvPcvqy66A2hqGpovBEimHMRVXXWDA42KLco+PIywVpdmFjgjIqOpcnMhQNV5zq3 VEQSfVRrSckkDSFx2wyR+GtW5iGXltt289jTGLcGY6WyApTYf3wNPBdawGsW781Sc8wG Q+SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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 :from; bh=Bh2lSzLJoz/LHEhgZUa87mR/68/1gHPiDQmjpK6qiV4=; fh=Mfp+ztHun75jr+I+HJ3gu9b5WkI1iGjp+6yuuqdwzx0=; b=u5FZ6g72N5ZIeutHPF6K5+mWoc3xuleojmlhvnkCIIDAR3Q6vGAgxxjMTcwAP3aL45 vKCKwJsOYshyvK6xK1PE34lUlp2ZtHH4Ud0sZuLT7g3TgERZfRJMIC4OpeEtXjBtjXoc r3syG6iSXCjI+T9C6dcsc86Vq7aoj78JkDVi9dCjyitST2+mwEGaHf8RdmUfqZ8MxULU djZ8FotJcQP8YiOXS1g3d1GzP4mIvc9PfYyt/t0RDjuNYe2ns/fdD/8lAu4JT3SkMyM8 21unx063OoH+U8Psp1Q++tRp5RVZEQLBa+KgwA3V6aLXQbHyjC4ITJIjitij/fxSTqKm ++dA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p1-20020ac84601000000b0042c5c7dd314si3098516qtn.272.2024.02.21.07.47.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Feb 2024 07:47:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcoa5-0005cW-Qy; Wed, 21 Feb 2024 10:32:22 -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 1rcoOq-0003nk-RI; Wed, 21 Feb 2024 10:20:44 -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 1rchu3-0002fk-Qr; Wed, 21 Feb 2024 03:24:33 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id AFBF74F3E7; Wed, 21 Feb 2024 11:21:22 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 7A626860C6; Wed, 21 Feb 2024 11:21:01 +0300 (MSK) Received: (nullmailer pid 2142112 invoked by uid 1000); Wed, 21 Feb 2024 08:20:58 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , Gustavo Romero , Peter Maydell , Michael Tokarev Subject: [Stable-8.2.2 41/60] target/arm: Fix nregs computation in do_{ld, st}_zpa Date: Wed, 21 Feb 2024 11:20:29 +0300 Message-Id: <20240221082058.2141850-41-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 296e7d1ce2..7108938251 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -4445,11 +4445,7 @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, TCGv_ptr t_pg; int desc = 0; - /* - * 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 >= 1 && mte_n <= 4); if (s->mte_active[0]) { int msz = dtype_msz(dtype); @@ -4463,6 +4459,11 @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, addr = clean_data_tbi(s, addr); } + /* + * 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 = simd_desc(vsz, vsz, zt | desc); t_pg = tcg_temp_new_ptr(); @@ -4600,7 +4601,7 @@ static void do_ld_zpa(DisasContext *s, int zt, int pg, * accessible via the instruction encoding. */ assert(fn != NULL); - do_mem_zpa(s, zt, pg, addr, dtype, nreg, false, fn); + do_mem_zpa(s, zt, pg, addr, dtype, nreg + 1, false, fn); } static bool trans_LD_zprr(DisasContext *s, arg_rprr_load *a) @@ -5168,14 +5169,13 @@ static void do_st_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, if (nreg == 0) { /* ST1 */ fn = fn_single[s->mte_active[0]][be][msz][esz]; - nreg = 1; } else { /* ST2, ST3, ST4 -- msz == esz, enforced by encoding */ assert(msz == esz); fn = fn_multiple[s->mte_active[0]][be][nreg - 1][msz]; } assert(fn != 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); } static bool trans_ST_zprr(DisasContext *s, arg_rprr_store *a)