From patchwork Fri May 12 14:41:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 681176 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp3994068wrs; Fri, 12 May 2023 07:43:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4FQ2JjRa5NnwT5iNq1Sr/Lueu9g+t69vE78nL7dGGqFomTfy5CrsUbBIszZggyxBmEbzEQ X-Received: by 2002:ad4:5961:0:b0:621:4551:c6dc with SMTP id eq1-20020ad45961000000b006214551c6dcmr13153344qvb.39.1683902608150; Fri, 12 May 2023 07:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683902608; cv=none; d=google.com; s=arc-20160816; b=FcYRry7WoHe5MID8DW+JRrFRgwslbCRrVIdNT0C5bof0Qx1OlOGAokWKrgi6s3SzC3 /1OTjzKCbHHUEFltMzEd5ipyd/00SoFjNOTvMBqg4SdZy++U3i3zABPqqUr8Rvc4GwJO gcGPLgNqcgIJEfcZBJndsNdBhmGQN2jFwfre6klGUT6yoPcuhFEgw0ok3oUAXqWRy/CY uIwn8/yfAxFFmmRkhWc2W58gSmLAfYIw8Ohdqs6SANFiTZPmUu4zN1tyGpOWsUGPI/7o +0KlrCfKZvEPy++2/T9xqHXdBb/LN1mbF5YCutCQafeD++rwZLsg9/R8R+tizc6hIitT MMBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b35BwkiFX8fqUrD1Px2IqZe/3AgM9JZzroufYhPa+ao=; b=byJicebLpLnw+BGIyB52b9APw3qOcGtUahMasUUgZVSY5KznlCP+yzR0S8KT8Xxbz/ rlK6ktGWyPXl87iDqKm1whCU1PBkogfTDKAAO6xtLvIkXQ16mi4qSxr/WoCd4iBfl5HS fiFryQQVp7Yn2GkeoEhPI9s4wz8OZvSWl/BXfDcww5HL9yoYDUiOnp0AhRawCnfK3hqe icL+OuGFjxNsKs0tnxTFrRLcY5+pkx8K2h7kG1+F2P31wbI+WP6hvrJN99Dtrwks7722 3D4/LhvDnmqgsFhAl41I9HPF7pJlu1RWKIi1as0j1kFj116iVJroAKpUrOzZk4KeSXcW TwVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T+6MivRR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d7-20020ac85d87000000b003f3875db680si4984264qtx.610.2023.05.12.07.43.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 May 2023 07:43:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T+6MivRR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxTxg-0007Dt-LQ; Fri, 12 May 2023 10:41:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxTxc-00077P-1t for qemu-devel@nongnu.org; Fri, 12 May 2023 10:41:32 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pxTxM-0004jx-BH for qemu-devel@nongnu.org; Fri, 12 May 2023 10:41:31 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f41d087b3bso71927505e9.0 for ; Fri, 12 May 2023 07:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683902475; x=1686494475; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b35BwkiFX8fqUrD1Px2IqZe/3AgM9JZzroufYhPa+ao=; b=T+6MivRRfHt3BSCGB3BusxGwRHqVnDHhfj9xEfoH3GHrSzmrOmRUDMgHQ4Ycmrryjo IrYa9RPZq9Tc+rvZYUn1fZwlzXotwO6j6ZbvDWO3STd3QCeDU/eubyxbmhOzhwDyRxVz Gm1sWD1azfTbu5dF1hKxdM2lV4jT9Ts84bQ20NKJN/pC1iv+r1vW8uxppLYuFS6+tHbU bU4P8TU8lhb2KOPSoax5pjsKn0p2c2KdBR/C9RPtR4BgD3jC1KxHNP5/B37z63JUVE4T rutEdjja6pd5i+9m/aRncZwFxFpO+6GIxhGawHWl8+NwVia9cM6Qx+uTJBEblcaTY61n CjeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683902475; x=1686494475; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b35BwkiFX8fqUrD1Px2IqZe/3AgM9JZzroufYhPa+ao=; b=WQfOndPaU+cADiwkWzy47ciecVYzC870rKhhHniikuYJV9CTytQpJ8Fc51r54vbN2z TZUcItw+/D5/9JelWSrdknDK+5vpI2lRk+idE7RjVjjF4Ho0n98lf8L7QZOgcSai2Xh1 gnlfEOXLIOAK907/5IAgbPIfKP65lsy7lk/4itUc2y/GIZxCFTdAwmuFNiBd48uPoUJX M2CgMBCsA8HtiQfNggH1ND+wf0sEt/YQEJA21lGfyGoEop8aUmuw1Hds7lmZu7n0fETj n+3L2bQhnhs9Ikrf09aEqr65P8MI7/3shdXx4XVI5VycXwiW9Td3DevdVgoCHN2PUPq7 L5fQ== X-Gm-Message-State: AC+VfDxS4t+cbCOLrT2/xvndu94wzgb5eo8NF55DhI7giZD0sSk9hunE qgHtz6BA8Ev99dRpEquIJ2Cnnh8hx5oOQPAcXDk= X-Received: by 2002:a1c:e90c:0:b0:3f1:952a:4bf0 with SMTP id q12-20020a1ce90c000000b003f1952a4bf0mr17441034wmc.33.1683902474982; Fri, 12 May 2023 07:41:14 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id f12-20020a7bcc0c000000b003f17848673fsm28916167wmh.27.2023.05.12.07.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 May 2023 07:41:14 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Richard Henderson Subject: [PATCH 14/20] target/arm: Convert CBZ, CBNZ to decodetree Date: Fri, 12 May 2023 15:41:00 +0100 Message-Id: <20230512144106.3608981-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230512144106.3608981-1-peter.maydell@linaro.org> References: <20230512144106.3608981-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert the compare-and-branch-immediate insns CBZ and CBNZ to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/tcg/a64.decode | 6 ++++++ target/arm/tcg/translate-a64.c | 26 ++++++-------------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index d54c6522028..86220569e13 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -115,3 +115,9 @@ EXTR . 00 100111 . 0 ..... ...... ..... ..... @extract_32 B 0 00101 .......................... @branch BL 1 00101 .......................... @branch + +%imm19 5:s19 !function=times_4 +&cbz rt imm sf nz +@cbz sf:1 ...... nz:1 ................... rt:5 &cbz imm=%imm19 + +CBZ . 011010 . ................... ..... @cbz diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index fe6b4a68288..5da551385bd 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -1334,33 +1334,22 @@ static bool trans_BL(DisasContext *s, arg_i *a) return true; } -/* Compare and branch (immediate) - * 31 30 25 24 23 5 4 0 - * +----+-------------+----+---------------------+--------+ - * | sf | 0 1 1 0 1 0 | op | imm19 | Rt | - * +----+-------------+----+---------------------+--------+ - */ -static void disas_comp_b_imm(DisasContext *s, uint32_t insn) + +static bool trans_CBZ(DisasContext *s, arg_cbz *a) { - unsigned int sf, op, rt; - int64_t diff; DisasLabel match; TCGv_i64 tcg_cmp; - sf = extract32(insn, 31, 1); - op = extract32(insn, 24, 1); /* 0: CBZ; 1: CBNZ */ - rt = extract32(insn, 0, 5); - diff = sextract32(insn, 5, 19) * 4; - - tcg_cmp = read_cpu_reg(s, rt, sf); + tcg_cmp = read_cpu_reg(s, a->rt, a->sf); reset_btype(s); match = gen_disas_label(s); - tcg_gen_brcondi_i64(op ? TCG_COND_NE : TCG_COND_EQ, + tcg_gen_brcondi_i64(a->nz ? TCG_COND_NE : TCG_COND_EQ, tcg_cmp, 0, match.label); gen_goto_tb(s, 0, 4); set_disas_label(s, match); - gen_goto_tb(s, 1, diff); + gen_goto_tb(s, 1, a->imm); + return true; } /* Test and branch (immediate) @@ -2408,9 +2397,6 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) static void disas_b_exc_sys(DisasContext *s, uint32_t insn) { switch (extract32(insn, 25, 7)) { - case 0x1a: case 0x5a: /* Compare & branch (immediate) */ - disas_comp_b_imm(s, insn); - break; case 0x1b: case 0x5b: /* Test & branch (immediate) */ disas_test_b_imm(s, insn); break;