From nobody Wed Nov 5 07:32:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533786166009138.59195307599566; Wed, 8 Aug 2018 20:42:46 -0700 (PDT) Received: from localhost ([::1]:46386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbqU-0007nG-2e for importer@patchew.org; Wed, 08 Aug 2018 23:42:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnboW-0006cV-Rm for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnboU-00036o-Py for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:40 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:45338) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnboU-00036O-KL for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:38 -0400 Received: by mail-pg1-x534.google.com with SMTP id f1-v6so2050391pgq.12 for ; Wed, 08 Aug 2018 20:40:38 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id q78-v6sm9674103pfi.185.2018.08.08.20.40.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 20:40:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YSoeF2aE+oX9NLe7usU1W4prHsjidxEZPouM9Vbh4CE=; b=jZcFL9yyYBJe1R7SKfwanrl9TUbsPve0dKGdTpmHpr+ZbIf8wIl5MbTYtN6wnMs2ls ENbxwJSt+aGiqZTbnlfUmCVclZ9Vkbnb8jBWP+gYjgs6iA8Nw5J5nvmRMlwz3eRM+RQN abAd+RBKvNid4dkFIw+HcQahYRWLDblPpdxag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YSoeF2aE+oX9NLe7usU1W4prHsjidxEZPouM9Vbh4CE=; b=Zqk+JW7CUaM3Yi/oHGccYfQA8GaxnBlM4Ute+oJfNcZCKrotZwNJNaBJRuMebYKkao cvED7bWQCUHR1bZ8abRTsWyVvTOw+VhqZCvwtDHr0FHB1ZghluG7vZiaJJdZLFKSrBdg c5gVCUUFByI/AlD618ub38psEfQ7/wiCNnuOaPx+5dVilG0WpQ8vVDDG/iBbde5aUvwq Ox1St+jBmGSZwStTiqvoTiIL2esN6OdakutWm14VzAoUZaiqWjqzvnQBHx8BPkwf1QtL waGdnBiWgpv6ic5yY+NUr5cPYbur6PyTCRLlWodN/Jp1ikLXxJz1iODiwzpwgfD2Odlu xfPQ== X-Gm-Message-State: AOUpUlHOLICxf8HlKzE5Adc7l5yyngfiu0jBx0A7liHESB6sqXerfnw1 AeALZBoCw0bR3gbB5HfPJOEsjfuzvi0= X-Google-Smtp-Source: AA+uWPx33uhvobCCZJdes/6dBECMdWsyyfMHV0KbceNgALlAgDFQ1+6Lc0N6AuboWF6kWbOzqwcw5Q== X-Received: by 2002:a63:1015:: with SMTP id f21-v6mr423279pgl.354.1533786037338; Wed, 08 Aug 2018 20:40:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:40:23 -0700 Message-Id: <20180809034033.10579-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809034033.10579-1-richard.henderson@linaro.org> References: <20180809034033.10579-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::534 Subject: [Qemu-devel] [PATCH 01/11] target/arm: Fix sign of sve_cmpeq_ppzw/sve_cmpne_ppzw X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 The normal vector element is sign-extended before comparing with the wide vector element. Cc: qemu-stable@nongnu.org (3.0.1) Tested-by: Laurent Desnogues Reviewed-by: Laurent Desnogues Reviewed-by: Alex Benn=C3=A9e Reported-by: Laurent Desnogues Signed-off-by: Richard Henderson --- target/arm/sve_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 54795c9194..9bd0694d55 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -2436,13 +2436,13 @@ uint32_t HELPER(NAME)(void *vd, void *vn, void *vm,= void *vg, uint32_t desc) \ #define DO_CMP_PPZW_S(NAME, TYPE, TYPEW, OP) \ DO_CMP_PPZW(NAME, TYPE, TYPEW, OP, H1_4, 0x1111111111111111ull) =20 -DO_CMP_PPZW_B(sve_cmpeq_ppzw_b, uint8_t, uint64_t, =3D=3D) -DO_CMP_PPZW_H(sve_cmpeq_ppzw_h, uint16_t, uint64_t, =3D=3D) -DO_CMP_PPZW_S(sve_cmpeq_ppzw_s, uint32_t, uint64_t, =3D=3D) +DO_CMP_PPZW_B(sve_cmpeq_ppzw_b, int8_t, uint64_t, =3D=3D) +DO_CMP_PPZW_H(sve_cmpeq_ppzw_h, int16_t, uint64_t, =3D=3D) +DO_CMP_PPZW_S(sve_cmpeq_ppzw_s, int32_t, uint64_t, =3D=3D) =20 -DO_CMP_PPZW_B(sve_cmpne_ppzw_b, uint8_t, uint64_t, !=3D) -DO_CMP_PPZW_H(sve_cmpne_ppzw_h, uint16_t, uint64_t, !=3D) -DO_CMP_PPZW_S(sve_cmpne_ppzw_s, uint32_t, uint64_t, !=3D) +DO_CMP_PPZW_B(sve_cmpne_ppzw_b, int8_t, uint64_t, !=3D) +DO_CMP_PPZW_H(sve_cmpne_ppzw_h, int16_t, uint64_t, !=3D) +DO_CMP_PPZW_S(sve_cmpne_ppzw_s, int32_t, uint64_t, !=3D) =20 DO_CMP_PPZW_B(sve_cmpgt_ppzw_b, int8_t, int64_t, >) DO_CMP_PPZW_H(sve_cmpgt_ppzw_h, int16_t, int64_t, >) --=20 2.17.1 From nobody Wed Nov 5 07:32:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533786333307365.13138909298607; Wed, 8 Aug 2018 20:45:33 -0700 (PDT) Received: from localhost ([::1]:46401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbtE-0001d0-4F for importer@patchew.org; Wed, 08 Aug 2018 23:45:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnboX-0006cc-8n for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnboW-00037c-Au for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:41 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:42845) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnboW-000377-53 for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:40 -0400 Received: by mail-pf1-x442.google.com with SMTP id l9-v6so2140248pff.9 for ; Wed, 08 Aug 2018 20:40:40 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id q78-v6sm9674103pfi.185.2018.08.08.20.40.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 20:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oB1SIrg6peK9wa8OQjaurgO0tZQqjrg+qYqLcGUVKpM=; b=TWMWneuIS22PxQFFimw4cF/L9iQfbyHI3I82kbq5TbpR1KMd4hiZTanXM5FKBUfCsh XGnbA5XM792IXiOUofL9KrssjttSfELhu6NiEj5psKRygP0ZUkp0gEeR1sK36vJiFkot KsGi3ISb/CK/5sgtZGgeEO7i+uW5Z2g+I6z6M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oB1SIrg6peK9wa8OQjaurgO0tZQqjrg+qYqLcGUVKpM=; b=Hl2dYwHd+lWZhZe9DCWxI+q2Z8LI85G7i/UI2xKk0IBPP/I5tys2NbUJtkc4ePoGW8 3Kw1cHyeY4gruOmJvM3C1jc/kGQvnQiVKHGLrDBxUMnjQ4pXepAANn62c/VSJ2iYiq81 n46g5yCV5P6IX0sHzFcILTnxJpd6L+Mda0pQAHvZinPAaoxwCO5mBrPSO+scBy/cuba8 sxA5ds5vpwqmL/FWNm6j71XatsvBOpDRxCHn3sRwHbvVKlkIu06N9XmsJv3+yGB7/6cS 9x6R9EZ+OVmir3+3k5SAwYSkgXVatam799j62tETXAY+FLb0ubda0h2hV3pHNb55qlmP PsNQ== X-Gm-Message-State: AOUpUlGmQ8tbHA1XOAR/mrjid8vUuzOweq2exq8igeroi22Qrg2lQQmO s3vRm+83q5OwxeLpmT6vMImcUUxxNOQ= X-Google-Smtp-Source: AA+uWPylwvZtLBbgae/MsONTDwUnQxKwkxE5MyAqQlBXieo5+ONYzOrX1DIlZ5qX/w6OaBaOo7dz4Q== X-Received: by 2002:a63:2106:: with SMTP id h6-v6mr402169pgh.161.1533786038783; Wed, 08 Aug 2018 20:40:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:40:24 -0700 Message-Id: <20180809034033.10579-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809034033.10579-1-richard.henderson@linaro.org> References: <20180809034033.10579-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH 02/11] target/arm: Fix typo in do_sat_addsub_64 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Used the wrong temporary in the computation of subtractive overflow. Cc: qemu-stable@nongnu.org (3.0.1) Tested-by: Laurent Desnogues Reviewed-by: Laurent Desnogues Reported-by: Laurent Desnogues Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/arm/translate-sve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 374051cd20..9dd4c38bab 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -1625,7 +1625,7 @@ static void do_sat_addsub_64(TCGv_i64 reg, TCGv_i64 v= al, bool u, bool d) /* Detect signed overflow for subtraction. */ tcg_gen_xor_i64(t0, reg, val); tcg_gen_sub_i64(t1, reg, val); - tcg_gen_xor_i64(reg, reg, t0); + tcg_gen_xor_i64(reg, reg, t1); tcg_gen_and_i64(t0, t0, reg); =20 /* Bound the result. */ --=20 2.17.1 From nobody Wed Nov 5 07:32:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533786360077215.79086528074333; Wed, 8 Aug 2018 20:46:00 -0700 (PDT) Received: from localhost ([::1]:46408 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbte-00027G-R2 for importer@patchew.org; Wed, 08 Aug 2018 23:45:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnboZ-0006dK-1V for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnboX-00038r-Oa for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:43 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:37242) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnboX-00038G-HU for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:41 -0400 Received: by mail-pg1-x544.google.com with SMTP id n7-v6so2068803pgq.4 for ; Wed, 08 Aug 2018 20:40:41 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id q78-v6sm9674103pfi.185.2018.08.08.20.40.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 20:40:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ablu58t752cnKdeomCa6I+Hum7D6ukONMk815MNMlCI=; b=Lrh8BGuolsMa5CTx9cdrZuYOYh5HPv+hp0rP/BJ7Szkfv827MktLS5Y3j5xcfjCghM oHaGa2vdHtM9eTpsyeF/eX9xbDngFdBRzipTgkOaOFFSS3hVJjV//xe7R5TfKACHzgrp rOwIME7O5yOprBYkiIZRmS3aczHXDIICGEYz0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ablu58t752cnKdeomCa6I+Hum7D6ukONMk815MNMlCI=; b=ET1AjdJa0E6D+Au2UODpOB98AwIIRSjDOzZn51uU8++Ie6UuTVhhBPtiFg4vZAvIHl FPsr7VVa/VNDUKzWONifbWrXqyU42zO9dnYauZ+PhToZTAQPF99omwqXqtORJhQAE6Oy C4DNGlkjpH0TkQTbBQL6S/6CqMffdK8GDzhfDs6vdm6dwL19cCNsms0YyyF0E1fira7d ajiDGLMNEC6WkWlPKftkkgjFpODzuDg1r4saRzPVk/SyN29qje6R6Pa+g0mCLWHqpV2V A9Zw/toFXtKRgxDgUw2UTZVPFcAvbqFW8vlp5Q8OZaAGRsNq3g/gjTdCqoRknIVm8FBu B5mw== X-Gm-Message-State: AOUpUlHxTSEyiVp1cyTTmhgnly/rSu7WiMyI/PmY3eNGx+Y3NGp0TsUO 83gvtsp9qLgf+gCuuQ89wy0zfw6IgVU= X-Google-Smtp-Source: AA+uWPxckG3QOsLsWX7emWmvlfvercNhHe5SzAx7Yq2zmI4ZGQLvXZ+e51aadxZpczfRXE2DEbeEJw== X-Received: by 2002:a63:ea49:: with SMTP id l9-v6mr390827pgk.427.1533786040197; Wed, 08 Aug 2018 20:40:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:40:25 -0700 Message-Id: <20180809034033.10579-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809034033.10579-1-richard.henderson@linaro.org> References: <20180809034033.10579-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH 03/11] target/arm: Reorganize SVE WHILE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The pseudocode for this operation is an increment + compare loop, so comparing <=3D the maximum integer produces an all-true predicate. Rather than bound in both the inline code and the helper, pass the helper the number of predicate bits to set instead of the number of predicate elements to set. Cc: qemu-stable@nongnu.org (3.0.1) Tested-by: Laurent Desnogues Reviewed-by: Laurent Desnogues Reported-by: Laurent Desnogues Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/arm/sve_helper.c | 5 ---- target/arm/translate-sve.c | 49 +++++++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 9bd0694d55..87594a8adb 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -2846,11 +2846,6 @@ uint32_t HELPER(sve_while)(void *vd, uint32_t count,= uint32_t pred_desc) return flags; } =20 - /* Scale from predicate element count to bits. */ - count <<=3D esz; - /* Bound to the bits in the predicate. */ - count =3D MIN(count, oprsz * 8); - /* Set all of the requested bits. */ for (i =3D 0; i < count / 64; ++i) { d->p[i] =3D esz_mask; diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 9dd4c38bab..89efc80ee7 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -3173,19 +3173,19 @@ static bool trans_CTERM(DisasContext *s, arg_CTERM = *a, uint32_t insn) =20 static bool trans_WHILE(DisasContext *s, arg_WHILE *a, uint32_t insn) { - if (!sve_access_check(s)) { - return true; - } - - TCGv_i64 op0 =3D read_cpu_reg(s, a->rn, 1); - TCGv_i64 op1 =3D read_cpu_reg(s, a->rm, 1); - TCGv_i64 t0 =3D tcg_temp_new_i64(); - TCGv_i64 t1 =3D tcg_temp_new_i64(); + TCGv_i64 op0, op1, t0, t1, tmax; TCGv_i32 t2, t3; TCGv_ptr ptr; unsigned desc, vsz =3D vec_full_reg_size(s); TCGCond cond; =20 + if (!sve_access_check(s)) { + return true; + } + + op0 =3D read_cpu_reg(s, a->rn, 1); + op1 =3D read_cpu_reg(s, a->rm, 1); + if (!a->sf) { if (a->u) { tcg_gen_ext32u_i64(op0, op0); @@ -3198,32 +3198,47 @@ static bool trans_WHILE(DisasContext *s, arg_WHILE = *a, uint32_t insn) =20 /* For the helper, compress the different conditions into a computation * of how many iterations for which the condition is true. - * - * This is slightly complicated by 0 <=3D UINT64_MAX, which is nominal= ly - * 2**64 iterations, overflowing to 0. Of course, predicate registers - * aren't that large, so any value >=3D predicate size is sufficient. */ + t0 =3D tcg_temp_new_i64(); + t1 =3D tcg_temp_new_i64(); tcg_gen_sub_i64(t0, op1, op0); =20 - /* t0 =3D MIN(op1 - op0, vsz). */ - tcg_gen_movi_i64(t1, vsz); - tcg_gen_umin_i64(t0, t0, t1); + tmax =3D tcg_const_i64(vsz >> a->esz); if (a->eq) { /* Equality means one more iteration. */ tcg_gen_addi_i64(t0, t0, 1); + + /* If op1 is max (un)signed integer (and the only time the addition + * above could overflow), then we produce an all-true predicate by + * setting the count to the vector length. This is because the + * pseudocode is described as an increment + compare loop, and the + * max integer would always compare true. + */ + tcg_gen_movi_i64(t1, (a->sf + ? (a->u ? UINT64_MAX : INT64_MAX) + : (a->u ? UINT32_MAX : INT32_MAX))); + tcg_gen_movcond_i64(TCG_COND_EQ, t0, op1, t1, tmax, t0); } =20 - /* t0 =3D (condition true ? t0 : 0). */ + /* Bound to the maximum. */ + tcg_gen_umin_i64(t0, t0, tmax); + tcg_temp_free_i64(tmax); + + /* Set the count to zero if the condition is false. */ cond =3D (a->u ? (a->eq ? TCG_COND_LEU : TCG_COND_LTU) : (a->eq ? TCG_COND_LE : TCG_COND_LT)); tcg_gen_movi_i64(t1, 0); tcg_gen_movcond_i64(cond, t0, op0, op1, t0, t1); + tcg_temp_free_i64(t1); =20 + /* Since we're bounded, pass as a 32-bit type. */ t2 =3D tcg_temp_new_i32(); tcg_gen_extrl_i64_i32(t2, t0); tcg_temp_free_i64(t0); - tcg_temp_free_i64(t1); + + /* Scale elements to bits. */ + tcg_gen_shli_i32(t2, t2, a->esz); =20 desc =3D (vsz / 8) - 2; desc =3D deposit32(desc, SIMD_DATA_SHIFT, 2, a->esz); --=20 2.17.1 From nobody Wed Nov 5 07:32:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533786498068444.33281231941555; Wed, 8 Aug 2018 20:48:18 -0700 (PDT) Received: from localhost ([::1]:46422 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbvt-0004gd-2v for importer@patchew.org; Wed, 08 Aug 2018 23:48:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnboZ-0006dy-QR for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnboY-00039p-WD for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:43 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:35858) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnboY-000398-QP for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:42 -0400 Received: by mail-pg1-x52f.google.com with SMTP id h12-v6so2073615pgs.3 for ; Wed, 08 Aug 2018 20:40:42 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id q78-v6sm9674103pfi.185.2018.08.08.20.40.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 20:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qR6U/BTO+a4k2WnIzfIot/cfXtAcIXt0pK5MsJgp23M=; b=I6edYR4Mj3DDkDl6+qpEALu31GWZRT2xLHqtkpdl8ex1/anXsTIINPBc5Bpq3WsZ3y WVygAej7G92hPx+P4XHbxJhGXEXDJ77Q/UR4b6ZeMS9f20ZFnhtezkItEzkCGTRtbILU m+CmYgYrRF+fX1TlNDBAZZWejdtPFK23Ibskc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qR6U/BTO+a4k2WnIzfIot/cfXtAcIXt0pK5MsJgp23M=; b=BcAJoqFTz7cDwDslJC/HZfIoTFeBpIRDcVc4KjNvGL/6cnOV2vjSo2BN3kVRiTr2yy 7Ph/6Q/MtME5zuT/vpnXDFoJbsYgke2zyKdWkrZjv7k/2NCdMFLxYuz2mcXMJIc4yusE ZMgMQBaoqpGG9G9/rLw69oTbG36eg+1h/nuxdZiLrLYMHQjQ/tETldcxIMEkbttIstCX e8sSA4+/hBSNi5l6DvbzxdDrr76/AAAM07V3xw3kv3M62jedV15sLR5YF0CP6BiTeJOU mpb5vFv4caSFVPfgrdJ0ZJmoGwP2HoHs0oJLvAjgZt8IhvW22Xdr7R5Vpl/UZPhTqLJh 9XGg== X-Gm-Message-State: AOUpUlHXCDmA2momvQnrNnVXYJ0MbI/Cr3WlEyU0rgaFCWjccEo6J03V +DO2wtmV6mQ5f7Ws4FakcwR2T/iio8Y= X-Google-Smtp-Source: AA+uWPzOw7aDmtD/n4sme4IVvLap97UWC/AXh/k8NgmNUPYzW6CrHQW+ZpN1GovStH3sAx/uqh2hAA== X-Received: by 2002:a63:735d:: with SMTP id d29-v6mr435157pgn.156.1533786041528; Wed, 08 Aug 2018 20:40:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:40:26 -0700 Message-Id: <20180809034033.10579-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809034033.10579-1-richard.henderson@linaro.org> References: <20180809034033.10579-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52f Subject: [Qemu-devel] [PATCH 04/11] target/arm: Fix typo in helper_sve_movz_d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Cc: qemu-stable@nongnu.org (3.0.1) Tested-by: Laurent Desnogues Reviewed-by: Laurent Desnogues Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reported-by: Laurent Desnogues Signed-off-by: Richard Henderson --- target/arm/sve_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 87594a8adb..c3cbec9cf5 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -1042,7 +1042,7 @@ void HELPER(sve_movz_d)(void *vd, void *vn, void *vg,= uint32_t desc) uint64_t *d =3D vd, *n =3D vn; uint8_t *pg =3D vg; for (i =3D 0; i < opr_sz; i +=3D 1) { - d[i] =3D n[1] & -(uint64_t)(pg[H1(i)] & 1); + d[i] =3D n[i] & -(uint64_t)(pg[H1(i)] & 1); } } =20 --=20 2.17.1 From nobody Wed Nov 5 07:32:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153378618981336.6021032410448; Wed, 8 Aug 2018 20:43:09 -0700 (PDT) Received: from localhost ([::1]:46389 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbqu-0008Az-LA for importer@patchew.org; Wed, 08 Aug 2018 23:43:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnboa-0006fh-Ve for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnboa-0003Am-9x for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:45 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:35859) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnboa-0003AI-4i for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:44 -0400 Received: by mail-pg1-x530.google.com with SMTP id h12-v6so2073640pgs.3 for ; Wed, 08 Aug 2018 20:40:44 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id q78-v6sm9674103pfi.185.2018.08.08.20.40.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 20:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kEZMUYaytNPYVnvdmUwTXFQcXwltXvxGgn6PoSnchC8=; b=dGBhcnR4fUFU8cxsF9yxQm4tr/q+CVawmegu4bNLpJaE98YFsIixo5VjdEfnsDteqP I67v2jqj+Re+vhq9SL4Gw/xk//GT8B33Grs9GdXnWKi0UJ4qx9I/rLw6yNxleL9KgHLU gezh4p2x02tMvDZWytRYK/SvS6q8zGQ8WBN08= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kEZMUYaytNPYVnvdmUwTXFQcXwltXvxGgn6PoSnchC8=; b=qdzBcN93+k7l158SANEZKEXiI31DerKJOPVrL+zsiN1+yeADCY3QSCpZsYUGvPxW3k an7PpGjCrrrLnluZGr85tvUTnCyCaeEml1JEb1Mn1UUAXQ/c8TquVvZ3DtTMJyus5D7a Zj6z/zKxaB87pjgveg6hnA/rViJUKJQUmbzzlv2zAvTw3OSBrm8DSGKYcjhXknV2uUF2 3XwHc7hbqlhKI3WDDmjEEFVuT+UkISauuFmD0AnaNxOgEbxRF09Xk6RbAfJSxwY5M4td +cVF11VVKMXeoOqCtpw7Z8Qzizy4g/q4LY72CC04REdwucH8we4MeTwEW3a+K6phqDP0 gP0A== X-Gm-Message-State: AOUpUlEixhlKAYQhSAuWpbm9xkuzSOnre5h1LXuUOzGg0USut6GfYpwz h/4uqj0Ca5UNT9NcsdnNRYv1N6IgopM= X-Google-Smtp-Source: AA+uWPw/yPcjrf4SlCA1j2KiMedO1D/DkYPmccjSok03l1dvVz1ND3BSy2VUbuTXvKzZI8nd4/ouOA== X-Received: by 2002:a62:b604:: with SMTP id j4-v6mr441946pff.199.1533786042894; Wed, 08 Aug 2018 20:40:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:40:27 -0700 Message-Id: <20180809034033.10579-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809034033.10579-1-richard.henderson@linaro.org> References: <20180809034033.10579-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::530 Subject: [Qemu-devel] [PATCH 05/11] target/arm: Fix typo in helper_sve_ld1hss_r X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Cc: qemu-stable@nongnu.org (3.0.1) Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/arm/sve_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index c3cbec9cf5..e03f954a26 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -4045,7 +4045,7 @@ DO_LD1(sve_ld1bdu_r, cpu_ldub_data_ra, uint64_t, uint= 8_t, ) DO_LD1(sve_ld1bds_r, cpu_ldsb_data_ra, uint64_t, int8_t, ) =20 DO_LD1(sve_ld1hsu_r, cpu_lduw_data_ra, uint32_t, uint16_t, H1_4) -DO_LD1(sve_ld1hss_r, cpu_ldsw_data_ra, uint32_t, int8_t, H1_4) +DO_LD1(sve_ld1hss_r, cpu_ldsw_data_ra, uint32_t, int16_t, H1_4) DO_LD1(sve_ld1hdu_r, cpu_lduw_data_ra, uint64_t, uint16_t, ) DO_LD1(sve_ld1hds_r, cpu_ldsw_data_ra, uint64_t, int16_t, ) =20 --=20 2.17.1 From nobody Wed Nov 5 07:32:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533786361088269.4571768093807; Wed, 8 Aug 2018 20:46:01 -0700 (PDT) Received: from localhost ([::1]:46410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbtg-00029W-0g for importer@patchew.org; Wed, 08 Aug 2018 23:46:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbof-0006kj-9C for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnboc-0003Bu-5z for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:49 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:44189) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnboc-0003BS-1A for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:46 -0400 Received: by mail-pf1-x442.google.com with SMTP id k21-v6so2138890pff.11 for ; Wed, 08 Aug 2018 20:40:45 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id q78-v6sm9674103pfi.185.2018.08.08.20.40.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 20:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6a/GOR0oVfrC4aMp6j4tHYOY3mUq7Mczl/rWUwhb0gg=; b=ebzIbn4n1U82foawoMg8HbRy4fPNJZVlb8nkgidoeg3n15uxaipgS4dmxgYBAVszlV MO75G5/SgkymYOkDTv7rEF7PuUu9++GjW4dXQ0FzxwE7oMucJMHDJ5pOzdk7Hxahy4+b a9G+eAxW6x8jnywXl2P0IMfnVD4fbem9eqtTs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6a/GOR0oVfrC4aMp6j4tHYOY3mUq7Mczl/rWUwhb0gg=; b=si8LaerQGkAM7nCrjJdHhTjoEoL261/aJMrxJfUNZJ25qWIlqfHYx+jId4YAA6gmf9 QJCujC8p6NNlgms4IGCone77uIQR2uFQ0ZW7FJcl1Gxwi0Z/p/RreIdtNbsEMxqIPzJE SzeFhWQekl0CGh35stga596LtZXJyM3GPyGqSGY9IHx8og0e2b++Gb07XjlXRLO0aj8y Cmr1w5p2WDhSUSZTbmKtE0nF8c/wp/4nsKgiri/Gs/ILayMqK28C6hdSWdlCsRfmBIe7 ITRnPDyOSEzyQxwjaxV2IQHm4NLtGV6Rq8s+5DARI7J+x2Zhghh4DUzCoiOaMv3wA5/v /BFw== X-Gm-Message-State: AOUpUlGzwOE2YhbihGt0B7XjGbE24SrZ/JUhJ5zajm8WTJG7TFgsejHG Cn55paGfiPTN3MUDMoo+1kkfEsZWi9M= X-Google-Smtp-Source: AA+uWPxaW6REvIyu1ALnT58yIw/0f7y7UzHes3mgonpew4iyJO11gzxBibne3OZT7LvDyQDca8w64g== X-Received: by 2002:a62:404e:: with SMTP id n75-v6mr462567pfa.232.1533786044820; Wed, 08 Aug 2018 20:40:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:40:28 -0700 Message-Id: <20180809034033.10579-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809034033.10579-1-richard.henderson@linaro.org> References: <20180809034033.10579-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH 06/11] target/arm: Fix sign-extension in sve do_ldr/do_str X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The expression (int) imm + (uint32_t) len_align turns into uint32_t and thus with negative imm produces a memory operation at the wrong offset. None of the numbers involved are particularly large, so change everything to use int. Cc: qemu-stable@nongnu.org (3.0.1) Reported-by: Laurent Desnogues Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Laurent Desnogues Tested-by: Laurent Desnogues --- target/arm/translate-sve.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 89efc80ee7..9e63b5f8e5 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4372,12 +4372,11 @@ static bool trans_UCVTF_dd(DisasContext *s, arg_rpr= _esz *a, uint32_t insn) * The load should begin at the address Rn + IMM. */ =20 -static void do_ldr(DisasContext *s, uint32_t vofs, uint32_t len, - int rn, int imm) +static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int im= m) { - uint32_t len_align =3D QEMU_ALIGN_DOWN(len, 8); - uint32_t len_remain =3D len % 8; - uint32_t nparts =3D len / 8 + ctpop8(len_remain); + int len_align =3D QEMU_ALIGN_DOWN(len, 8); + int len_remain =3D len % 8; + int nparts =3D len / 8 + ctpop8(len_remain); int midx =3D get_mem_index(s); TCGv_i64 addr, t0, t1; =20 @@ -4458,12 +4457,11 @@ static void do_ldr(DisasContext *s, uint32_t vofs, = uint32_t len, } =20 /* Similarly for stores. */ -static void do_str(DisasContext *s, uint32_t vofs, uint32_t len, - int rn, int imm) +static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int im= m) { - uint32_t len_align =3D QEMU_ALIGN_DOWN(len, 8); - uint32_t len_remain =3D len % 8; - uint32_t nparts =3D len / 8 + ctpop8(len_remain); + int len_align =3D QEMU_ALIGN_DOWN(len, 8); + int len_remain =3D len % 8; + int nparts =3D len / 8 + ctpop8(len_remain); int midx =3D get_mem_index(s); TCGv_i64 addr, t0; =20 --=20 2.17.1 From nobody Wed Nov 5 07:32:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533786590844897.0624454247327; Wed, 8 Aug 2018 20:49:50 -0700 (PDT) Received: from localhost ([::1]:46438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbxJ-0005ZE-Ui for importer@patchew.org; Wed, 08 Aug 2018 23:49:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbof-0006kk-9e for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnbod-0003Cb-Mk for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:49 -0400 Received: from mail-pl0-x22a.google.com ([2607:f8b0:400e:c01::22a]:33009) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnbod-0003CC-HI for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:47 -0400 Received: by mail-pl0-x22a.google.com with SMTP id b90-v6so1948822plb.0 for ; Wed, 08 Aug 2018 20:40:47 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id q78-v6sm9674103pfi.185.2018.08.08.20.40.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 20:40:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oR7/ZohV9ZWM7zkPc+xrlk2h0PYh/osElGNKWerwJO0=; b=XXZM90QcMt7bf07Ee4KyIBIlK1DoLbN6TjAeXNOXvH2as1tWVV/Q7ySpvw1AaVnGmN nHyTRvtqOa8OrxBpjLnCRw0mc/NIWXO0s7Ildqo4m/ibSsLHJhh3RWzdwUnGWaROIfMq qdCpQhqefXht0kSO8cKFILlOdQShbdx99v3RU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oR7/ZohV9ZWM7zkPc+xrlk2h0PYh/osElGNKWerwJO0=; b=E6XzT/AYZN+IqYviKPPD0nxPcURyolVUM6uiVBqKmHtLFdS+7CVWgy+UbHctzceAcW TjJq8SSQWL56C+B4khWmAs503QEc6LD8VU75pJhuOs4O9Jn8Ve6RB8DAemC1I3GTTnn3 ciHxe16lINIwMAL87FiFujXY7hqV9KfV41gggWzgRvTfT3HQ2m/Vz7Xkcf8SZP+2e4/k paqns7hpj8KxpskmTDqpH6go0BJyC6m/IyX1cUI51ayfPGNjnUceNAG4PfjBDBTliijB iM71w0TM11Xdf5/SuEEakYCIpSsowgmwemGkrOiTQ7wTMsaYN+8JsZOHuG/+Y4a2QkO3 Z5Jg== X-Gm-Message-State: AOUpUlH/VdQl5PUqS/fd8OBk3KcBgMEXi7GirMDLw8mPItypgnC7ts3b jibn2SmmHrxtz8wvOm72ju5q0GvPebw= X-Google-Smtp-Source: AA+uWPxq+bp8/HgNuYNfc6hqTBR2z2mxDh9tgpzAXRdWZ2ZDwjkV1NEketBW37+uCRRvAsgJYtbczw== X-Received: by 2002:a17:902:8b8b:: with SMTP id ay11-v6mr398345plb.1.1533786046267; Wed, 08 Aug 2018 20:40:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:40:29 -0700 Message-Id: <20180809034033.10579-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809034033.10579-1-richard.henderson@linaro.org> References: <20180809034033.10579-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::22a Subject: [Qemu-devel] [PATCH 07/11] target/arm: Fix offset for LD1R instructions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The immediate should be scaled by the size of the memory reference, not the size of the elements into which it is loaded. Cc: qemu-stable@nongnu.org (3.0.1) Reported-by: Laurent Desnogues Signed-off-by: Richard Henderson Reviewed-by: Laurent Desnogues Tested-by: Laurent Desnogues --- target/arm/translate-sve.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 9e63b5f8e5..f635822a61 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4819,6 +4819,7 @@ static bool trans_LD1R_zpri(DisasContext *s, arg_rpri= _load *a, uint32_t insn) unsigned vsz =3D vec_full_reg_size(s); unsigned psz =3D pred_full_reg_size(s); unsigned esz =3D dtype_esz[a->dtype]; + unsigned msz =3D dtype_msz(a->dtype); TCGLabel *over =3D gen_new_label(); TCGv_i64 temp; =20 @@ -4842,7 +4843,7 @@ static bool trans_LD1R_zpri(DisasContext *s, arg_rpri= _load *a, uint32_t insn) =20 /* Load the data. */ temp =3D tcg_temp_new_i64(); - tcg_gen_addi_i64(temp, cpu_reg_sp(s, a->rn), a->imm << esz); + tcg_gen_addi_i64(temp, cpu_reg_sp(s, a->rn), a->imm << msz); tcg_gen_qemu_ld_i64(temp, temp, get_mem_index(s), s->be_data | dtype_mop[a->dtype]); =20 --=20 2.17.1 From nobody Wed Nov 5 07:32:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533786686037646.3229497243161; Wed, 8 Aug 2018 20:51:26 -0700 (PDT) Received: from localhost ([::1]:46449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbyu-0007JN-VK for importer@patchew.org; Wed, 08 Aug 2018 23:51:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbof-0006lI-Q8 for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnbof-0003DF-18 for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:49 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:33728) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnboe-0003Cs-RA for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:48 -0400 Received: by mail-pl0-x243.google.com with SMTP id b90-v6so1948846plb.0 for ; Wed, 08 Aug 2018 20:40:48 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id q78-v6sm9674103pfi.185.2018.08.08.20.40.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 20:40:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=u5hBbJUuDc7/ufplT19/aY8WnnQKtZVUsYURNw4zFxs=; b=HZ41eiFHYxEF4kdJT/PNfqOLOZ+2D6vkRGrNIHy/xQbKoDOpGwNu3UP+HXg9/c7FCp OWT+s05Oj6I9MOXucQRW9LS8bIKVhN2h4V/0QJJxGpmtuEcSwMA3IDgSF6egzYvuTRKr Zpbf9jooCqamRNUxv1AaItcUpLAdXMbKUsIZI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=u5hBbJUuDc7/ufplT19/aY8WnnQKtZVUsYURNw4zFxs=; b=IpksEkxRbHOv0jN8FE5szM4I3Viihnfo98ivUhT2CKZbH9RpPZHw9S4zsOZrRKWEuV YbbSBWNE1jxr2KENeV1xdzE4m7jEcK1WOme6uuwE+ZFXQvVHctnKwKnKBa9GtV2CQMGy rEvEiRLr5+ocpLnxTIjNct2nw09yiSx2tLQ1YgoJ7TQ9Hk6v5Gk02Y6XB7FcyuhXUseh tLAxHjXQ5UkepB9SWE39f4p8IFsAP9Nd/1d4bSkr4YvMbKG2/p+4/7incAqtM89lOafb YcQAv1Is6N2WALXtITemUoqy5QEgAfEZZWiyMoALSg8tqYGQ1FAZu8DhFSrnc28FP6D9 zkrQ== X-Gm-Message-State: AOUpUlHY3hPVrfF+1AFviMHRKcPpntaayIs5HUWfd2SudkQorEjscwTg DygheTQn1cJd1gOGFlGFesoZRXwhIDY= X-Google-Smtp-Source: AA+uWPyAntDY1b/m8lM/Z0T/xewsUA0Qb4qEE4cz75YhmMkyD5jdgmgqQATpiwQm894Tk/PXJ0It4w== X-Received: by 2002:a17:902:d906:: with SMTP id c6-v6mr398873plz.65.1533786047545; Wed, 08 Aug 2018 20:40:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:40:30 -0700 Message-Id: <20180809034033.10579-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809034033.10579-1-richard.henderson@linaro.org> References: <20180809034033.10579-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PATCH 08/11] target/arm: Fix offset scaling for LD_zprr and ST_zprr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The scaling should be solely on the memory operation size; the number of registers being loaded does not come in to the initial computation. Cc: qemu-stable@nongnu.org (3.0.1) Reported-by: Laurent Desnogues Signed-off-by: Richard Henderson Reviewed-by: Laurent Desnogues Tested-by: Laurent Desnogues --- target/arm/translate-sve.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index f635822a61..d27bc8c946 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4665,8 +4665,7 @@ static bool trans_LD_zprr(DisasContext *s, arg_rprr_l= oad *a, uint32_t insn) } if (sve_access_check(s)) { TCGv_i64 addr =3D new_tmp_a64(s); - tcg_gen_muli_i64(addr, cpu_reg(s, a->rm), - (a->nreg + 1) << dtype_msz(a->dtype)); + tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), dtype_msz(a->dtype)); tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn)); do_ld_zpa(s, a->rd, a->pg, addr, a->dtype, a->nreg); } @@ -4899,7 +4898,7 @@ static bool trans_ST_zprr(DisasContext *s, arg_rprr_s= tore *a, uint32_t insn) } if (sve_access_check(s)) { TCGv_i64 addr =3D new_tmp_a64(s); - tcg_gen_muli_i64(addr, cpu_reg(s, a->rm), (a->nreg + 1) << a->msz); + tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), a->msz); tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn)); do_st_zpa(s, a->rd, a->pg, addr, a->msz, a->esz, a->nreg); } --=20 2.17.1 From nobody Wed Nov 5 07:32:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15337862712724.938771999084565; Wed, 8 Aug 2018 20:44:31 -0700 (PDT) Received: from localhost ([::1]:46398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbsE-0000qm-44 for importer@patchew.org; Wed, 08 Aug 2018 23:44:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnboh-0006nA-DH for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnbog-0003Ec-LP for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:51 -0400 Received: from mail-pl0-x22e.google.com ([2607:f8b0:400e:c01::22e]:33013) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnbog-0003E6-G0 for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:50 -0400 Received: by mail-pl0-x22e.google.com with SMTP id b90-v6so1948879plb.0 for ; Wed, 08 Aug 2018 20:40:50 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id q78-v6sm9674103pfi.185.2018.08.08.20.40.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 20:40:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ibaa2x/FVJzOL9C446Qkj9eSHPvGG5P1FYKx2aZVL6Q=; b=iYIPfgxfAZYI7KyW+M4lgq7p9K937RHDugS4+lRMThwtEFC6Of1yYzxhVG71QQHH/a uMh0xs5Gn562fGY8kBZrV2CAbKagOGfhOAjQKy2PW5W7oEQOooS6D9RVYFVaPvVrNm0b 10nUwqi+Gdh1VU9q1Ei78SFWMUAND+nG3FDa0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ibaa2x/FVJzOL9C446Qkj9eSHPvGG5P1FYKx2aZVL6Q=; b=nNg/WvJPjtnpCcSwZj1GLpZJ8kRitZzR44VP08l0ECDt8QpxvkiX6p5nyMtqjtLPUa TKafKje3QOch5EOd5cDJvGKi8BZ6t0MvUfIc92AqLSLSI/rz+6qWFmbY0r6YUATNSAV2 l1IwN6vBFvjXx3Hkdkso2sF588pMCcghX7epSLTQ03OonTJ9+8csIIHUcsTG6Tp9mgxH YPIZ/8XjqvUjapDbmEhzXNRTFHowVZQs6unZ/GY/mZgXtaBFm4bhw9D7rri197vYsGku UL9pZ/KiENQKd8QUz10rNegqJuOaiVhw9iODH26lOmF1sRTHnn6ogh+5nJOny/YGv4v6 ZSAg== X-Gm-Message-State: AOUpUlFpTo5BL5ODLwYJgvv37tQkd9G1jCvjciOo8dSAxZkfbzfy90BD pa1yPXUD5LtmTz10emGq4xD+/wp6omw= X-Google-Smtp-Source: AA+uWPzUsGXKLkJSW34N+rGeiP+1nYn9MCPBH4F9JutkQxyBV5LTnidSx//xykeKzvYHTjXPraMbRA== X-Received: by 2002:a17:902:1121:: with SMTP id d30-v6mr401007pla.247.1533786049218; Wed, 08 Aug 2018 20:40:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:40:31 -0700 Message-Id: <20180809034033.10579-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809034033.10579-1-richard.henderson@linaro.org> References: <20180809034033.10579-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::22e Subject: [Qemu-devel] [PATCH 09/11] target/arm: Reformat integer register dump X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With PC, there are 33 registers. Three per line lines up nicely without overflowing 80 columns. Cc: qemu-stable@nongnu.org (3.0.1) Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 45a6c2a3aa..358f169c75 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -137,14 +137,13 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int el =3D arm_current_el(env); const char *ns_status; =20 - cpu_fprintf(f, "PC=3D%016"PRIx64" SP=3D%016"PRIx64"\n", - env->pc, env->xregs[31]); - for (i =3D 0; i < 31; i++) { - cpu_fprintf(f, "X%02d=3D%016"PRIx64, i, env->xregs[i]); - if ((i % 4) =3D=3D 3) { - cpu_fprintf(f, "\n"); + cpu_fprintf(f, " PC=3D%016" PRIx64 " ", env->pc); + for (i =3D 0; i < 32; i++) { + if (i =3D=3D 31) { + cpu_fprintf(f, " SP=3D%016" PRIx64 "\n", env->xregs[i]); } else { - cpu_fprintf(f, " "); + cpu_fprintf(f, "X%02d=3D%016" PRIx64 "%s", i, env->xregs[i], + (i + 2) % 3 ? " " : "\n"); } } =20 --=20 2.17.1 From nobody Wed Nov 5 07:32:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533786451907593.0708847843116; Wed, 8 Aug 2018 20:47:31 -0700 (PDT) Received: from localhost ([::1]:46414 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbv5-0003Ha-QE for importer@patchew.org; Wed, 08 Aug 2018 23:47:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnboj-0006pU-0Z for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnboi-0003FL-1u for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:53 -0400 Received: from mail-pl0-x232.google.com ([2607:f8b0:400e:c01::232]:44408) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnboh-0003Eu-QF for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:51 -0400 Received: by mail-pl0-x232.google.com with SMTP id ba4-v6so1929280plb.11 for ; Wed, 08 Aug 2018 20:40:51 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id q78-v6sm9674103pfi.185.2018.08.08.20.40.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 20:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0FcppwMQ/VVPQuPzY24/U6P82x5KiB0C2CbAGzzrE6M=; b=S7aUEd8E98RC6F4SCcmW7rtz+ScXjJ7QNFP2Q/byL5piRugE/64bj9hfQyNmRHKl7d CUgQpXtRZdfTODq8DIqFxQyPBHEqGCPiXBE04SMAGdTyXz2PlaDRfsOZGi0mz/NxXfjb 4h/OXJjTUgoNIA97CT95XvbJxDjHxsiuPwizI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0FcppwMQ/VVPQuPzY24/U6P82x5KiB0C2CbAGzzrE6M=; b=YHNSd4KpA/x9CssaRWv7id6QKHQ13ZD30RDQnWSqakQ4y/y1nAsTSg/hA1ijKcajGW hjEHBIsxVYoZh/wzAAXUuiWcrUD686P7+FN6yPlg9ELjd3srweKxzSaIh5hMSz1TJQ7l HdxbaNXzi9Bg+of/EyoPW6gxh5WzDm01mbV3MijpJDU79c0gtNC6vQh4B6LUsjI0NvNP X0aTfe0YEznULpVkF9k4McyFxiXhbbD/8OmhdLw38CevRed8p8GhaWQeeGtHkLvdLJTQ ZvFFIftDS3kSfK5/l62iepvXd5brlsL5ctjyMFn8JXwrOY9TYIK3SpQroAirQvdnLp0V PV0Q== X-Gm-Message-State: AOUpUlH+cTRPuI82iLN5aZ9A7GBWdgcl1kw37e2YOgTm9P0EKsvsHR/N 9jtUCm6tOK82Dqs4GLDja8b1lJ0gci0= X-Google-Smtp-Source: AA+uWPxX/O00T9eQSWIybjd32/RgJkayGEo8sdblVOlQVrvxeIw3nSccJeBOSzWvNgiYDqDfaXAmyQ== X-Received: by 2002:a17:902:2e83:: with SMTP id r3-v6mr431443plb.80.1533786050462; Wed, 08 Aug 2018 20:40:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:40:32 -0700 Message-Id: <20180809034033.10579-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809034033.10579-1-richard.henderson@linaro.org> References: <20180809034033.10579-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::232 Subject: [Qemu-devel] [PATCH 10/11] target/arm: Dump SVE state if enabled X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Also fold the FPCR/FPSR state onto the same line as PSTATE, and mention but do not dump disabled FPU state. Cc: qemu-stable@nongnu.org (3.0.1) Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 95 +++++++++++++++++++++++++++++++++----- 1 file changed, 83 insertions(+), 12 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 358f169c75..b29dc49c4f 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -152,8 +152,7 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f, } else { ns_status =3D ""; } - - cpu_fprintf(f, "\nPSTATE=3D%08x %c%c%c%c %sEL%d%c\n", + cpu_fprintf(f, "PSTATE=3D%08x %c%c%c%c %sEL%d%c", psr, psr & PSTATE_N ? 'N' : '-', psr & PSTATE_Z ? 'Z' : '-', @@ -163,17 +162,89 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f, el, psr & PSTATE_SP ? 'h' : 't'); =20 - if (flags & CPU_DUMP_FPU) { - int numvfpregs =3D 32; - for (i =3D 0; i < numvfpregs; i++) { - uint64_t *q =3D aa64_vfp_qreg(env, i); - uint64_t vlo =3D q[0]; - uint64_t vhi =3D q[1]; - cpu_fprintf(f, "q%02d=3D%016" PRIx64 ":%016" PRIx64 "%c", - i, vhi, vlo, (i & 1 ? '\n' : ' ')); + if (!(flags & CPU_DUMP_FPU)) { + cpu_fprintf(f, "\n"); + return; + } + cpu_fprintf(f, " FPCR=3D%08x FPSR=3D%08x\n", + vfp_get_fpcr(env), vfp_get_fpsr(env)); + + if (arm_feature(env, ARM_FEATURE_SVE)) { + int j, zcr_len =3D env->vfp.zcr_el[1] & 0xf; /* fix for system mod= e */ + + for (i =3D 0; i <=3D FFR_PRED_NUM; i++) { + bool eol; + if (i =3D=3D FFR_PRED_NUM) { + cpu_fprintf(f, "FFR=3D"); + /* It's last, so end the line. */ + eol =3D true; + } else { + cpu_fprintf(f, "P%02d=3D", i); + switch (zcr_len) { + case 0: + eol =3D i % 8 =3D=3D 7; + break; + case 1: + eol =3D i % 6 =3D=3D 5; + break; + case 2: + case 3: + eol =3D i % 3 =3D=3D 2; + break; + default: + /* More than one quadword per predicate. */ + eol =3D true; + break; + } + } + for (j =3D zcr_len / 4; j >=3D 0; j--) { + int digits; + if (j * 4 + 4 <=3D zcr_len + 1) { + digits =3D 16; + } else { + digits =3D (zcr_len % 4 + 1) * 4; + } + cpu_fprintf(f, "%0*" PRIx64 "%s", digits, + env->vfp.pregs[i].p[j], + j ? ":" : eol ? "\n" : " "); + } + } + + for (i =3D 0; i < 32; i++) { + if (zcr_len =3D=3D 0) { + cpu_fprintf(f, "Z%02d=3D%016" PRIx64 ":%016" PRIx64 "%s", + i, env->vfp.zregs[i].d[1], + env->vfp.zregs[i].d[0], i & 1 ? "\n" : " "); + } else if (zcr_len =3D=3D 1) { + cpu_fprintf(f, "Z%02d=3D%016" PRIx64 ":%016" PRIx64 + ":%016" PRIx64 ":%016" PRIx64 "\n", + i, env->vfp.zregs[i].d[3], env->vfp.zregs[i].d= [2], + env->vfp.zregs[i].d[1], env->vfp.zregs[i].d[0]= ); + } else { + for (j =3D zcr_len; j >=3D 0; j--) { + bool odd =3D (zcr_len - j) % 2 !=3D 0; + if (j =3D=3D zcr_len) { + cpu_fprintf(f, "Z%02d[%x-%x]=3D", i, j, j - 1); + } else if (!odd) { + if (j > 0) { + cpu_fprintf(f, " [%x-%x]=3D", j, j - 1); + } else { + cpu_fprintf(f, " [%x]=3D", j); + } + } + cpu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%s", + env->vfp.zregs[i].d[j * 2 + 1], + env->vfp.zregs[i].d[j * 2], + odd || j =3D=3D 0 ? "\n" : ":"); + } + } + } + } else { + for (i =3D 0; i < 32; i++) { + uint64_t *q =3D aa64_vfp_qreg(env, i); + cpu_fprintf(f, "Q%02d=3D%016" PRIx64 ":%016" PRIx64 "%s", + i, q[1], q[0], (i & 1 ? "\n" : " ")); } - cpu_fprintf(f, "FPCR: %08x FPSR: %08x\n", - vfp_get_fpcr(env), vfp_get_fpsr(env)); } } =20 --=20 2.17.1 From nobody Wed Nov 5 07:32:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533786783427363.68700903427805; Wed, 8 Aug 2018 20:53:03 -0700 (PDT) Received: from localhost ([::1]:46457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnc0O-0008Ee-7V for importer@patchew.org; Wed, 08 Aug 2018 23:52:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnbok-0006r1-HS for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnboj-0003G7-D1 for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:54 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:33087) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnboj-0003Fh-5D for qemu-devel@nongnu.org; Wed, 08 Aug 2018 23:40:53 -0400 Received: by mail-pf1-x444.google.com with SMTP id d4-v6so2164189pfn.0 for ; Wed, 08 Aug 2018 20:40:53 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id q78-v6sm9674103pfi.185.2018.08.08.20.40.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 20:40:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RTV9YUpP5y3oJ9ECtxuaAeHR5syAJ7q9647bx+XF62o=; b=b0RwnkoGTdjgbT/Z1U1I/OSemma3T+1GL82Wha8HZ5ky0/efxTWIQ/r4QJJIHqHl9s CTrNbFQa0XlzIuuMj4Ol0kZI+gD7ERxSzp7CEuqeqZFhNQdfg1fKh614oEVSwmre33XS WlMjvkPIXBH8+1e9dXOuJ+x4xpni1Q+sLriMo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RTV9YUpP5y3oJ9ECtxuaAeHR5syAJ7q9647bx+XF62o=; b=Q/DQNpJwusnvdtg1GzvLN31aVE766q0ujRcxFVnKQaJW5HJdBCajjQHY4rM1jJurra Dgolt1yKf90ugSSyJ1FUFp7MAC1oDbWLQul79il7MhT611ehvTqw8mZ7gLVTII4mzVtF ADkQKL+Pj7DRmzADvol72Nk+tEuZPgaJLroxrWEfdAwyg4XldTA+rx7k3XfvcZQVrC7o 8heBJ54zvmm9nRDYZx8wRttDbbRrk3A/L/eynLMzA3kwkLD6nZXIHyED2lJ72WAAILv5 bR6lF0oItofEG7u6h4NSKzWCXVEJ7Cj5SnliCZE65PIxvSgL8FVtKZ4yI2XupR6xy1L1 CUSQ== X-Gm-Message-State: AOUpUlGRVouuM6UxO/N2gqwihCvm4pDxVfUjYVvRbbWeNZCHcQ3GeD50 TgGH45baHG+QruZ52f+khfKVTQ6HVlY= X-Google-Smtp-Source: AA+uWPz7MpMEunC0j/09o5O9LMxRdRdAaESf+fqcTqXLciLjjedTBPT00y+YL94Tp19da3Ls2qI4MA== X-Received: by 2002:a62:7086:: with SMTP id l128-v6mr481071pfc.144.1533786051885; Wed, 08 Aug 2018 20:40:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 20:40:33 -0700 Message-Id: <20180809034033.10579-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809034033.10579-1-richard.henderson@linaro.org> References: <20180809034033.10579-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH 11/11] target/arm: Add sve-max-vq cpu property to -cpu max X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This allows the default (and maximum) vector length to be set from the command-line. Which is extraordinarily helpful in debuging problems depending on vector length without having to bake knowledge of PR_SET_SVE_VL into every guest binary. Cc: qemu-stable@nongnu.org (3.0.1) Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e --- target/arm/cpu.h | 3 +++ linux-user/syscall.c | 19 +++++++++++++------ target/arm/cpu.c | 6 +++--- target/arm/cpu64.c | 29 +++++++++++++++++++++++++++++ target/arm/helper.c | 7 +++++-- 5 files changed, 53 insertions(+), 11 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index e310ffc29d..9526ed27cb 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -857,6 +857,9 @@ struct ARMCPU { =20 /* Used to synchronize KVM and QEMU in-kernel device levels */ uint8_t device_irq_level; + + /* Used to set the maximum vector length the cpu will support. */ + uint32_t sve_max_vq; }; =20 static inline ARMCPU *arm_env_get_cpu(CPUARMState *env) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index dfc851cc35..5a4af76c03 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -10848,15 +10848,22 @@ abi_long do_syscall(void *cpu_env, int num, abi_l= ong arg1, #endif #ifdef TARGET_AARCH64 case TARGET_PR_SVE_SET_VL: - /* We cannot support either PR_SVE_SET_VL_ONEXEC - or PR_SVE_VL_INHERIT. Therefore, anything above - ARM_MAX_VQ results in EINVAL. */ + /* + * We cannot support either PR_SVE_SET_VL_ONEXEC or + * PR_SVE_VL_INHERIT. Note the kernel definition + * of sve_vl_valid allows for VQ=3D512, i.e. VL=3D8192, + * even though the current architectural maximum is VQ=3D16. + */ ret =3D -TARGET_EINVAL; if (arm_feature(cpu_env, ARM_FEATURE_SVE) - && arg2 >=3D 0 && arg2 <=3D ARM_MAX_VQ * 16 && !(arg2 & 15= )) { + && arg2 >=3D 0 && arg2 <=3D 512 * 16 && !(arg2 & 15)) { CPUARMState *env =3D cpu_env; - int old_vq =3D (env->vfp.zcr_el[1] & 0xf) + 1; - int vq =3D MAX(arg2 / 16, 1); + ARMCPU *cpu =3D arm_env_get_cpu(env); + uint32_t vq, old_vq; + + old_vq =3D (env->vfp.zcr_el[1] & 0xf) + 1; + vq =3D MAX(arg2 / 16, 1); + vq =3D MIN(vq, cpu->sve_max_vq); =20 if (vq < old_vq) { aarch64_sve_narrow_vq(env, vq); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 64a8005a4b..b25898ed4c 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -168,9 +168,9 @@ static void arm_cpu_reset(CPUState *s) env->cp15.cpacr_el1 =3D deposit64(env->cp15.cpacr_el1, 16, 2, 3); env->cp15.cptr_el[3] |=3D CPTR_EZ; /* with maximum vector length */ - env->vfp.zcr_el[1] =3D ARM_MAX_VQ - 1; - env->vfp.zcr_el[2] =3D ARM_MAX_VQ - 1; - env->vfp.zcr_el[3] =3D ARM_MAX_VQ - 1; + env->vfp.zcr_el[1] =3D cpu->sve_max_vq - 1; + env->vfp.zcr_el[2] =3D env->vfp.zcr_el[1]; + env->vfp.zcr_el[3] =3D env->vfp.zcr_el[1]; #else /* Reset into the highest available EL */ if (arm_feature(env, ARM_FEATURE_EL3)) { diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index d0581d59d8..800bff780e 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -29,6 +29,7 @@ #include "sysemu/sysemu.h" #include "sysemu/kvm.h" #include "kvm_arm.h" +#include "qapi/visitor.h" =20 static inline void set_feature(CPUARMState *env, int feature) { @@ -217,6 +218,29 @@ static void aarch64_a53_initfn(Object *obj) define_arm_cp_regs(cpu, cortex_a57_a53_cp_reginfo); } =20 +static void cpu_max_get_sve_vq(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + ARMCPU *cpu =3D ARM_CPU(obj); + visit_type_uint32(v, name, &cpu->sve_max_vq, errp); +} + +static void cpu_max_set_sve_vq(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + ARMCPU *cpu =3D ARM_CPU(obj); + Error *err =3D NULL; + + visit_type_uint32(v, name, &cpu->sve_max_vq, &err); + + if (!err && (cpu->sve_max_vq =3D=3D 0 || cpu->sve_max_vq > ARM_MAX_VQ)= ) { + error_setg(&err, "unsupported SVE vector length"); + error_append_hint(&err, "Valid sve-max-vq in range [1-%d]\n", + ARM_MAX_VQ); + } + error_propagate(errp, err); +} + /* -cpu max: if KVM is enabled, like -cpu host (best possible with this ho= st); * otherwise, a CPU with as many features enabled as our emulation support= s. * The version of '-cpu max' for qemu-system-arm is defined in cpu.c; @@ -253,6 +277,10 @@ static void aarch64_max_initfn(Object *obj) cpu->ctr =3D 0x80038003; /* 32 byte I and D cacheline size, VIPT i= cache */ cpu->dcz_blocksize =3D 7; /* 512 bytes */ #endif + + cpu->sve_max_vq =3D ARM_MAX_VQ; + object_property_add(obj, "sve-max-vq", "uint32", cpu_max_get_sve_v= q, + cpu_max_set_sve_vq, NULL, NULL, &error_fatal); } } =20 @@ -405,6 +433,7 @@ void aarch64_sve_narrow_vq(CPUARMState *env, unsigned v= q) uint64_t pmask; =20 assert(vq >=3D 1 && vq <=3D ARM_MAX_VQ); + assert(vq <=3D arm_env_get_cpu(env)->sve_max_vq); =20 /* Zap the high bits of the zregs. */ for (i =3D 0; i < 32; i++) { diff --git a/target/arm/helper.c b/target/arm/helper.c index 66afb08ee0..c24c66d43e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12408,9 +12408,12 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target= _ulong *pc, zcr_len =3D 0; } else { int current_el =3D arm_current_el(env); + ARMCPU *cpu =3D arm_env_get_cpu(env); =20 - zcr_len =3D env->vfp.zcr_el[current_el <=3D 1 ? 1 : current_el= ]; - zcr_len &=3D 0xf; + zcr_len =3D cpu->sve_max_vq - 1; + if (current_el <=3D 1) { + zcr_len =3D MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[1= ]); + } if (current_el < 2 && arm_feature(env, ARM_FEATURE_EL2)) { zcr_len =3D MIN(zcr_len, 0xf & (uint32_t)env->vfp.zcr_el[2= ]); } --=20 2.17.1