target: e2k: Fix icont bug.

This commit is contained in:
Denis Drakhnia 2020-12-04 10:18:55 +02:00
parent c5c8c39082
commit 4f3d78cb8e
3 changed files with 10 additions and 18 deletions

View File

@ -313,8 +313,6 @@ static inline void do_commit(DisasContext *ctx)
static inline void do_branch(DisasContext *ctx, target_ulong pc_next)
{
TCGLabel *l0;
if (ctx->ct.type == CT_NONE) {
// FIXME: do not write to e2k_cs.pc if not necessary
tcg_gen_movi_tl(e2k_cs.pc, pc_next);
@ -323,10 +321,12 @@ static inline void do_branch(DisasContext *ctx, target_ulong pc_next)
ctx->base.is_jmp = DISAS_NORETURN;
l0 = gen_new_label();
tcg_gen_brcondi_tl(TCG_COND_NE, e2k_cs.ct_cond, 0, l0);
gen_goto_tb(ctx, TB_EXIT_IDX0, ctx->pc, pc_next);
gen_set_label(l0);
if (ctx->ct.is_branch) {
TCGLabel *l0 = gen_new_label();
tcg_gen_brcondi_tl(TCG_COND_NE, e2k_cs.ct_cond, 0, l0);
gen_goto_tb(ctx, TB_EXIT_IDX0, ctx->pc, pc_next);
gen_set_label(l0);
}
switch(ctx->ct.type) {
case CT_IBRANCH:
@ -446,18 +446,8 @@ static void e2k_tr_tb_stop(DisasContextBase *db, CPUState *cs)
{
DisasContext *ctx = container_of(db, DisasContext, base);
switch(ctx->base.is_jmp) {
case DISAS_NEXT:
case DISAS_TOO_MANY:
if (ctx->ct.type != CT_NONE) {
gen_goto_tb(ctx, TB_EXIT_IDX0, ctx->pc, ctx->base.pc_next);
}
break;
case DISAS_NORETURN:
break;
default:
g_assert_not_reached();
break;
if (ctx->base.is_jmp == DISAS_TOO_MANY) {
gen_goto_tb(ctx, TB_EXIT_IDX0, ctx->pc, ctx->base.pc_next);
}
}

View File

@ -156,6 +156,7 @@ typedef struct {
TCGv_i64 ctpr;
} u;
int wbs;
bool is_branch;
} ControlTransfer;
typedef struct DisasContext {

View File

@ -520,6 +520,7 @@ static void gen_jmp(DisasContext *dc)
TCGv cond = e2k_cs.ct_cond;
TCGv_i64 t0 = tcg_temp_new_i64();
dc->ct.is_branch = true;
e2k_gen_preg(t0, psrc);
tcg_gen_trunc_i64_tl(preg, t0);
gen_is_loop_end(loop_end);