From patchwork Thu Feb 15 17:35:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 772943 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp955428wre; Thu, 15 Feb 2024 09:41:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWTr79M3jntsBBdakxqSIXT8ru5z6sIUuMISEt+Is5hluE2V4bhhqdICCFX32gj2YhaqhOC+LsEXhfkOt7S6OdZ X-Google-Smtp-Source: AGHT+IG4txi69Mu0plvx2IepXX+HYJdeMXvsBvl/pYkuMYOPhNRDRL4vpImEYvOoVmzM8EOJPH3B X-Received: by 2002:adf:ef45:0:b0:33c:e365:dfb0 with SMTP id c5-20020adfef45000000b0033ce365dfb0mr2691118wrp.7.1708018905384; Thu, 15 Feb 2024 09:41:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708018905; cv=none; d=google.com; s=arc-20160816; b=u4w0EyB6SesO7RDepaWlTydLp5DcceULWkEbfq0SqUO3BSAe9cMl29I3cpSyMIQ2IZ mdJ30oEIw/KA9J43bzIf6uHNJTRGPtvRb6wAmPyaH9JHpdhzEB1hRLx0J2H2965mG3Ia ps4o7/yuAoSjOSOtiqrtHiEYGzNpVCs2rQxthXPDUpuPfjRAbnsBkrOr6ofxtbctkKtq yrNwdolQ95mcAozLqKLV02rZkx/PyioDXl0qbMz3xf/aERGxAw1s8PcxkY9emTlmsryK 0mplFnCcN6+VfXYLhRZjPWT3+cE7lmffvIz/9abU4OKdl6iYSjsfHIrlxTwhWDIQesa7 /DiA== 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:to:from :dkim-signature; bh=Jpuc9Tf8aoArJF/7uRkO1Qjromk4Edv2+JcubZCRIDM=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=qNAeipK8DBzP7T38xbPIac7HpNrf2O8yJo3cfI7VgsJRjl+5DUY9Xh1KxgCDb7LMOh Hny1u+ZomjiP0jHl+kYKfZ2j7J1CQnRlWWD9hZceGHrqraRPy/Km4CZmCBxn8Li4/u5O QbZdG7FUoAiLqYQINFxx5XUBTtWcOfErdLbTppTMEby7sGrLRgVVkHspSGqe0Ij70gbh u+Nm9mDu7DgwZHS0uV6mRIp13tocr+FjUIVcXs/oNd053Rz8YfPiuIwZ723fvU51I6qW KTycSZSkerqVL46CPYs0fSse57vNQqrrQWoDxGNu7qBlhjBPoyIgJRUT09A8G1r7Lj0y k5YQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mQmGyjVt; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h11-20020a05600016cb00b0033d140ad357si319336wrf.94.2024.02.15.09.41.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2024 09:41:45 -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; dkim=pass header.i=@linaro.org header.s=google header.b=mQmGyjVt; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raffD-0001g7-7R; Thu, 15 Feb 2024 12:36:47 -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 1rafeD-0007v0-PP for qemu-devel@nongnu.org; Thu, 15 Feb 2024 12:35:45 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rafeB-0003tz-Ju for qemu-devel@nongnu.org; Thu, 15 Feb 2024 12:35:45 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40fd2f7ef55so13027525e9.0 for ; Thu, 15 Feb 2024 09:35:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708018541; x=1708623341; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Jpuc9Tf8aoArJF/7uRkO1Qjromk4Edv2+JcubZCRIDM=; b=mQmGyjVtPUC98AzeepiSJUWmNQNOMizMN9X4nxaL6zuiQl8kHMDHX4YFzx6slHcftW pU10uyFe0z9gw+b2kPYwZYAGS3TqF2Cmjsq8rCV/r92Siaq8lJqHQvMBAwCdevIV8FKP 8vyumOcUYYx8weE4fj8TyGSvdaG6nznamplSQQ6mWELKAEgBNm2iJZOJ8KavJX6JH2m9 XFpy2/35mm68yFVmbUqlJbBTsfZTyhfURPbJvcltXaqgWzFnonO9zMLFegQ/j63rjv8S ua1fVouwkBKBaFJjJ/tOc5nzHjfCaHaaUH4FMSk923vjV/dSPaSqhnpi9ogTmdAM/De0 cdQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708018541; x=1708623341; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jpuc9Tf8aoArJF/7uRkO1Qjromk4Edv2+JcubZCRIDM=; b=rc/7Qxw59tVJ0ye+OLzYfDa0OyIJqPvqjND0ngyq1RJSWKGj6NeuivZ+lq9M+xoKUK B6EGZt9kQXLXA6qzRaCprjvnpod5cN1N4OEnCp8kRz6jcenMf9SofenTIv65TaiEWbYu 0j02G2MazLqnrXY0MeHf4C8XjTpLdnrvWQ4S8xe+gAjlPxpS8Q+XcXzEt4Sub8KRMLTp lZDdfDRlIHU5xfbg5/3LSnsfcsS+GmxgYPd/nXGsQq85ROr1dkBsCmV5C/TrdLKKjs8S ruwrWFNapcqt7zBhmC6YytxERa9JQQNSzudM/CFP2tQHRk59RbD/X+3ax7CqUvoFqDHv idDQ== X-Gm-Message-State: AOJu0YyIIR1VrNu9MFCP2JLofaUpiuuQu1H2oCQyiOf66n397unG5rvr 8anMhiRjVMpAIy6nXbV8A3edmpM6vvuPQ8lSBzYtr0tk4ViYQnr0cQ8IW8lah0jouyvaPRgAo4M X X-Received: by 2002:a05:6000:69c:b0:33a:f503:30b3 with SMTP id bo28-20020a056000069c00b0033af50330b3mr3505909wrb.24.1708018541049; Thu, 15 Feb 2024 09:35:41 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q16-20020adfea10000000b0033cfa00e497sm2384129wrm.64.2024.02.15.09.35.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 09:35:40 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/35] target/arm: Fix nregs computation in do_{ld,st}_zpa Date: Thu, 15 Feb 2024 17:35:06 +0000 Message-Id: <20240215173538.2430599-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215173538.2430599-1-peter.maydell@linaro.org> References: <20240215173538.2430599-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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 --- target/arm/tcg/translate-sve.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 296e7d1ce22..7108938251e 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)