From patchwork Thu May 18 12:50:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 683376 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp355394wrt; Thu, 18 May 2023 05:55:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5MrBoJY7vKV+wQMXHeiWKOvLsA0BDBE8GsDeLSUNyDlKx0P4sXyTQmV1SYYVqrsfguxdQ1 X-Received: by 2002:a05:622a:4c:b0:3f5:619a:8933 with SMTP id y12-20020a05622a004c00b003f5619a8933mr5563054qtw.58.1684414516438; Thu, 18 May 2023 05:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684414516; cv=none; d=google.com; s=arc-20160816; b=qhT9CaQaMBRL8eVcnR5SAnQDxndnbeH53DP/kyuMh68qvbdPKaKqSmYkgqbNZ1ziBJ 0QOQSxpBnrkfi47SXJRWqIwK0s1gF+EAta4sHNFcUoSuUiSP8PVHJXzw/QyAvHbVo7f9 Z5+2A1JKwwvaMaLj4CSzq+B0k+dlJHjgQmads12XgXT3GRQAWLPscTf/znfNuFYbYaFA YkPexurLAfhhXynuluosBRxfjGB6T956+v7aOjPYMAmiTMkIvIlqYhK67ehTTxvunJG9 XIOhJ4/nu+UgEqoE+jm0YdJRHM143YDY6sjoQfBp2UH1KrhC0bZP8eEH4XGtThMBXbm6 cCCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=W6KDzoUlerslTQhMby3OQ4q1nBSstouBuvraHtUO/aU=; b=eaWpyQO3tlsGvGru2ECwHfT6aBcr6RRFc6IRIlS0HquVZs/U8sxELit7PzTcMJLc9/ SvHDJObn82rLqVlw+Vvd40ioo+ds+IEanS/Z6jXnpB2H21oEw0/kZr0BMZkK8YTC/r9o UvrxqUCaVZllmWKdYjNHYzfmPG4PathwtL4sD7f0Dz80NOh2z+1e2A5CyqB8lOYMHDuy /jYpCzs0PKWg6TltHDdeHDjyx2e/AndZdY4b7xDqlHaY2Ztqa1vF4SN6V7J5eBcCXmVL lpM9iyKwsKFoBUB6lHE/6hEDJDmXb/OSgoohEkaKZyrftZFznI05Pu3BOrvTMmWZtm8o NAng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=srWVxZYd; 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 m13-20020a05622a054d00b003ef5d34757fsi930271qtx.747.2023.05.18.05.55.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 May 2023 05:55:16 -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=srWVxZYd; 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 1pzd6a-0004JG-Q3; Thu, 18 May 2023 08:51:40 -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 1pzd6T-0004E2-W5 for qemu-devel@nongnu.org; Thu, 18 May 2023 08:51:34 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pzd6N-00081j-UT for qemu-devel@nongnu.org; Thu, 18 May 2023 08:51:31 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3f41d087b3bso20206885e9.0 for ; Thu, 18 May 2023 05:51:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684414278; x=1687006278; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=W6KDzoUlerslTQhMby3OQ4q1nBSstouBuvraHtUO/aU=; b=srWVxZYd2kCDDPVc1wVLUC0M2xfIDKLs7iFrbG/Ye7thv0Rwc1Idq/NzA4l00UdLFx 8eK3hJQSLX6y7b7xYY5k8PRFDNdYo/I7/O0tPNx2bc+l80MYCMmhqUHwyF/6QbpOcYl5 bOCU8wOLdqtmMruPQE5lnoLjZxQ+fpl7Dv4Nf7hlMOtHuBVkLwMAcZ9MNIzEOJO+eHoQ 1cgUwYgNAlqAuqHPDki4WbAf45l/66wSBjhA7Gr3FWOVt9fJwQQTsmzN/1/ezxYY4VJO ZzeThtVQmbKyc5kt1CCmTXXIYQIO31BLRRjHY4iJIPJtsLG7DcUAbQU4ysitk4ySTFqX lOUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684414278; x=1687006278; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W6KDzoUlerslTQhMby3OQ4q1nBSstouBuvraHtUO/aU=; b=KUb7h3fJmGR+j6ZcUHv1t1B33f9GritTKSuTvSxFqBzpe5dieL8p2rqe4SWkjq6Hun xFYmeIL0gGbEvA0fs/kn0Ur3EtokTz/QlZUw48mSlyNK/FKb91qSKKRHz0YN0lLDkY7L TgZEpPfuROfLVa3ZnXwm6apSuMcAk3G2AxmnvKSQVUat2264aR5N2zHXqohyXQC8yspy pbgQcWPvJD1Or8AaOsqmtjm/UusBjknLNhoOMwfNtT2/yeYTu7FKWelJrc9rnYmR/w+h GsgTzJv0JXea+E+Ci0Gq5emhexzM0v3ZJV2/AZdBfalgbFYxJamq7Emj4tyZxJb3iQBs WgtQ== X-Gm-Message-State: AC+VfDzSyWDvO3RE5mgJUfbFh6V2ILngPEQCx3gwTt1lR6niCNXdahXn JkdaEEGbcOkVBtrmxHtFirB3vjAlmOTFDjAirro= X-Received: by 2002:a1c:7409:0:b0:3f1:75b0:dc47 with SMTP id p9-20020a1c7409000000b003f175b0dc47mr1394474wmc.15.1684414278168; Thu, 18 May 2023 05:51:18 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id z21-20020a1c4c15000000b003f42d2f4531sm5201321wmf.48.2023.05.18.05.51.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 05:51:17 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/29] target/arm: Convert TBZ, TBNZ to decodetree Date: Thu, 18 May 2023 13:50:59 +0100 Message-Id: <20230518125107.146421-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230518125107.146421-1-peter.maydell@linaro.org> References: <20230518125107.146421-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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 test-and-branch-immediate insns TBZ and TBNZ to decodetree. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20230512144106.3608981-16-peter.maydell@linaro.org --- target/arm/tcg/a64.decode | 6 ++++++ target/arm/tcg/translate-a64.c | 25 +++++-------------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index f5759a66e7f..09def15863f 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -118,3 +118,9 @@ BL 1 00101 .......................... @branch &cbz rt imm sf nz CBZ sf:1 011010 nz:1 ................... rt:5 &cbz imm=%imm19 + +%imm14 5:s14 !function=times_4 +%imm31_19 31:1 19:5 +&tbz rt imm nz bitpos + +TBZ . 011011 nz:1 ..... .............. rt:5 &tbz imm=%imm14 bitpos=%imm31_19 diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 06619f8a05d..1e5977423a6 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -1352,35 +1352,23 @@ static bool trans_CBZ(DisasContext *s, arg_cbz *a) return true; } -/* Test and branch (immediate) - * 31 30 25 24 23 19 18 5 4 0 - * +----+-------------+----+-------+-------------+------+ - * | b5 | 0 1 1 0 1 1 | op | b40 | imm14 | Rt | - * +----+-------------+----+-------+-------------+------+ - */ -static void disas_test_b_imm(DisasContext *s, uint32_t insn) +static bool trans_TBZ(DisasContext *s, arg_tbz *a) { - unsigned int bit_pos, op, rt; - int64_t diff; DisasLabel match; TCGv_i64 tcg_cmp; - bit_pos = (extract32(insn, 31, 1) << 5) | extract32(insn, 19, 5); - op = extract32(insn, 24, 1); /* 0: TBZ; 1: TBNZ */ - diff = sextract32(insn, 5, 14) * 4; - rt = extract32(insn, 0, 5); - tcg_cmp = tcg_temp_new_i64(); - tcg_gen_andi_i64(tcg_cmp, cpu_reg(s, rt), (1ULL << bit_pos)); + tcg_gen_andi_i64(tcg_cmp, cpu_reg(s, a->rt), 1ULL << a->bitpos); 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; } /* Conditional branch (immediate) @@ -2397,9 +2385,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 0x1b: case 0x5b: /* Test & branch (immediate) */ - disas_test_b_imm(s, insn); - break; case 0x2a: /* Conditional branch (immediate) */ disas_cond_b_imm(s, insn); break;