From patchwork Tue Aug 25 20:59:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248324 Delivered-To: patch@linaro.org Received: by 2002:a17:906:6447:0:0:0:0 with SMTP id l7csp14985ejn; Tue, 25 Aug 2020 14:37:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxuGCBJfLupu3gzMYO/YP6e+sGK0OjCUP4farO5OAiAnCO967Cv0AKKfJsUCb3y1Yzku4V X-Received: by 2002:a25:cc44:: with SMTP id l65mr17865862ybf.177.1598391435040; Tue, 25 Aug 2020 14:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598391435; cv=none; d=google.com; s=arc-20160816; b=od3NEaqNydHQHDm2CD2eIDlegIw/UhF6oZaL9LUTyXqB1/rPCVedF8grj61T+Jx1Bl UCh3bV+vnhQH68iltsyAR0GtbvC2rF5n7EmsuHiGatzry5/5+x//gn8NpHVlGP8qagjJ ZhQjx8PpUuOdRCzNee3goHjOZT+H/40c9rlwFaUWe2kFMiynLNlJbOzd9xSxT6XZxV2S 0TT3ICFIM/evHsfsgVIHxQyKhjViMwnu0rpwsZLRTOkp3VkUgZ5A3+NUDT6+YZNjQKXw bcCJ+SnFDbNRRl0K0AGs7hULZ2UKJ5rYf/H6xeUvBPBBbknR3omM5oE5YZ33KMQ0dD+e R7LA== 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=ifoPB2xrefiphamrfMAWhJL0YX7DJDQgoCM7PfPYN9w=; b=mcXC69q5i9tBpocd5pMKTygX7pMhd1QHsHTw09EqrUdK1Pr+PsTNTpZhrA7Qfm+4k7 jQSki3uEVAPXdZuChBpd6v+Av5l8o3q5QmX3+iaflkg51esQwcY+5oNu43IOj42Juad3 xlqYR7HrGUZ0iZj6+WW4WeOI6JLM9GZMcSp5jHzjfzJig3yz9MhVBqfr2DRUtV8jORZj ntxNdQ6XEgf0ISgIIa9NmR0eDdszWN480N1ALVVuJybQXu9X732K49w7YKTCmG1F+lJs CzZFYhcwe7ULfZRLUFt14UjC9q2u6GXOFiC6Eh7vT2RHk7HVpgVvpjL8WwjhharkNgbW 08Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="L8+p6R/N"; 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 j2si102889yba.110.2020.08.25.14.37.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Aug 2020 14:37:15 -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="L8+p6R/N"; 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]:52414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAgd0-0002QQ-DX for patch@linaro.org; Tue, 25 Aug 2020 17:37:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAg4B-0000Ju-Ky for qemu-devel@nongnu.org; Tue, 25 Aug 2020 17:01:15 -0400 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:35622) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kAg49-00021D-N3 for qemu-devel@nongnu.org; Tue, 25 Aug 2020 17:01:15 -0400 Received: by mail-pj1-x1042.google.com with SMTP id g6so130612pjl.0 for ; Tue, 25 Aug 2020 14:01:13 -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=ifoPB2xrefiphamrfMAWhJL0YX7DJDQgoCM7PfPYN9w=; b=L8+p6R/NrJWjvoevG8i0efGK/CaF+nLXFjUrd+5bGITCdM8i2ZMWHVfrMHQeHyyYrA GqRp8pcBH0lawSum/RiwvgwFLZjfjuf5a3UlovS+R8bpFiUazFH2erecDWmaxA3zuVzp cn16Q/dnA4IEaF4h4CIyCGf/udMkD/eWGwgYn66Ok5JtetdGCsAzCQLMzawHkQLquZ83 aae+zYDIqdcZfs3rFGvz0M3MfSJt31jdlXu2BT5hpPt5+W6sOGfSfTeEDdEVAVY7veD7 kbkFUjNTnbRVmuZFhpT5UVGH8gb5f2lQbwqwK3xGaz260nMk+hKrQXGjEwRzHL7gnTeM gZgQ== 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=ifoPB2xrefiphamrfMAWhJL0YX7DJDQgoCM7PfPYN9w=; b=S424+0vNCVpN3F++RLaOdLpe9gZEtAPCPJZomGHAZVX4xLNj5R/twmuc0QZAjqON4T K8/vnAbvGz9J1lWxMDb7KfFN9OrhX7KzWdxAN5ByrJGQjwsCOQGjvCFX5vtC6jOboSLT IyaSiYd3rQd9KNxLt1PfAfs4bSfMWr5pr55guxbM0OxpeBFJoqTurFyxsHU+IWR6jr7t JGasIZwmB+GcB0PBjSIY8AypCbuxRPwyIRcGuGloce3oqUMiwt0CFioSQaVqMBlpkP4V f35BxAojFe0Hgeva6UwNO71gQoLyXkwnHRvoIxXPmQuMhiLaWgrp8bOYvR9DuRmFGOvM cfXg== X-Gm-Message-State: AOAM533jtoL/yEMmC+VbvtnTLhqdCw7h1b9ccClvRp0ioSCl0KIQRIYX D8hu4HiNVTQjA759Sm1BtTfk4/tV4ILL/Q== X-Received: by 2002:a17:90b:2394:: with SMTP id mr20mr47671pjb.56.1598389272047; Tue, 25 Aug 2020 14:01:12 -0700 (PDT) Received: from localhost.localdomain (h216-228-167-147.bendor.dedicated.static.tds.net. [216.228.167.147]) by smtp.gmail.com with ESMTPSA id k4sm16074pgr.87.2020.08.25.14.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 14:01:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 60/77] target/microblaze: Replace delayed_branch with tb_flags_to_set Date: Tue, 25 Aug 2020 13:59:33 -0700 Message-Id: <20200825205950.730499-61-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200825205950.730499-1-richard.henderson@linaro.org> References: <20200825205950.730499-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1042; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1042.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.iglesias@gmail.com 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. 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 18009103c7..3ba2dc1800 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; @@ -1314,10 +1313,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; } } @@ -1329,7 +1327,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); } @@ -1405,7 +1402,6 @@ static void dec_br(DisasContext *dc) } } - dc->delayed_branch = 1; if (dslot) { dec_setup_dslot(dc); } @@ -1625,8 +1621,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; @@ -1697,11 +1692,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); } @@ -1711,8 +1706,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; }