From nobody Sat May 18 07:31:18 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1602518344; cv=none; d=zohomail.com; s=zohoarc; b=mt3Pcm9R2wC25IjonW70m8t7p+F7NOtFMEyU7pSY0LuBn3WGtBjTvfpBqraL1BIr8HN6wHKILNUzQdgxc8ng8MW6tjiVjoVE1XBpq1SdzNn1KFzHID139XFl2mum8gZIXUZ5GZbINGzSJUpaVRvKl9XgkLxwYMyukmRxk4amsSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602518344; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9dCI9vVIHjGOIU15u/YnihvSC4K6HLaW4rgzCu/bPQI=; b=Jnqh701HjMPSym/BYjys8oKqlKE48MmYirmN0s0+bna5PMD2FzCGnLuzW6QIwhu1rbVWwXrgZ9WyV5JBCruFTPtCdsov2u8DTn4Hshqp6q+mf7ZuQLXwouTGAako2529jcWbvrg22OtK7wV095v5Pt47ieDq2wEBUVh0gRKuSw0= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602518344245702.6379825336426; Mon, 12 Oct 2020 08:59:04 -0700 (PDT) Received: from localhost ([::1]:52342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS0E3-0006bC-4b for importer@patchew.org; Mon, 12 Oct 2020 11:59:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRztZ-0003V5-C2 for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:37:53 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:34100) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRztX-0007lB-8o for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:37:52 -0400 Received: by mail-wr1-x433.google.com with SMTP id i1so13574500wro.1 for ; Mon, 12 Oct 2020 08:37:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y66sm7095961wmd.14.2020.10.12.08.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 08:37: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 :mime-version:content-transfer-encoding; bh=9dCI9vVIHjGOIU15u/YnihvSC4K6HLaW4rgzCu/bPQI=; b=lljcsCmP0fkpHKYyW+GVLzuO7pU6NoYK52YAUzPypHUg5y2XMHbcMAkf2CktXd6hG5 ecr0XaLQDSmrCBO8fCm6cCmcpu6samPUYiIo+PlexavyrkAIeX4Gd5xpndCsiAISZx2v xPv2ISdFbAMzdYAXgHyp7UyyHWofqrCXWHt71E5yH8tIbtRlZkFp73yvv1IEE9REIBGQ iO0BGNo3mKF0cG1WHvU+/xs+c34nMrDylCphKercMcQ96ci0P2E/dgURZm6ME5m7GX9F 2/m/y9BOd1yxxqdBlCXKOlMtHFGhpvT8+PaJwblyyKXbA/L4Gerfc2pv4YoyBnYF7XqQ 673g== 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=9dCI9vVIHjGOIU15u/YnihvSC4K6HLaW4rgzCu/bPQI=; b=uIVx7OFIJwPpM69sjPq60rsU/ZCjrRAVag97PpybcSnvhHuSAyN+FPtw9uYPqmkzsg Vu6iFkBc5+0svcLxjNs8O8JZErTjPB3fdpRl1ZIB27kjZAL+23/uDpurSsF/UBkUYn/c dWuB6c3mDLsKpN130DKkF6nRDxtgBxDmrFx1FA5aNb1Q1Otn6lkllYeNCYM3gMUXnydr KxapNGRGGNGwT9hpXkJ8bTz5OGfmgAZt+Uk5bXynRpFIVQrTwpwJl5OBEy3h5v7EY6kT A3Vp+KN3xirgtXrDNwpzfueXkzekyK/sQmVrCEWVuC2BrSPEyGDpKnCcRrNQbWZvaA7Y x5lw== X-Gm-Message-State: AOAM530uZ8daIAOCN7Yl+TYwuiQ0u7i7uSpHUYlet7oNdzoWdpbUjw0H HW+rnbpE4cAjsr5/rrdqjEx7PA== X-Google-Smtp-Source: ABdhPJzv4ZgMKklrU4w0AiKdZfS8ywDfbAJeEUxveFTqLjYv4XwyYvg1fBHeYCZceBXKT5outAEVqw== X-Received: by 2002:adf:f305:: with SMTP id i5mr25152926wro.346.1602517069740; Mon, 12 Oct 2020 08:37:49 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 01/10] decodetree: Fix codegen for non-overlapping group inside overlapping group Date: Mon, 12 Oct 2020 16:37:37 +0100 Message-Id: <20201012153746.9996-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201012153746.9996-1-peter.maydell@linaro.org> References: <20201012153746.9996-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" For nested groups like: { [ pattern 1 pattern 2 ] pattern 3 } the intended behaviour is that patterns 1 and 2 must not overlap with each other; if the insn matches neither then we fall through to pattern 3 as the next thing in the outer overlapping group. Currently we generate incorrect code for this situation, because in the code path for a failed match inside the inner non-overlapping group we generate a "return" statement, which causes decode to stop entirely rather than continuing to the next thing in the outer group. Generate a "break" instead, so that decode flow behaves as required for this nested group case. Suggested-by: Richard Henderson Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- scripts/decodetree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 60fd3b5e5f6..c1bf3cfa85f 100644 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -548,7 +548,7 @@ class Tree: output(ind, ' /* ', str_match_bits(innerbits, innermask), ' */\n') s.output_code(i + 4, extracted, innerbits, innermask) - output(ind, ' return false;\n') + output(ind, ' break;\n') output(ind, '}\n') # end Tree =20 --=20 2.20.1 From nobody Sat May 18 07:31:18 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1602518520; cv=none; d=zohomail.com; s=zohoarc; b=cdIJHMN+n6ePra853hXztCD+Uyr3vc+ZvU5lDwsfhSu2iGRjriXmm4WXF6Bgh/VNiL9P5w9Qdtfe8nDeGhsH1gWr3NywlAaGdr3aJjiZoZvy0o/WhOPTKe68O/ik4BKZttZHrKA96df2wmta/9f3KNyq+vwQ22QTEHq2oj8o+FM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602518520; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=73sxXQONcqBgzHuOsaIz5hu+3BY6+pw52N6WyKkQfZo=; b=N5I1bN0a9HNRG3eRrvG9lgiquS/9KhFaNVHbkXDrltpve8DKkcdmKFWs/3PfOUgOO4X0t0n4qDYoEEculFqE6fCou+Mv74pwOHDKTFBYLzAWJoOhxYWEpJyEKD42mAChm1mLuYGoPdtxdMwOmI1HJHRSrNyagIO9oZNWE+0cDuM= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602518520531754.0132164954094; Mon, 12 Oct 2020 09:02:00 -0700 (PDT) Received: from localhost ([::1]:58494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS0Gs-0000qI-OA for importer@patchew.org; Mon, 12 Oct 2020 12:01:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRztf-0003ab-LD for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:37:59 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:51907) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRztY-0007lS-4n for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:37:59 -0400 Received: by mail-wm1-x341.google.com with SMTP id d81so17522725wmc.1 for ; Mon, 12 Oct 2020 08:37:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y66sm7095961wmd.14.2020.10.12.08.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 08:37: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 :mime-version:content-transfer-encoding; bh=73sxXQONcqBgzHuOsaIz5hu+3BY6+pw52N6WyKkQfZo=; b=exgSCy6TBYKs+2u6PmauhdJ/pAV+QrSf2WLOJjFOA913gOLmL4t0hjV+pGDqFu59Kd shf6GEjbd5Xl9baMOMbtewoojWiuyQ1lZCErfoS3kXKtI3bWXD0olSbRYV1TsabJX/7q /JuIkVjG6Wj0oH+m7Hk+KEq52DO13lKiXQ3MhV9kMny4wRJLcVNJKKEYWo7aMIIHMgKm segKFQ8AK/ZTWrMvOWZZ5NaPOdnIwXzrtWxUQK93fM2sNdnX5MQk2hpbZi2DEOOt3eTq hyuH9Qv3WwK2VwWEQ+vSoTrHi/uqU8HHczSgqEPivdBX+3weH2MjPpKUR4hMhd334SB3 9R6w== 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=73sxXQONcqBgzHuOsaIz5hu+3BY6+pw52N6WyKkQfZo=; b=iBnKR604NRohEYj6AkWjhObOmjd68x5p1w1bFNsZb78CfjJ9EYqwJr5mVHejiiKeC/ CCfi8gCIh/kohLIpji4MLt23jH+IZyHya2Mh3gm+yS548hr79cM7KOFniNZ6jiY1EZVh BpxBIP5pgJUDuTLpuyzg6lmnT/ctMfO599pm0xeFK7u/GX/q5fRR+l9iQ/RlNApSvYUl tqxcv9YhX+gDA9XrCWBkDw0Yl3pkNn5ZSrmzYIaUpeojpLGR15Y4GCeCzzcj2ySXcaUE Xzo5MuhZZzNqHHbCNWYGINlB5SPDEF56cQ+d1nBNFLFfMoWAu79Hxj1Ah5+saAEtLDTz jXpw== X-Gm-Message-State: AOAM5336GovaUJOtiCA705XHhhdmk5Sl7rxf/87NsFX9OTuOBVh81B4z jhChRXurwVfbEx81kHQiqmgySw== X-Google-Smtp-Source: ABdhPJy4LPQpvrsnt5RCAZ9vHcRDudF9jd0mi6uJSyVW1oujaQiAGY70CcWC3vHFoJMgAPKgVLa9yQ== X-Received: by 2002:a1c:1f89:: with SMTP id f131mr11867963wmf.10.1602517070880; Mon, 12 Oct 2020 08:37:50 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 02/10] target/arm: Implement v8.1M NOCP handling Date: Mon, 12 Oct 2020 16:37:38 +0100 Message-Id: <20201012153746.9996-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201012153746.9996-1-peter.maydell@linaro.org> References: <20201012153746.9996-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::341; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x341.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From v8.1M, disabled-coprocessor handling changes slightly: * coprocessors 8, 9, 14 and 15 are also governed by the cp10 enable bit, like cp11 * an extra range of instruction patterns is considered to be inside the coprocessor space We previously marked these up with TODO comments; implement the correct behaviour. Unfortunately there is no ID register field which indicates this behaviour. We could in theory test an unrelated ID register which indicates guaranteed-to-be-in-v8.1M behaviour like ID_ISAR0.CmpBranch >=3D 3 (low-overhead-loops), but it seems better to simply define a new ARM_FEATURE_V8_1M feature flag and use it for this and other new-in-v8.1M behaviour that isn't identifiable from the ID registers. Signed-off-by: Peter Maydell --- target/arm/cpu.h | 1 + target/arm/m-nocp.decode | 10 ++++++---- target/arm/translate-vfp.c.inc | 17 +++++++++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index cfff1b5c8fe..74392fa0295 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1985,6 +1985,7 @@ enum arm_features { ARM_FEATURE_VBAR, /* has cp15 VBAR */ ARM_FEATURE_M_SECURITY, /* M profile Security Extension */ ARM_FEATURE_M_MAIN, /* M profile Main Extension */ + ARM_FEATURE_V8_1M, /* M profile extras only in v8.1M and later */ }; =20 static inline int arm_feature(CPUARMState *env, int feature) diff --git a/target/arm/m-nocp.decode b/target/arm/m-nocp.decode index 7182d7d1217..28c8ac6b94c 100644 --- a/target/arm/m-nocp.decode +++ b/target/arm/m-nocp.decode @@ -29,14 +29,16 @@ # If the coprocessor is not present or disabled then we will generate # the NOCP exception; otherwise we let the insn through to the main decode. =20 +&nocp cp + { # Special cases which do not take an early NOCP: VLLDM and VLSTM VLLDM_VLSTM 1110 1100 001 l:1 rn:4 0000 1010 0000 0000 # TODO: VSCCLRM (new in v8.1M) is similar: #VSCCLRM 1110 1100 1-01 1111 ---- 1011 ---- ---0 =20 - NOCP 111- 1110 ---- ---- ---- cp:4 ---- ---- - NOCP 111- 110- ---- ---- ---- cp:4 ---- ---- - # TODO: From v8.1M onwards we will also want this range to NOCP - #NOCP_8_1 111- 1111 ---- ---- ---- ---- ---- ---- cp=3D10 + NOCP 111- 1110 ---- ---- ---- cp:4 ---- ---- &nocp + NOCP 111- 110- ---- ---- ---- cp:4 ---- ---- &nocp + # From v8.1M onwards this range will also NOCP: + NOCP_8_1 111- 1111 ---- ---- ---- ---- ---- ---- &nocp cp=3D10 } diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc index 28e0dba5f14..cc9ffb95887 100644 --- a/target/arm/translate-vfp.c.inc +++ b/target/arm/translate-vfp.c.inc @@ -3459,7 +3459,7 @@ static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VL= LDM_VLSTM *a) return true; } =20 -static bool trans_NOCP(DisasContext *s, arg_NOCP *a) +static bool trans_NOCP(DisasContext *s, arg_nocp *a) { /* * Handle M-profile early check for disabled coprocessor: @@ -3472,7 +3472,11 @@ static bool trans_NOCP(DisasContext *s, arg_NOCP *a) if (a->cp =3D=3D 11) { a->cp =3D 10; } - /* TODO: in v8.1M cp 8, 9, 14, 15 also are governed by the cp10 enable= */ + if (arm_dc_feature(s, ARM_FEATURE_V8_1M) && + (a->cp =3D=3D 8 || a->cp =3D=3D 9 || a->cp =3D=3D 14 || a->cp =3D= =3D 15)) { + /* in v8.1M cp 8, 9, 14, 15 also are governed by the cp10 enable */ + a->cp =3D 10; + } =20 if (a->cp !=3D 10) { gen_exception_insn(s, s->pc_curr, EXCP_NOCP, @@ -3489,6 +3493,15 @@ static bool trans_NOCP(DisasContext *s, arg_NOCP *a) return false; } =20 +static bool trans_NOCP_8_1(DisasContext *s, arg_nocp *a) +{ + /* This range needs a coprocessor check for v8.1M and later only */ + if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { + return false; + } + return trans_NOCP(s, a); +} + static bool trans_VINS(DisasContext *s, arg_VINS *a) { TCGv_i32 rd, rm; --=20 2.20.1 From nobody Sat May 18 07:31:18 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1602518532; cv=none; d=zohomail.com; s=zohoarc; b=f8HJWyIWGBsMJ1IYnFmWgZFgK7CFw1BybkPwXSF0/KyW7dtbMv0paKbsHlwdnOjOL007opJ4/7LlHI1UlnH1sAaznZA9XRT/WeQtoZtPuoraIl4f67VNwl9oA1H8jn1ug4otl55UomXQF+awhHP3autb22K+Yn0swhfLM11dbaY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602518532; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+Umu4egodx5sV5t4RrajGKZ+finJTlLjjG3K3DjBGHw=; b=iJOxdCc3KMaOqDOgdvSzVPCfFB2lfSFwlyeyvFuFmcWmKgRymZBKQs2gk08chwSrLY5Fc7m7Pm3gn0XJJa9JnSNCh+ANuF7pAUIzztU9/l4Y41oJ500e6d1gEZKm9ANJSnnJKgx4xnFeUSpDMQ8/T3SY0wK8vcq4iF6gJImQfXA= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160251853236920.18265857208371; Mon, 12 Oct 2020 09:02:12 -0700 (PDT) Received: from localhost ([::1]:59578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS0H4-0001J0-JH for importer@patchew.org; Mon, 12 Oct 2020 12:02:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRzth-0003eP-Ea for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:01 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:37173) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRztZ-0007le-8g for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:01 -0400 Received: by mail-wr1-x444.google.com with SMTP id h7so19725826wre.4 for ; Mon, 12 Oct 2020 08:37:52 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y66sm7095961wmd.14.2020.10.12.08.37.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 08:37:51 -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=+Umu4egodx5sV5t4RrajGKZ+finJTlLjjG3K3DjBGHw=; b=oHHzeoBV6pWWnUhrUB6FQqWoC3FfjZ+znbu9NgWwx/S2Tb93kiRZSgVJSkGAFStBDQ BuXxmhJCm30jJb7wXkxk5um3y4TSnYzymzhgzhtPwvopgB4cNDd1WZm/8ymaW/OfooA/ u9aPKRId7odG/luRVoOW/AvVgaoobqrtNO0M7/DoSX9VQM6V7V9dkp4353Kt6K7WcyQL Y5dNhdbm5OWGJeh61eVx0uzat6YCjXVyZC8GXeI3rED8cpR7WWqWt0X6U2Z8mWbMmhYA 0kJBgbvZxAxfSB6wp7MnfMmGTt07uBMe7PYYDf9W2l+6asEnmQMmV9pMgpt8mfdSJ563 26Xw== 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=+Umu4egodx5sV5t4RrajGKZ+finJTlLjjG3K3DjBGHw=; b=XL59lp/cdHa8stQ+Yz+Ja2a/A9fTYImdKU/v40DZ9yzX0r2zLn8g/ZOlb1UzIfwsBL IvnCiVTWeXyX6FQ2p3g8+isxf92lPk6oG4d5VlCHRSjTTeBtoO92yI/Q3/jUwFvRkdwJ mI4sopJOSVc49lusi90Zb2can/VIoZCUBwYuuEYfzHpgqYf2KvkeGxLWNPMROG2OYQmm YlZ1HgRs3XCTNzETq3uEikqhWXOoozBSBrzQqtnmuzFLMEPf5iP2xg0p2ZnVI6SJhF2u t6oQsW4cezaKtFHqqo7B87rY1DM9SX8Nq7/uQ7VMIS9wUSw+h1Z2pHasNkcuJFfJtAiH GAvw== X-Gm-Message-State: AOAM530zZ1i6Y99qIhkYlmVcl+TsmVfE/hJ5BhS7m/JFW+KIGST0GQ9g 1y6THRQmXYkvUiH+3gKgjdxgrA== X-Google-Smtp-Source: ABdhPJwzVOsTtPivXQrUIZKbBSEM2erYgG67mu+RivDJtcX6MpRIBVjF4XYtK/eyqTm1VvgkBiEvAw== X-Received: by 2002:a5d:554b:: with SMTP id g11mr30811881wrw.370.1602517071926; Mon, 12 Oct 2020 08:37:51 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 03/10] target/arm: Implement v8.1M conditional-select insns Date: Mon, 12 Oct 2020 16:37:39 +0100 Message-Id: <20201012153746.9996-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201012153746.9996-1-peter.maydell@linaro.org> References: <20201012153746.9996-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::444; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" v8.1M brings four new insns to M-profile: * CSEL : Rd =3D cond ? Rn : Rm * CSINC : Rd =3D cond ? Rn : Rm+1 * CSINV : Rd =3D cond ? Rn : ~Rm * CSNEG : Rd =3D cond ? Rn : -Rm Implement these. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/t32.decode | 3 +++ target/arm/translate.c | 55 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/target/arm/t32.decode b/target/arm/t32.decode index 7069d821fde..d8454bd814e 100644 --- a/target/arm/t32.decode +++ b/target/arm/t32.decode @@ -90,6 +90,9 @@ SBC_rrri 1110101 1011 . .... 0 ... .... .... ....= @s_rrr_shi } RSB_rrri 1110101 1110 . .... 0 ... .... .... .... @s_rrr_shi =20 +# v8.1M CSEL and friends +CSEL 1110101 0010 1 rn:4 10 op:2 rd:4 fcond:4 rm:4 + # Data-processing (register-shifted register) =20 MOV_rxrr 1111 1010 0 shty:2 s:1 rm:4 1111 rd:4 0000 rs:4 \ diff --git a/target/arm/translate.c b/target/arm/translate.c index d34c1d351a6..a7923a31b56 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8224,6 +8224,61 @@ static bool trans_IT(DisasContext *s, arg_IT *a) return true; } =20 +/* v8.1M CSEL/CSINC/CSNEG/CSINV */ +static bool trans_CSEL(DisasContext *s, arg_CSEL *a) +{ + TCGv_i32 rn, rm, zero; + DisasCompare c; + + if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { + return false; + } + + if (a->rd =3D=3D 13 || a->rd =3D=3D 15 || a->rn =3D=3D 13 || a->fcond = >=3D 14) { + /* CONSTRAINED UNPREDICTABLE: we choose to UNDEF */ + return false; + } + + /* In this insn input reg fields of 0b1111 mean "zero", not "PC" */ + if (a->rn =3D=3D 15) { + rn =3D tcg_const_i32(0); + } else { + rn =3D load_reg(s, a->rn); + } + if (a->rm =3D=3D 15) { + rm =3D tcg_const_i32(0); + } else { + rm =3D load_reg(s, a->rm); + } + + switch (a->op) { + case 0: /* CSEL */ + break; + case 1: /* CSINC */ + tcg_gen_addi_i32(rm, rm, 1); + break; + case 2: /* CSINV */ + tcg_gen_not_i32(rm, rm); + break; + case 3: /* CSNEG */ + tcg_gen_neg_i32(rm, rm); + break; + default: + g_assert_not_reached(); + } + + arm_test_cc(&c, a->fcond); + zero =3D tcg_const_i32(0); + tcg_gen_movcond_i32(c.cond, rn, c.value, zero, rn, rm); + arm_free_cc(&c); + tcg_temp_free_i32(zero); + + store_reg(s, a->rd, rn); + tcg_temp_free_i32(rm); + + return true; +} + /* * Legacy decoder. */ --=20 2.20.1 From nobody Sat May 18 07:31:18 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1602518682; cv=none; d=zohomail.com; s=zohoarc; b=Z0BYS9ByDpxNCghsRASbEp2dtYv/1pCf+OVqKvaH71JE6GRg8sdzbvPWELUY8/N88Jz02806OEcS8yujHrHPcGkWyIrDAWTW7vs91ka+5SEZh1CrteWXhbPeTenq8LMRFM9Ta5/X7V19Pn5jFGZ2ujU0f0gSWLvfm8DdGNSnkzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602518682; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pVy88bjQ6oUom6zlEL/l8GFHzZ3l3YhMBHhw5mIWpLU=; b=VyjCIrRLAbX69OX66Fo9DjsMgCbX54aU0GFep/8ye2LDx73bDORsO9c+7o+My5zseBzr/zWGH88gmanP7yIjbSSOkVFO9s8eKouhUC5LaFfaCE+5YlRBIAKcBvnvAP44aZSfCszOO0yYVwjPJ4EEN1at1/qFj+WqQ1PlB69tyd0= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602518682087785.3120151040139; Mon, 12 Oct 2020 09:04:42 -0700 (PDT) Received: from localhost ([::1]:40936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS0JU-0005AT-Ui for importer@patchew.org; Mon, 12 Oct 2020 12:04:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRzti-0003gD-9A for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:02 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:36631) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRzta-0007lu-DE for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:01 -0400 Received: by mail-wm1-x342.google.com with SMTP id e2so17980740wme.1 for ; Mon, 12 Oct 2020 08:37:53 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y66sm7095961wmd.14.2020.10.12.08.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 08:37:52 -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=pVy88bjQ6oUom6zlEL/l8GFHzZ3l3YhMBHhw5mIWpLU=; b=UaSav1qT/HF9VDXaf7GvktosHSLrfpM5XL+7ocwJoJ6W/6T0siB7ag0zifJ/3bnvJM oAcYheet78yFETeTDYtaWXI02K+jWMHTzPKzKL4IcICDflysRfz67XeuCx4k6CLi19dd /nwhqq2pTCtflxRWoc2hakUxWOz3YvliKcCmNktT3slVtgAWV2edPQjEeSCimBPwr8HA 2vsteglTKaQKdKbM1WBv0v/PllACDdZ9rQr/59YADuAy6Y5mvIFhzhQvPt55IpFcc5b4 9RWvp/lsi+SYqppMyPHsu3paOhxOMWCYEze4QbS4nNh6IggUEkvYuSVX150n9bWQMkKS uaRA== 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=pVy88bjQ6oUom6zlEL/l8GFHzZ3l3YhMBHhw5mIWpLU=; b=naPIOpIYZAvU5h5OC5ZCeyZZo3lHmsSx/zmdel5qEsdAyW+4qUA2291AUUXHEZsFfx LI9Gv4Xiu6i9ncTpdwbnu9IsyV6kVl1pddrNuMUx71qdhlEv6CZOtTcvvYeawENcERMW ymzs/1pbrYmUuRPBJJd9Olwk0ZEYW/POnp5GIh10cTCMrB5RyBw75SqMT2lgs4mhlHNV 1bV+Isexali6Muu0ThIPBZIT7R+JcBo9kQk4uBxrGn4NQ+6K5puC0ejDg3Ur6tdlTU2c c0d839xnVENI0O7Dl2Ef9kSvoMfchm3sCTlW/GANgaezy6bKfh5UnDHeXc7YVoDZT5TL 9g1w== X-Gm-Message-State: AOAM531SOSkoQvMDncjZJB/bnymT3H82KIwfmGS/8Qvxnz+6AtGGgniw oew+wg4I5KYtWcZE5lCqxQA0Ig== X-Google-Smtp-Source: ABdhPJwQa0GzV+Pt+sSH2vIoYurYdWY/bhKwBzBJRBmWcT9qSb8+KVEk7LUcNe/c0nTrrMUIfGVtNQ== X-Received: by 2002:a1c:4d05:: with SMTP id o5mr11028771wmh.94.1602517073036; Mon, 12 Oct 2020 08:37:53 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 04/10] target/arm: Make the t32 insn[25:23]=111 group non-overlapping Date: Mon, 12 Oct 2020 16:37:40 +0100 Message-Id: <20201012153746.9996-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201012153746.9996-1-peter.maydell@linaro.org> References: <20201012153746.9996-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::342; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" The t32 decode has a group which represents a set of insns which overlap with B_cond_thumb because they have [25:23]=3D111 (which is an invalid condition code field for the branch insn). This group is currently defined using the {} overlap-OK syntax, but it is almost entirely non-overlapping patterns. Switch it over to use a non-overlapping group. For this to be valid syntactically, CPS must move into the same overlapping-group as the hint insns (CPS vs hints was the only actual use of the overlap facility for the group). The non-overlapping subgroup for CLREX/DSB/DMB/ISB/SB is no longer necessary and so we can remove it (promoting those insns to be members of the parent group). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- Just a minor bit of tidying that I did while I was trying to work out whether the v8.1M loop/branch insns needed to go in this group. (As it turns out, they don't.) --- target/arm/t32.decode | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/target/arm/t32.decode b/target/arm/t32.decode index d8454bd814e..7d5e000e82c 100644 --- a/target/arm/t32.decode +++ b/target/arm/t32.decode @@ -296,8 +296,8 @@ CLZ 1111 1010 1011 ---- 1111 .... 1000 ...= . @rdm { # Group insn[25:23] =3D 111, which is cond=3D111x for the branch below, # or unconditional, which would be illegal for the branch. - { - # Hints + [ + # Hints, and CPS { YIELD 1111 0011 1010 1111 1000 0000 0000 0001 WFE 1111 0011 1010 1111 1000 0000 0000 0010 @@ -310,20 +310,18 @@ CLZ 1111 1010 1011 ---- 1111 .... 1000 .= ... @rdm # The canonical nop ends in 0000 0000, but the whole rest # of the space is "reserved hint, behaves as nop". NOP 1111 0011 1010 1111 1000 0000 ---- ---- + + # If imod =3D=3D '00' && M =3D=3D '0' then SEE "Hint instructions", = above. + CPS 1111 0011 1010 1111 1000 0 imod:2 M:1 A:1 I:1 F:1 mode:5 \ + &cps } =20 - # If imod =3D=3D '00' && M =3D=3D '0' then SEE "Hint instructions", ab= ove. - CPS 1111 0011 1010 1111 1000 0 imod:2 M:1 A:1 I:1 F:1 mode:5 \ - &cps - # Miscellaneous control - [ - CLREX 1111 0011 1011 1111 1000 1111 0010 1111 - DSB 1111 0011 1011 1111 1000 1111 0100 ---- - DMB 1111 0011 1011 1111 1000 1111 0101 ---- - ISB 1111 0011 1011 1111 1000 1111 0110 ---- - SB 1111 0011 1011 1111 1000 1111 0111 0000 - ] + CLREX 1111 0011 1011 1111 1000 1111 0010 1111 + DSB 1111 0011 1011 1111 1000 1111 0100 ---- + DMB 1111 0011 1011 1111 1000 1111 0101 ---- + ISB 1111 0011 1011 1111 1000 1111 0110 ---- + SB 1111 0011 1011 1111 1000 1111 0111 0000 =20 # Note that the v7m insn overlaps both the normal and banked insn. { @@ -351,7 +349,7 @@ CLZ 1111 1010 1011 ---- 1111 .... 1000 ...= . @rdm HVC 1111 0111 1110 .... 1000 .... .... .... \ &i imm=3D%imm16_16_0 UDF 1111 0111 1111 ---- 1010 ---- ---- ---- - } + ] B_cond_thumb 1111 0. cond:4 ...... 10.0 ............ &ci imm=3D%i= mm21 } =20 --=20 2.20.1 From nobody Sat May 18 07:31:18 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1602518670; cv=none; d=zohomail.com; s=zohoarc; b=BK8X8QhaJH4U+S4MD6EV8IuM8KgJCNUv84J4BOPejpRQ1mnxN23aZvLIMH4NCSgNkJV5oLKi8j6YWI7bzXf2Cta6dT70eAx5Qm2yo4WIcQ4FpUW1hN3+SW0BzcxFSpL2fUQWwMvGKu5VMxn44jH3FOVhdxRWWjJAecDAjffoeQI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602518670; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WGIKi5XPkewNmleyCkypYY54M4r98inEKdT2tfEXL/0=; b=TI42e0WcJofZ0RlR/JR/3Uw1HI9KQtLgsHYgH1w+uoiAhVCeCC+//tfFmBCPXNEprk/SEuctvzU/Jdu2+kHqd/SnS46hZOQsGEUA8+dcTZnNVPdMaFo5WbxtJwp+9bsczt3onqk+rK+y90cdd/F3W1a/WzS6bsBTM4SsWrg5LLo= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602518670826435.1209856281216; Mon, 12 Oct 2020 09:04:30 -0700 (PDT) Received: from localhost ([::1]:40040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS0JJ-0004nw-5o for importer@patchew.org; Mon, 12 Oct 2020 12:04:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRzti-0003gh-Pu for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:02 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:35338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRztf-0007m4-Bg for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:02 -0400 Received: by mail-wr1-x442.google.com with SMTP id n15so19718084wrq.2 for ; Mon, 12 Oct 2020 08:37:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y66sm7095961wmd.14.2020.10.12.08.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 08:37:53 -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=WGIKi5XPkewNmleyCkypYY54M4r98inEKdT2tfEXL/0=; b=TuAH7i1OAguRSfZl7FwM4jqebo4oN1y474tB9WPZLLndOHpeBnzxAN7AdzrMJss4qy wtZqwvH1YKdk9TJd3d1+fKX3v/z+/ghmbViE38Uxj39GgdNluU1jX5hZhyCStpqLPss2 tAhuweaAIgiscXv/y51GHcQZjhpx1ManRflBHoBOBhKMelI+SdGRV5gWEfU2a5Ns4gs2 VROVmEjD/3fw45vBGf3BvtgNCcXYpASfnA6zmSoxKX2p06d6Wnk636Z3Lb9sOslftn4N BFo4N59jAy4hFBgRLi0Kj9g6BqjxmtzwW/03kN+faYDDv2cxGfN8qQ4ypkbzklpn8Qne NVMQ== 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=WGIKi5XPkewNmleyCkypYY54M4r98inEKdT2tfEXL/0=; b=r8wHIatH1kLsq8z56sTjiowIm0c2Yqg7KRvDejx1U1Wt2UdHpcktK3nLQaa+m4nX7O 2RfLava6GVWgNS5aSgVvSi2/giuU30Vq06EwK5ByERVpmDlQrf6qw8LX2c3b7WKz4p09 0wzs1eHAvbN/n5e0udicZDRPj6HAsF0DBwMjKyfNtzBLJ2hUwW7L0LZvm+kSoDJW246n Pk01OhSty6CWRyob93DsOu/OpNZHoq2UIgxD5a4+ui+G/oP7oKFndeqtEJSq2Npx32RH RW+2xZCeEF+PgtVjjMO9iqBWj4GciTLFbeVGYbiNVIAUhr7lqSCPeFcO9d6QZHV5NIHA Fm9g== X-Gm-Message-State: AOAM533Ct+XF5XP/kJIz0pn91WkmGnIQz0bfDA7IX9ADFjUvAYfN2aXq FqE4IEyrTEBf5ic6/tzXub8iXRT8S+iMDpgO X-Google-Smtp-Source: ABdhPJzh23Ql7c4Zbq9AXnX4Img9g8YrKyVVnLZP3CtpJbuKpM2ZouTEJ1o4fEaCCZjuXSmyjA287g== X-Received: by 2002:a5d:6a51:: with SMTP id t17mr14303446wrw.80.1602517074090; Mon, 12 Oct 2020 08:37:54 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 05/10] target/arm: Don't allow BLX imm for M-profile Date: Mon, 12 Oct 2020 16:37:41 +0100 Message-Id: <20201012153746.9996-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201012153746.9996-1-peter.maydell@linaro.org> References: <20201012153746.9996-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::442; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" The BLX immediate insn in the Thumb encoding always performs a switch from Thumb to Arm state. This would be totally useless in M-profile which has no Arm decoder, and so the instruction does not exist at all there. Make the encoding UNDEF for M-profile. (This part of the encoding space is used for the branch-future and low-overhead-loop insns in v8.1M.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/translate.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/arm/translate.c b/target/arm/translate.c index a7923a31b56..0c35efb1014 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7880,6 +7880,14 @@ static bool trans_BLX_i(DisasContext *s, arg_BLX_i *= a) { TCGv_i32 tmp; =20 + /* + * BLX would be useless on M-profile; the encoding space + * is used for other insns from v8.1M onward, and UNDEFs before that. + */ + if (arm_dc_feature(s, ARM_FEATURE_M)) { + return false; + } + /* For A32, ARM_FEATURE_V5 is checked near the start of the uncond blo= ck. */ if (s->thumb && (a->imm & 2)) { return false; --=20 2.20.1 From nobody Sat May 18 07:31:18 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1602518844; cv=none; d=zohomail.com; s=zohoarc; b=boPU7UuatmxSj1qxBUHc+4VKc3UeR1I67KTcnaIoBe9lQiAFTrBJCjMn+zHyAVpUY9F/4NafpEKuyQCarSFYxKAQMBJwPlvtST5OgHlfVdM5WYYDv1wbi75fymnL4VJ7IvkX7ASZ1FZmEuefX4ONGGrKLt8LPNt1xkJHbY41Tlo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602518844; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=opfFFdiJTvPsa0Rt8+QLDrx/1PtCB63M7TE5N8kT7gs=; b=A03JPWiY9xJCJH3PEZuBDV5OBCgwsQXPQdWdSLtSX6gpE7sIK+kxLM89pCCD8aoXxO4rhGt3xCn+2odJiZxVfD4ALfGZOdK2S4JSl6zIpgI2mb26G1nl7hYHlQuB4X3raUQDHkQ/8IGhtNaq+Bp2IbQl8jCFAPBpme2dFjCKLWY= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602518844662742.9858378111626; Mon, 12 Oct 2020 09:07:24 -0700 (PDT) Received: from localhost ([::1]:50474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS0M7-0000jy-GU for importer@patchew.org; Mon, 12 Oct 2020 12:07:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRztm-0003ks-TP for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:07 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:36634) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRztf-0007mG-Hx for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:06 -0400 Received: by mail-wm1-x344.google.com with SMTP id e2so17980872wme.1 for ; Mon, 12 Oct 2020 08:37:56 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y66sm7095961wmd.14.2020.10.12.08.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 08:37:54 -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=opfFFdiJTvPsa0Rt8+QLDrx/1PtCB63M7TE5N8kT7gs=; b=dcitO43sZZUgwbfkLpwyRTR4JtoPcc9v4SgUBWc5WGnpcaF/XqfPfL8X9d3O6NQREN rogrGD7sI625G1VzOwbp6kRL5JpshtvqN7kNLsV2HoeC618Lt/zAY49CvQY+zmXGL5fz 9xH7WNzKYlKfCiXELXDF1FjRL2PXjSVbHxQh15aekYPC4t6LqKtM2H1fY2ipW7NDHZKy FXNxlK5QXA09YGkeO6J029KBVK5Q3O/M4j9WVZOj4EjxhdDV1w+8CP5BYNp48fByBzJG AfwVUiyhBfEEFdSwY+5+HdDzTrysEyU55qiGw/KwbAlBhtnm4kPy7cx7jw6mu6Q1rcUJ t11Q== 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=opfFFdiJTvPsa0Rt8+QLDrx/1PtCB63M7TE5N8kT7gs=; b=UKHt0xChD0Kfa/xNKucaG4Qkd0D8kBOxcDFXN5Z9JkjeJpEcaUvUDT+mu5y/OGQb/9 g5fkObXqnxYD6b2DHUovBGvad7eRToRtSbFPB2SaVI5XQkkuRK8GNpmfNNU1FTnFrG2d Nonzozmsn+JUFsdWNpd79glWQ71PVJevBoAHmIdgo6tOs8EpMuqqfHnTZw2R7YawKOVk rfRZbWVmcNCxLTqIC+dN/HZF3o5PVTTLokCiHeCyZ+lMCmah96o7Q2SAsEF1V8h46MVf kStVjJVqSfdCX3eTPeSJn50E8h/1wFh6vOsiKpP/YcPeuZh4+4EJ+AnXmg1wFNKEPPge 0Fqg== X-Gm-Message-State: AOAM531T9DFOxy0wfN1bvNVJjl/3v7h5AmbjD5ZMnyKmzO5RlQJ+qcBq M5diXnUuQxwxQEuBd2UsANChDd1Xlzd87eth X-Google-Smtp-Source: ABdhPJxQQypodSp76AUEbNyAC56Eh/uBOicOhq9AY/YPyoRpBkb3jDMWwV67DhwDO7xcUXEUT16+tA== X-Received: by 2002:a1c:b6d5:: with SMTP id g204mr11316451wmf.65.1602517075224; Mon, 12 Oct 2020 08:37:55 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 06/10] target/arm: Implement v8.1M branch-future insns (as NOPs) Date: Mon, 12 Oct 2020 16:37:42 +0100 Message-Id: <20201012153746.9996-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201012153746.9996-1-peter.maydell@linaro.org> References: <20201012153746.9996-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::344; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" v8.1M implements a new 'branch future' feature, which is a set of instructions that request the CPU to perform a branch "in the future", when it reaches a particular execution address. In hardware, the expected implementation is that the information about the branch location and destination is cached and then acted upon when execution reaches the specified address. However the architecture permits an implementation to discard this cached information at any point, and so guest code must always include a normal branch insn at the branch point as a fallback. In particular, an implementation is specifically permitted to treat all BF insns as NOPs (which is equivalent to discarding the cached information immediately). For QEMU, implementing this caching of branch information would be complicated and would not improve the speed of execution at all, so we make the IMPDEF choice to implement all BF insns as NOPs. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.h | 6 ++++++ target/arm/t32.decode | 13 ++++++++++++- target/arm/translate.c | 20 ++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 74392fa0295..a432f301f11 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3473,6 +3473,12 @@ static inline bool isar_feature_aa32_arm_div(const A= RMISARegisters *id) return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) > 1; } =20 +static inline bool isar_feature_aa32_lob(const ARMISARegisters *id) +{ + /* (M-profile) low-overhead loops and branch future */ + return FIELD_EX32(id->id_isar0, ID_ISAR0, CMPBRANCH) >=3D 3; +} + static inline bool isar_feature_aa32_jazelle(const ARMISARegisters *id) { return FIELD_EX32(id->id_isar1, ID_ISAR1, JAZELLE) !=3D 0; diff --git a/target/arm/t32.decode b/target/arm/t32.decode index 7d5e000e82c..3015731a8d0 100644 --- a/target/arm/t32.decode +++ b/target/arm/t32.decode @@ -648,4 +648,15 @@ MRC 1110 1110 ... 1 .... .... .... ... 1 = .... @mcr =20 B 1111 0. .......... 10.1 ............ @branch24 BL 1111 0. .......... 11.1 ............ @branch24 -BLX_i 1111 0. .......... 11.0 ............ @branch24 +{ + # BLX_i is non-M-profile only + BLX_i 1111 0. .......... 11.0 ............ @branch24 + # M-profile only: loop and branch insns + [ + # All these BF insns have boff !=3D 0b0000; we NOP them all + BF 1111 0 boff:4 ------- 1100 - ---------- 1 # BFL + BF 1111 0 boff:4 0 ------ 1110 - ---------- 1 # BFCSEL + BF 1111 0 boff:4 10 ----- 1110 - ---------- 1 # BF + BF 1111 0 boff:4 11 ----- 1110 0 0000000000 1 # BFX, BFLX + ] +} diff --git a/target/arm/translate.c b/target/arm/translate.c index 0c35efb1014..9e72d719c6f 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7933,6 +7933,26 @@ static bool trans_BLX_suffix(DisasContext *s, arg_BL= X_suffix *a) return true; } =20 +static bool trans_BF(DisasContext *s, arg_BF *a) +{ + /* + * M-profile branch future insns. The architecture permits an + * implementation to implement these as NOPs (equivalent to + * discarding the LO_BRANCH_INFO cache immediately), and we + * take that IMPDEF option because for QEMU a "real" implementation + * would be complicated and wouldn't execute any faster. + */ + if (!dc_isar_feature(aa32_lob, s)) { + return false; + } + if (a->boff =3D=3D 0) { + /* SEE "Related encodings" (loop insns) */ + return false; + } + /* Handle as NOP */ + return true; +} + static bool op_tbranch(DisasContext *s, arg_tbranch *a, bool half) { TCGv_i32 addr, tmp; --=20 2.20.1 From nobody Sat May 18 07:31:18 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1602518804; cv=none; d=zohomail.com; s=zohoarc; b=VvZ2ZpU0ZSsWFupwFpfF05Nip6k3xN3md16QnK5793700ZJcF0BrbWkXzTKQKqz2jqiKcQx4GylhPJMz2APWCMobZYI0xJWe2fruL/dSQBqiQHixwJSeQyFuR4+1yHpf2b61IgybMec6SD0B+RIpGLZSLulLoqSpI/HdkhAw+/o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602518804; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zEp3FAc4PsK+mUmkw0N3JOzoyYY910pPg+gC5kaj9zw=; b=YxoqU5Cdw8UvsxZy2S9mcCodnOGnDQq+IwwvQx1XEW/xyFYwugfOjQN7+RJ+/b99rsYiLBxApLQTQWm+2fT+IGaZ722nrRq9aHH6AshRIaDVJYEmcXE5+PakY2IGZc6mqnz1KfgEnpFkfovgDycv+lQRLLtW4bvvkDFTOKIH+IA= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602518804117771.8581160704935; Mon, 12 Oct 2020 09:06:44 -0700 (PDT) Received: from localhost ([::1]:48612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS0LS-0008Om-RR for importer@patchew.org; Mon, 12 Oct 2020 12:06:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRztk-0003jY-0X for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:05 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:41293) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRztf-0007mQ-GR for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:03 -0400 Received: by mail-wr1-x444.google.com with SMTP id s9so7600382wro.8 for ; Mon, 12 Oct 2020 08:37:57 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y66sm7095961wmd.14.2020.10.12.08.37.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 08:37:55 -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=zEp3FAc4PsK+mUmkw0N3JOzoyYY910pPg+gC5kaj9zw=; b=PWlVwKBgxWibaA1JLjO/BiaQ2zurAe6XbJXm5jph0VY9HqSgTw053MLU82nG3tIHY4 iw6g0NJ/ZVeC9xuOqYGTVFMwGkElDtOHQDS6Wrsl6UZuBDUVgf26DOzK3u4jSG0GGOm7 luecGGauin/hN6HEMjkGAh3APj/Heekk5G34AyZDR3KTFWMCbIP38hLAB6Vmfo9r7zPH CirNtGjwsFlDioD7O4+BujC1d9pb+DqfbO6GpefdJiWQjio5GfijajOLs6SnUQKHs+OK l67nBIDUy0ZcFYCjJFN1ub76TbTxdg/LgV5uXwtKNXD8Sg/pR+fzpbQvK1yrxKk+yvL1 T1Aw== 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=zEp3FAc4PsK+mUmkw0N3JOzoyYY910pPg+gC5kaj9zw=; b=qw2IZ01rNfzynmbvB65h3A4IV4XUPpNVj4auqwhmtjyEf1jt5pxsMYPh6fOSMTusFW lNR9tOGFmaGu0fXazchLwpSSJ5vLHppxK/NYHJvAQDRAQFgrf1P/qfIj8S5ZDxKcC5Uy 3lRPiCJAOGyScBdBC6AWPnvmrOcszRoEPBtSHSuQCfVwF9CxGkFPwsS0T1Kct7+rO3pX D3uxB6v5WNYjty7LwOhgFSN46U1ojvgSxQm8pVl9Taud81ENsD7vvS4xmG8MolMaCfEb Mlo98Hh7inoL2DMiMzn0LsQlT5UJeyJX/8PT6a8aU7Ef+SxdFCIhHJD8M8fT1l439WSk qUvA== X-Gm-Message-State: AOAM531lgZZ10kJ8ZEufQWj8TVS9tJIJ041j9guAHbkHAkizt5pmtr9U 99jaQkTz83NxTFoZrbY++vnERw== X-Google-Smtp-Source: ABdhPJyBFwRbXdUiw40SJamSgtU0g09UUsuJShpajEkwJBxno9U1pSA1KvSWElJFSqzEs8Bzgulw6Q== X-Received: by 2002:adf:912e:: with SMTP id j43mr30369318wrj.325.1602517076189; Mon, 12 Oct 2020 08:37:56 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 07/10] target/arm: Implement v8.1M low-overhead-loop instructions Date: Mon, 12 Oct 2020 16:37:43 +0100 Message-Id: <20201012153746.9996-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201012153746.9996-1-peter.maydell@linaro.org> References: <20201012153746.9996-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::444; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" v8.1M's "low-overhead-loop" extension has three instructions for looping: * DLS (start of a do-loop) * WLS (start of a while-loop) * LE (end of a loop) The loop-start instructions are both simple operations to start a loop whose iteration count (if any) is in LR. The loop-end instruction handles "decrement iteration count and jump back to loop start"; it also caches the information about the branch back to the start of the loop to improve performance of the branch on subsequent iterations. As with the branch-future instructions, the architecture permits an implementation to discard the LO_BRANCH_INFO cache at any time, and QEMU takes the IMPDEF option to never set it in the first place (equivalent to discarding it immediately), because for us a "real" implementation would be unnecessary complexity. (This implementation only provides the simple looping constructs; the vector extension MVE (Helium) adds some extra variants to handle looping across vectors. We'll add those later when we implement MVE.) Signed-off-by: Peter Maydell --- target/arm/t32.decode | 8 +++++ target/arm/translate.c | 74 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/target/arm/t32.decode b/target/arm/t32.decode index 3015731a8d0..8152739b52b 100644 --- a/target/arm/t32.decode +++ b/target/arm/t32.decode @@ -659,4 +659,12 @@ BL 1111 0. .......... 11.1 ............ = @branch24 BF 1111 0 boff:4 10 ----- 1110 - ---------- 1 # BF BF 1111 0 boff:4 11 ----- 1110 0 0000000000 1 # BFX, BFLX ] + [ + # LE and WLS immediate + %lob_imm 1:10 11:1 !function=3Dtimes_2 + + DLS 1111 0 0000 100 rn:4 1110 0000 0000 0001 + WLS 1111 0 0000 100 rn:4 1100 . .......... 1 imm=3D%lob_i= mm + LE 1111 0 0000 0 f:1 0 1111 1100 . .......... 1 imm=3D%lob_i= mm + ] } diff --git a/target/arm/translate.c b/target/arm/translate.c index 9e72d719c6f..742c219c071 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7953,6 +7953,80 @@ static bool trans_BF(DisasContext *s, arg_BF *a) return true; } =20 +static bool trans_DLS(DisasContext *s, arg_DLS *a) +{ + /* M-profile low-overhead loop start */ + TCGv_i32 tmp; + + if (!dc_isar_feature(aa32_lob, s)) { + return false; + } + if (a->rn =3D=3D 13 || a->rn =3D=3D 15) { + /* CONSTRAINED UNPREDICTABLE: we choose to UNDEF */ + return false; + } + + /* Not a while loop, no tail predication: just set LR to the count */ + tmp =3D load_reg(s, a->rn); + store_reg(s, 14, tmp); + return true; +} + +static bool trans_WLS(DisasContext *s, arg_WLS *a) +{ + /* M-profile low-overhead while-loop start */ + TCGv_i32 tmp; + TCGLabel *nextlabel; + + if (!dc_isar_feature(aa32_lob, s)) { + return false; + } + if (a->rn =3D=3D 13 || a->rn =3D=3D 15) { + /* CONSTRAINED UNPREDICTABLE: we choose to UNDEF */ + return false; + } + + nextlabel =3D gen_new_label(); + tcg_gen_brcondi_i32(TCG_COND_NE, cpu_R[a->rn], 0, nextlabel); + gen_jmp(s, read_pc(s) + a->imm); + + gen_set_label(nextlabel); + tmp =3D load_reg(s, a->rn); + store_reg(s, 14, tmp); + gen_jmp(s, s->base.pc_next); + return true; +} + +static bool trans_LE(DisasContext *s, arg_LE *a) +{ + /* + * M-profile low-overhead loop end. The architecture permits an + * implementation to discard the LO_BRANCH_INFO cache at any time, + * and we take the IMPDEF option to never set it in the first place + * (equivalent to always discarding it immediately), because for QEMU + * a "real" implementation would be complicated and wouldn't execute + * any faster. + */ + TCGv_i32 tmp; + + if (!dc_isar_feature(aa32_lob, s)) { + return false; + } + + if (!a->f) { + /* Not loop-forever. If LR <=3D 1 this is the last loop: do nothin= g. */ + arm_gen_condlabel(s); + tcg_gen_brcondi_i32(TCG_COND_LEU, cpu_R[14], 1, s->condlabel); + /* Decrement LR */ + tmp =3D load_reg(s, 14); + tcg_gen_addi_i32(tmp, tmp, -1); + store_reg(s, 14, tmp); + } + /* Jump back to the loop start */ + gen_jmp(s, read_pc(s) - a->imm); + return true; +} + static bool op_tbranch(DisasContext *s, arg_tbranch *a, bool half) { TCGv_i32 addr, tmp; --=20 2.20.1 From nobody Sat May 18 07:31:18 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1602518733; cv=none; d=zohomail.com; s=zohoarc; b=ZqXGYRaaUh6H4aIMURimYfJDW2srl4RGazcPzAW6Owq/Of7r+3ZFY/zqn7FMpXQplEEIy8IsSLz82KIMy0F7UxPOhbAIfVvOiiPyk9QBfjfav3nfalSCZ5ZepAP9o4oCgZdPTXSYFiK/AY0RBS8weu1AMhJ6UTSu+htYeAjx/G0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602518733; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=karobGThPUBbxRoaP+yKeLZSzAdIl7EhuaiEL3CMR4I=; b=XA/zmPaYmGur5yXfRCkgOeb8yL9/q//A1Rb6OUP2EqrYkmTCQVe//XidljWPnDoNxOKXKJpIboc1Bpgykd2nmnOAcEYotV0/JUiSZJoGz1N7YpX9QuKYhNmAqomOYvo2e3Af+/RhBqQ6IHeBkjNwCwh9+6DwnA+miAaOpVJRxS8= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602518733390602.0368296692295; Mon, 12 Oct 2020 09:05:33 -0700 (PDT) Received: from localhost ([::1]:43264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS0KK-00068J-7Y for importer@patchew.org; Mon, 12 Oct 2020 12:05:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRztn-0003ku-0S for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:07 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:38397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRztf-0007mZ-H5 for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:06 -0400 Received: by mail-wm1-x342.google.com with SMTP id b127so5150029wmb.3 for ; Mon, 12 Oct 2020 08:37:58 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y66sm7095961wmd.14.2020.10.12.08.37.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 08:37:56 -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=karobGThPUBbxRoaP+yKeLZSzAdIl7EhuaiEL3CMR4I=; b=pB1gdTf6L1Hy1roe0BRvGPb8EXrIBhUrtaB+/QVj4KAv+etAljPqtZ+CMfpTatXXU5 PTCmXyMsX4aaf0l5BqBHW3kztsLnAOd0qVsOhcIJ0kUzwZwYjF2BAat89k0XWk5ACnRU vQwGt3Jd5J5kRjfQyj1M7VDXP2S3XSngTGcFG1iu15ss+s2O0e5LuMg7i0BSrxFoZrwO uQ1mZ6k/zJAUJMNtX14faQ8iU6zgvT5mSMTNIQahGmw7BwHjH4gbMQ/WpTEJ3MwWYD8b 26SA9d9tEDuDqk/0WZIKLXnByjvlbI7a2HwilvbrUWVGqjsg7LtsrBjXe3Hb4b8zOaa7 y6Hg== 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=karobGThPUBbxRoaP+yKeLZSzAdIl7EhuaiEL3CMR4I=; b=oPkbPk5oj28gRTecpwMUWlR6G9kNP1JeD+zO5GECl8e00vL6osgQvz/07979FR23uh JZ6Ks5d6sGBcOBsjGiV1g50oFR8VyL0Qk2jqUbb9U2UXzvAsmKr5oHUUTvVjNb8pMXgk J/UPjCMMgIVhnzZmSNKfT0d8CP8eNPs+zLjBVD5nnfUm5vZrHum1E3dj+2HEBUBevoRv CR4WO3n7jTr1gPT6syatRB31bXi5NoaF+OZ44kaPcstlZplmjErLifA2EDn8P2Gm3C2R LWpE75b4gPaMLaBIQsBb4olXK5TR6/ETIwB64y+/vsUVbrIU1IQhvUyEhJJfuIOKq/jN 3AfQ== X-Gm-Message-State: AOAM533jKl93esov9eKo+cFTYnLdY6TJzHpZZGnlB9eGQ6Mnx3r/MNoA GatAgqvmH1z/bM562KJX0DVu+Q== X-Google-Smtp-Source: ABdhPJw0Am8eqctO9howY6+TfcneaCBHujPTjQeL4K6ppinePQxEQ0slLXi2xPwIWrng9xOPQ9FQjw== X-Received: by 2002:a1c:5a06:: with SMTP id o6mr11718388wmb.181.1602517077201; Mon, 12 Oct 2020 08:37:57 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 08/10] target/arm: Fix has_vfp/has_neon ID reg squashing for M-profile Date: Mon, 12 Oct 2020 16:37:44 +0100 Message-Id: <20201012153746.9996-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201012153746.9996-1-peter.maydell@linaro.org> References: <20201012153746.9996-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::342; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" In arm_cpu_realizefn(), if the CPU has VFP or Neon disabled then we squash the ID register fields so that we don't advertise it to the guest. This code was written for A-profile and needs some tweaks to work correctly on M-profile: * A-profile only fields should not be zeroed on M-profile: - MVFR0.FPSHVEC,FPTRAP - MVFR1.SIMDLS,SIMDINT,SIMDSP,SIMDHP - MVFR2.SIMDMISC * M-profile only fields should be zeroed on M-profile: - MVFR1.FP16 In particular, because MVFR1.SIMDHP on A-profile is the same field as MVFR1.FP16 on M-profile this code was incorrectly disabling FP16 support on an M-profile CPU (where has_neon is always false). This isn't a visible bug yet because we don't have any M-profile CPUs with FP16 support, but the change is necessary before we introduce any. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 056319859fb..186ee621a65 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1429,17 +1429,22 @@ static void arm_cpu_realizefn(DeviceState *dev, Err= or **errp) u =3D cpu->isar.mvfr0; u =3D FIELD_DP32(u, MVFR0, FPSP, 0); u =3D FIELD_DP32(u, MVFR0, FPDP, 0); - u =3D FIELD_DP32(u, MVFR0, FPTRAP, 0); u =3D FIELD_DP32(u, MVFR0, FPDIVIDE, 0); u =3D FIELD_DP32(u, MVFR0, FPSQRT, 0); - u =3D FIELD_DP32(u, MVFR0, FPSHVEC, 0); u =3D FIELD_DP32(u, MVFR0, FPROUND, 0); + if (!arm_feature(env, ARM_FEATURE_M)) { + u =3D FIELD_DP32(u, MVFR0, FPTRAP, 0); + u =3D FIELD_DP32(u, MVFR0, FPSHVEC, 0); + } cpu->isar.mvfr0 =3D u; =20 u =3D cpu->isar.mvfr1; u =3D FIELD_DP32(u, MVFR1, FPFTZ, 0); u =3D FIELD_DP32(u, MVFR1, FPDNAN, 0); u =3D FIELD_DP32(u, MVFR1, FPHP, 0); + if (arm_feature(env, ARM_FEATURE_M)) { + u =3D FIELD_DP32(u, MVFR1, FP16, 0); + } cpu->isar.mvfr1 =3D u; =20 u =3D cpu->isar.mvfr2; @@ -1475,16 +1480,18 @@ static void arm_cpu_realizefn(DeviceState *dev, Err= or **errp) u =3D FIELD_DP32(u, ID_ISAR6, FHM, 0); cpu->isar.id_isar6 =3D u; =20 - u =3D cpu->isar.mvfr1; - u =3D FIELD_DP32(u, MVFR1, SIMDLS, 0); - u =3D FIELD_DP32(u, MVFR1, SIMDINT, 0); - u =3D FIELD_DP32(u, MVFR1, SIMDSP, 0); - u =3D FIELD_DP32(u, MVFR1, SIMDHP, 0); - cpu->isar.mvfr1 =3D u; + if (!arm_feature(env, ARM_FEATURE_M)) { + u =3D cpu->isar.mvfr1; + u =3D FIELD_DP32(u, MVFR1, SIMDLS, 0); + u =3D FIELD_DP32(u, MVFR1, SIMDINT, 0); + u =3D FIELD_DP32(u, MVFR1, SIMDSP, 0); + u =3D FIELD_DP32(u, MVFR1, SIMDHP, 0); + cpu->isar.mvfr1 =3D u; =20 - u =3D cpu->isar.mvfr2; - u =3D FIELD_DP32(u, MVFR2, SIMDMISC, 0); - cpu->isar.mvfr2 =3D u; + u =3D cpu->isar.mvfr2; + u =3D FIELD_DP32(u, MVFR2, SIMDMISC, 0); + cpu->isar.mvfr2 =3D u; + } } =20 if (!cpu->has_neon && !cpu->has_vfp) { --=20 2.20.1 From nobody Sat May 18 07:31:18 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1602518948; cv=none; d=zohomail.com; s=zohoarc; b=ETEEzMK2Bv7NIXpB09B9r1ERep8uQ8fSnvL9m0owqjKZE5pWIYxuxy5ozPaefTvXWLzhmUxm/nqIhNRuom/8a4j2Jr4Jk/j9C0LjBt+8a/pknT6od0LynunJ9pQW+iSYhZYUfKYpdowzeDq7T/6s8HVnkMYogOfRwLT4F0KJp2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602518948; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xt8K6d2MSfZD0aUx3007ahLfcJglQMjANJEKAe+3790=; b=GaTUrtC7xnK4Nlp7CPs/xmgaKlrlCEuJHJaOoPW+varSPk3Evbb+mE22ZiZ3fIdvLsthdy2slKuJh2qN9jw1ajT+4JHAYmBAZSCZcxu0nAuSvniqwJcmWkxGHKAds9N3alSfZdGFEfWrW0lvWnc5DcYhdy7Ui8POGPekjsCWNiI= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602518948400644.5444070499432; Mon, 12 Oct 2020 09:09:08 -0700 (PDT) Received: from localhost ([::1]:56490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS0Nn-0003KE-3x for importer@patchew.org; Mon, 12 Oct 2020 12:09:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRztm-0003kr-Rn for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:07 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:33318) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRztf-0007mg-Hl for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:06 -0400 Received: by mail-wr1-x442.google.com with SMTP id b8so6479284wrn.0 for ; Mon, 12 Oct 2020 08:37:59 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y66sm7095961wmd.14.2020.10.12.08.37.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 08:37:57 -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=xt8K6d2MSfZD0aUx3007ahLfcJglQMjANJEKAe+3790=; b=FYE+9Ecvyaoe9jzyxtZsaIzYUKdFehhxLQhRlKWZo3PdXiNEH6joJiRvM4Kr06kFSj VnyWPc7y1HssryWF9Pw1v4yZlqOKvgWg7cijQO5vvvJEPYOfw83Ng1mnGqE/d8Q0sdLv drgrc2eCGo1tLId4USPRk5e0Oq/Z2FsCKUGslXnaVxDzaaKlTYhf1+mYJ+zkT7PxGlPB nnsL/+Mqp6AWqxGpSjRMMXb94z9xeKMIqIhlV+ETMMCdnPVf8Quxz5BuWcWIQsu4iDTA tgaatqkUs6r9S94kmaqN643cWHFcYmfS3oVoiRiDuPTR1Ws76WL7YOr5pKZB+9DAjNBN 3N/g== 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=xt8K6d2MSfZD0aUx3007ahLfcJglQMjANJEKAe+3790=; b=FFdA5l+AlYJFjhC7zRTtFZd/sY0TIz9iUuiTZ6JAMcjZtAYCc+M+1NZdBH5TEb7CKI T/R8ZwIgOli0q+JgyF5hALcN2LJTt7v7LGmKvAzzTiockCN5hxkEFXAuY69GTkDrtkVa 04ETt5RxyHg/S0WlbaD85Xg6D2/8dfiiz+3Et2XWJKG0Qndh/54JMChtIoQMK6akcZPX 3yOj88cpWhpvwotG8Zpu/73kJgHanCorkeKRyTe/mSGVx8EfgGrHSfA7Tf+sCH64SuAC BklTEWBm6swh1pRiS8lcYtJlrcZWG+kE+E69g+ijj+bu+rWjtGlIS7AYFIa80QEXXtBb JoYQ== X-Gm-Message-State: AOAM531gXED8zzMhSH5QMd/l99rtLt9eG88owqgHm04avTpxeTPGXstt OxC16ztlCkxqvAlVue28DTwh5A== X-Google-Smtp-Source: ABdhPJwvDTiuOmwVXrZHDZlDncjXyM10grRVSwA7Q3/oI3pj2RrycaudQYcqfEGi9g1IDCH6lWaF3Q== X-Received: by 2002:adf:fa0e:: with SMTP id m14mr29112212wrr.134.1602517078193; Mon, 12 Oct 2020 08:37:58 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 09/10] target/arm: Implement FPSCR.LTPSIZE for M-profile LOB extension Date: Mon, 12 Oct 2020 16:37:45 +0100 Message-Id: <20201012153746.9996-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201012153746.9996-1-peter.maydell@linaro.org> References: <20201012153746.9996-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::442; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" If the M-profile low-overhead-branch extension is implemented, FPSCR bits [18:16] are a new field LTPSIZE. If MVE is not implemented (currently always true for us) then this field always reads as 4 and ignores writes. These bits used to be the vector-length field for the old short-vector extension, so we need to take care that they are not misinterpreted as setting vec_len. Signed-off-by: Peter Maydell --- target/arm/cpu.c | 5 +++++ target/arm/vfp_helper.c | 25 +++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 186ee621a65..baae826f94f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -255,6 +255,11 @@ static void arm_cpu_reset(DeviceState *dev) uint8_t *rom; uint32_t vecbase; =20 + if (cpu_isar_feature(aa32_lob, cpu)) { + /* LTPSIZE is constant 4 if MVE not implemented */ + env->vfp.xregs[ARM_VFP_FPSCR] |=3D 4 << 16; + } + if (arm_feature(env, ARM_FEATURE_M_SECURITY)) { env->v7m.secure =3D true; } else { diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 5666393ef79..350150adbf1 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -189,8 +189,10 @@ uint32_t vfp_get_fpscr(CPUARMState *env) =20 void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val) { + ARMCPU *cpu =3D env_archcpu(env); + /* When ARMv8.2-FP16 is not supported, FZ16 is RES0. */ - if (!cpu_isar_feature(any_fp16, env_archcpu(env))) { + if (!cpu_isar_feature(any_fp16, cpu)) { val &=3D ~FPCR_FZ16; } =20 @@ -198,8 +200,14 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t = val) /* * M profile FPSCR is RES0 for the QC, STRIDE, FZ16, LEN bits * and also for the trapped-exception-handling bits IxE. + * From v8.1M with the low-overhead-loop extension bits + * [18:16] are used for LTPSIZE and (since we don't implement + * MVE) always read as 4 and ignore writes. */ val &=3D 0xf7c0009f; + if (cpu_isar_feature(aa32_lob, cpu)) { + val |=3D 4 << 16; + } } =20 vfp_set_fpscr_to_host(env, val); @@ -212,9 +220,18 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t = val) * (which are stored in fp_status), and the other RES0 bits * in between, then we clear all of the low 16 bits. */ - env->vfp.xregs[ARM_VFP_FPSCR] =3D val & 0xf7c80000; - env->vfp.vec_len =3D (val >> 16) & 7; - env->vfp.vec_stride =3D (val >> 20) & 3; + if (cpu_isar_feature(aa32_lob, cpu)) { + /* + * M-profile low-overhead-loop extension: [18:16] are LTPSIZE + * and we keep them in vfp.xregs[]. + */ + env->vfp.xregs[ARM_VFP_FPSCR] =3D val & 0xf7cf0000; + } else { + /* Those bits might be the old-style short vector length/stride */ + env->vfp.xregs[ARM_VFP_FPSCR] =3D val & 0xf7c80000; + env->vfp.vec_len =3D (val >> 16) & 7; + env->vfp.vec_stride =3D (val >> 20) & 3; + } =20 /* * The bit we set within fpscr_q is arbitrary; the register as a --=20 2.20.1 From nobody Sat May 18 07:31:18 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1602519050; cv=none; d=zohomail.com; s=zohoarc; b=Oxge/KP2HvWTu9Zjpj7bijOPeSwOh8rNTWlcjLSFe7MepR7c7BTJuGXAyOwAkxLoHKurrEFRoTLmDnogeXeX6JEv1u4m9vAPPys9IsiYU5WlSbYu54kMAiqqVg2m10kpoDNjfNP80y4h/i8mP5EQnZdJUnb3bwLgjDXKtJBRy3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602519050; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WZSOSfAAlnoDbupRBScNRlOixSkOtWYILH234kBr4wY=; b=Wc/UQ1a5I5VRJ7gzClSL5H2tmdSHiwrumIsakRuLjgA6EHRJKQmNZfpIJzoU85CCaiv8bO3wPRg3jwZdBm6plm6dysr0ymoOX1V8axydTQaR5wYAJJ2XYh7Ydq5a16yCTvnLr35dCq2k8j2kX8A/nGVFJRGvsh2EhjD2YABIn80= 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+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602519050128457.934682840518; Mon, 12 Oct 2020 09:10:50 -0700 (PDT) Received: from localhost ([::1]:34856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS0PQ-00068u-Vt for importer@patchew.org; Mon, 12 Oct 2020 12:10:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRztp-0003m1-HQ for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:13 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:55883) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRztg-0007mx-R0 for qemu-devel@nongnu.org; Mon, 12 Oct 2020 11:38:08 -0400 Received: by mail-wm1-x344.google.com with SMTP id a72so6930180wme.5 for ; Mon, 12 Oct 2020 08:38:00 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id y66sm7095961wmd.14.2020.10.12.08.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 08:37:58 -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=WZSOSfAAlnoDbupRBScNRlOixSkOtWYILH234kBr4wY=; b=LTVDKSheZqGSBnYO/3aVAQJtAjLvOvPwCjYLbRXpGUgdT2LDnKyFfwSnI1DQgVUiPA N5oih9/7ubWXYF+xMAdLdz2euJEvlcQQcUA8nWKVUwSV+siO7McijqUGe7sdMzEq0TMU kGnkPSKBUfpaOHApnk1e5qe8piWYHshpS7SqSShiXPp+pIXda7cJU84f1E9BCuY4ig/J Lu4YZ1Du1zU5B9YSsv9CuVcwyevw9QFRtTA4ZFjjzhrqvAgNeOG5CjPJRtVpA1RXNeFE J3BB7IXxFYOFfttA1pBTIJFPTd/zK/ZNjPqOPLsDAQJEwJwOG3FbIQjLtQhD7kLO9Ejo UUcA== 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=WZSOSfAAlnoDbupRBScNRlOixSkOtWYILH234kBr4wY=; b=LqhRwwC/McW3Ew8L5Zma46mGnTLQpG07LhM9OT+qPht5mrIC4eeEZqYrB1Upq9Rme4 aYP6pWexW3g6oYGkgOFHpOYLICSGHTd5hH75SSzvnZBUXQ99NqJCw2Ycdce7RnjsH9/4 9OzEWO9njdmaDa0+0oP09CanBFNSPJ/9JRP33bCPfqeHjTLqvfb/tlCQFJMokSJ7JDAB P6L4Mi8meK363c4uxpgCuNg/QCoPoRhaPs1UZs2ZwbwyO0onwzFPh/fZxD7WVIceF0Hi vfLv16hoIo0VvuSxydOftxlBmQvQzvQuhXeluihOzoLDxHQlPaX2SXchAJic23x6X20X e6Mw== X-Gm-Message-State: AOAM531KbWvVEujnmQBqRm+cIE5cNWTOYVFJK501YPWw8M5mgNW7CoU0 jtwQkU/AuJkvwTsBNDrpZLMCsQ== X-Google-Smtp-Source: ABdhPJwjmtvEj5tvqQrBSHf7395TBIyaY7nOgQ6R3AagEoNgZzIOgIwRs6jxlX5PS8FNW5UwoZJv6g== X-Received: by 2002:a7b:cb44:: with SMTP id v4mr11253890wmj.101.1602517079205; Mon, 12 Oct 2020 08:37:59 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 10/10] target/arm: Fix writing to FPSCR.FZ16 on M-profile Date: Mon, 12 Oct 2020 16:37:46 +0100 Message-Id: <20201012153746.9996-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201012153746.9996-1-peter.maydell@linaro.org> References: <20201012153746.9996-1-peter.maydell@linaro.org> 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=2a00:1450:4864:20::344; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" The M-profile specific part of the sanitizing of the value to be written to the FPSCR used a mask which always zeroed bit 19, which is FZ16. This is incorrect when the CPU supports 16-bit floating point arithmetic, because the bit should be writeable. Code earlier in the function already handles making this bit be RES0 if the CPU doesn't implement the FP16 feature, so we can simply stop masking it out for M-profile. Signed-off-by: Peter Maydell --- target/arm/vfp_helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 350150adbf1..4b0bb2bacfb 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -198,13 +198,14 @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t= val) =20 if (arm_feature(env, ARM_FEATURE_M)) { /* - * M profile FPSCR is RES0 for the QC, STRIDE, FZ16, LEN bits + * M profile FPSCR is RES0 for the QC, STRIDE, LEN bits * and also for the trapped-exception-handling bits IxE. * From v8.1M with the low-overhead-loop extension bits * [18:16] are used for LTPSIZE and (since we don't implement * MVE) always read as 4 and ignore writes. + * FZ16 has already been handled as RES0 above if needed. */ - val &=3D 0xf7c0009f; + val &=3D 0xf7c8009f; if (cpu_isar_feature(aa32_lob, cpu)) { val |=3D 4 << 16; } --=20 2.20.1