[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 61/76] target/microblaze: Replace delayed_branch with tb_flags_to_
From: |
Richard Henderson |
Subject: |
[PULL 61/76] target/microblaze: Replace delayed_branch with tb_flags_to_set |
Date: |
Mon, 31 Aug 2020 09:05:46 -0700 |
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 <edgar.iglesias@xilinx.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/microblaze/translate.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
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;
}
--
2.25.1
- [PULL 52/76] target/microblaze: Fix cpu unwind for stackprot, (continued)
- [PULL 52/76] target/microblaze: Fix cpu unwind for stackprot, Richard Henderson, 2020/08/31
- [PULL 54/76] target/microblaze: Assert no overlap in flags making up tb_flags, Richard Henderson, 2020/08/31
- [PULL 53/76] target/microblaze: Convert dec_load and dec_store to decodetree, Richard Henderson, 2020/08/31
- [PULL 55/76] target/microblaze: Move bimm to BIMM_FLAG, Richard Henderson, 2020/08/31
- [PULL 56/76] target/microblaze: Fix no-op mb_cpu_transaction_failed, Richard Henderson, 2020/08/31
- [PULL 57/76] target/microblaze: Store "current" iflags in insn_start, Richard Henderson, 2020/08/31
- [PULL 58/76] tcg: Add tcg_get_insn_start_param, Richard Henderson, 2020/08/31
- [PULL 59/76] target/microblaze: Use cc->do_unaligned_access, Richard Henderson, 2020/08/31
- [PULL 60/76] target/microblaze: Replace clear_imm with tb_flags_to_set, Richard Henderson, 2020/08/31
- [PULL 62/76] target/microblaze: Tidy mb_cpu_dump_state, Richard Henderson, 2020/08/31
- [PULL 61/76] target/microblaze: Replace delayed_branch with tb_flags_to_set,
Richard Henderson <=
- [PULL 63/76] target/microblaze: Convert brk and brki to decodetree, Richard Henderson, 2020/08/31
- [PULL 64/76] target/microblaze: Convert mbar to decodetree, Richard Henderson, 2020/08/31
- [PULL 65/76] target/microblaze: Reorganize branching, Richard Henderson, 2020/08/31
- [PULL 66/76] target/microblaze: Convert dec_br to decodetree, Richard Henderson, 2020/08/31
- [PULL 67/76] target/microblaze: Convert dec_bcc to decodetree, Richard Henderson, 2020/08/31
- [PULL 68/76] target/microblaze: Convert dec_rts to decodetree, Richard Henderson, 2020/08/31
- [PULL 69/76] target/microblaze: Tidy do_rti, do_rtb, do_rte, Richard Henderson, 2020/08/31
- [PULL 70/76] target/microblaze: Convert msrclr, msrset to decodetree, Richard Henderson, 2020/08/31
- [PULL 71/76] target/microblaze: Convert dec_msr to decodetree, Richard Henderson, 2020/08/31
- [PULL 72/76] target/microblaze: Convert dec_stream to decodetree, Richard Henderson, 2020/08/31