From patchwork Mon Aug 31 16:05:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248821 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3464114ilg; Mon, 31 Aug 2020 09:37:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNBqB82G5TjuS9x8yyvY1l3Dse4hYoMc3t/VzKEtuMuluK4/cUcb3+lw84ZRVTEYmZ6Iu9 X-Received: by 2002:a25:2d1e:: with SMTP id t30mr3324340ybt.303.1598891860468; Mon, 31 Aug 2020 09:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598891860; cv=none; d=google.com; s=arc-20160816; b=WxGKiS9jEDFWA0h98moOil3SIS3aDG84y358q9gq3HYNPoQJyF4k3sqkcEicUZEyaG xZ9UGpwq8m35xNrZpXe9BZU6N7oBKqzpGj+1LLxdjRiz6k+IBD2Q0iGsrWlotph4NPRB aAYh2NdbanBumiWnhw7uKPfJbN8e9HIHGgBeYbJTj6gr8zDRNCQqqiHn2kUY27BH4BfW v/FSQZdOdEABmxCMlCFWWBz0T8jdsC+kn7ulFRkQh8qpuslLKcqcadscIhkpbOrJmrLB Qibbq638GdzquvLtsO5P7abb4eBdA7fzHQpZnFhjZX2Ah0x5yLjDooFt3UR8VTAEfRQw E5mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=jA1f7A7ZHCufkuLSHghiR/JDH1zZqdVgsEJ9cK+3ePA=; b=VMymZA0eI9p+3RktU26Mxlhr9e1C6EQW7dWeQYpg4+xel4WqE2xkYH6CSJ9Hh/5B12 NT0QHr4fCW/nb9n0QHU0WE8LD+JYHdaX4FQbWk0E8sKI+AQB6A9B+mr+5VfHiaqrGmCt XhSKg80b/192meXWOElClHU/zO18lPxbSljPN+ySm3c/BiU1sIKPBYZsbmdLNSKUC/9c AIHCVQx4sk8YC5E/Z3ECjIElthHnDuiDXZkzHyxNbPMrKNGyA9DaM0+5d5gSnEFIGh90 Sn9vD++irQc9nFozHHZYwuNikUKQJs6yPILMXkOCsn2gVWVNFqXOtO+zB3TIJRdfGmEd lwMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=F3CV60jv; 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=fail (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 m77si8282429ybm.486.2020.08.31.09.37.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Aug 2020 09:37:40 -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=fail header.i=@linaro.org header.s=google header.b=F3CV60jv; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCmoN-0000Vi-VM for patch@linaro.org; Mon, 31 Aug 2020 12:37:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCmLC-0006Ez-UA for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:30 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:39893) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCmLA-00068a-5v for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:30 -0400 Received: by mail-pj1-x1032.google.com with SMTP id s2so22775pjr.4 for ; Mon, 31 Aug 2020 09:07:27 -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=jA1f7A7ZHCufkuLSHghiR/JDH1zZqdVgsEJ9cK+3ePA=; b=F3CV60jvtEZM5+2d1lMfu24xJ7UAKLp7iODShEc2mjfDtMZ9+TM64wAsRHCsB3TT1g aMjpFspBop/OVnI4KyIjDQLYlKGHFG/Dv4xP6mKnjra/QWtJBDBg81WHrqezc+vCozEM EBLUvAdbD+Gi7PmJa74ISCGhYkk4MBcYIfCLRSZCLMvAB/RD3ARVpCM33JR3AzeebmoX UbIeAzD/xM4GMtNjsTsNKfP75lE+atGdQLJHeVQ8Uhx/f23/jjSIL5Q5VgB9Ymeu/zem qHICHkzSoxbBc6rgVaf49KtbeBKqgAJzNdz8TtWDDfdjrdevDTwC1HMtJ7c+6WpXjhBd +GTw== 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=jA1f7A7ZHCufkuLSHghiR/JDH1zZqdVgsEJ9cK+3ePA=; b=V3ID0m8sqeyHwfe+plQ2GN5pauM5IseRQYuQ+Wm+CQy9rCLjbxSU+PwJZF0GpMxpja qhY+kygjnhBKCBaQQT39RYXVAMeB7qZu1fJkFjTQnCryWp41c+NsomO1kw2WkLFJtZVc 8cHH6s0VptIlsAFA+9UFZGQy8k+dnQ6KkAAJv/ccLRRQKFttDM7eH57hWkmcW46+afc9 V0AzAeLAFtSfDcdCl64xGnE4TInF+wtH+kK43C1+gtRBqyIF3L3m0KPVBZ/0X5wrdRmo oM+ta8IaF68l3JVUh27JW31jNLl1YpYoIhLTgH9yHxjKnOmnlDhNk45UQ/0ZZy6ol6vN gjpA== X-Gm-Message-State: AOAM531JZ5joeIbKU+JMapjwO4DRklJjS8WL3W8nuznmcDplq74hId4T 8iJVnPeglxmm0rQvjCDum/YdPdh1KtMRYA== X-Received: by 2002:a17:90a:9b14:: with SMTP id f20mr87758pjp.214.1598890046306; Mon, 31 Aug 2020 09:07:26 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id gt13sm17218pjb.43.2020.08.31.09.07.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 09:07:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 61/76] target/microblaze: Replace delayed_branch with tb_flags_to_set Date: Mon, 31 Aug 2020 09:05:46 -0700 Message-Id: <20200831160601.833692-62-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831160601.833692-1-richard.henderson@linaro.org> References: <20200831160601.833692-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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: "Edgar E . Iglesias" , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The multi-stage counter can be replaced by clearing D_FLAG, the or'ing in tb_flags_to_set. The jump then happens when D_FLAG is finally cleared. Tested-by: Edgar E. Iglesias Reviewed-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/microblaze/translate.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) -- 2.25.1 diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index c0b586f467..811c92d23b 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -73,7 +73,6 @@ typedef struct DisasContext { uint16_t imm; unsigned int cpustate_changed; - unsigned int delayed_branch; unsigned int tb_flags; unsigned int tb_flags_to_set; int mem_index; @@ -1328,10 +1327,9 @@ static void eval_cond_jmp(DisasContext *dc, TCGv_i32 pc_true, TCGv_i32 pc_false) static void dec_setup_dslot(DisasContext *dc) { - dc->delayed_branch = 2; - dc->tb_flags |= D_FLAG; + dc->tb_flags_to_set |= D_FLAG; if (dc->type_b && (dc->tb_flags & IMM_FLAG)) { - dc->tb_flags |= BIMM_FLAG; + dc->tb_flags_to_set |= BIMM_FLAG; } } @@ -1343,7 +1341,6 @@ static void dec_bcc(DisasContext *dc) cc = EXTRACT_FIELD(dc->ir, 21, 23); dslot = dc->ir & (1 << 25); - dc->delayed_branch = 1; if (dslot) { dec_setup_dslot(dc); } @@ -1419,7 +1416,6 @@ static void dec_br(DisasContext *dc) } } - dc->delayed_branch = 1; if (dslot) { dec_setup_dslot(dc); } @@ -1633,8 +1629,7 @@ static void mb_tr_init_disas_context(DisasContextBase *dcb, CPUState *cs) dc->cpu = cpu; dc->tb_flags = dc->base.tb->flags; - dc->delayed_branch = !!(dc->tb_flags & D_FLAG); - dc->jmp = dc->delayed_branch ? JMP_INDIRECT : JMP_NOJMP; + dc->jmp = dc->tb_flags & D_FLAG ? JMP_INDIRECT : JMP_NOJMP; dc->cpustate_changed = 0; dc->abort_at_next_insn = 0; dc->ext_imm = dc->base.tb->cs_base; @@ -1705,11 +1700,11 @@ static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs) tcg_gen_discard_i32(cpu_imm); } - dc->tb_flags &= ~IMM_FLAG; + dc->tb_flags &= ~(IMM_FLAG | BIMM_FLAG | D_FLAG); dc->tb_flags |= dc->tb_flags_to_set; dc->base.pc_next += 4; - if (dc->delayed_branch && --dc->delayed_branch == 0) { + if (dc->jmp != JMP_NOJMP && !(dc->tb_flags & D_FLAG)) { if (dc->tb_flags & DRTI_FLAG) { do_rti(dc); } @@ -1719,8 +1714,6 @@ static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs) if (dc->tb_flags & DRTE_FLAG) { do_rte(dc); } - /* Clear the delay slot flag. */ - dc->tb_flags &= ~D_FLAG; dc->base.is_jmp = DISAS_JUMP; }