@@ -25,4 +25,5 @@ DEF_HELPER_2(lr, tl, env, i32)
DEF_HELPER_2(sr, void, i32, i32)
DEF_HELPER_1(halt, void, env)
DEF_HELPER_1(rtie, void, env)
+DEF_HELPER_1(flush, void, env)
@@ -437,4 +437,7 @@ void helper_rtie(CPUARCState *env)
}
}
-
+void helper_flush(CPUARCState *env)
+{
+ tb_flush((CPUState *)arc_env_get_cpu(env));
+}
@@ -2813,3 +2813,43 @@ int arc_gen_RTIE(DisasCtxt *ctx)
return BS_BRANCH;
}
+/*
+ LPcc
+*/
+int arc_gen_LPcc(DisasCtxt *ctx, TCGv rd, unsigned Q)
+{
+ TCGLabel *label_done = gen_new_label();
+ TCGv t0 = tcg_const_local_i32(ctx->npc);
+
+ /*
+ if cc is false, pc will be updated here
+ pc = pcl + rd
+ */
+ tcg_gen_shli_tl(cpu_pc, rd, 1);
+ tcg_gen_addi_tl(cpu_pc, cpu_pc, ctx->pcl);
+
+ /*
+ if cc is false we will jump to done label
+ */
+ arc_gen_jump_ifnot(ctx, Q, label_done);
+
+ /*
+ cc is true
+ */
+ tcg_gen_movi_tl(t0, ctx->lpe);
+
+ tcg_gen_movi_tl(cpu_lps, ctx->npc);
+ tcg_gen_mov_tl(cpu_lpe, cpu_pc);
+ tcg_gen_movi_tl(cpu_pc, ctx->npc);
+
+ tcg_gen_brcond_tl(TCG_COND_EQ, t0, cpu_lpe, label_done);
+
+ gen_helper_flush(cpu_env);
+
+gen_set_label(label_done);
+
+ tcg_temp_free_i32(t0);
+
+ return BS_BRANCH;
+}
+
@@ -171,3 +171,5 @@ int arc_gen_TRAP(DisasCtxt *c, TCGv src1);
int arc_gen_RTIE(DisasCtxt *c);
+int arc_gen_LPcc(DisasCtxt *ctx, TCGv Rd, unsigned Q);
+
Signed-off-by: Michael Rolnik <mrolnik@gmail.com> --- target-arc/helper.h | 1 + target-arc/op_helper.c | 5 ++++- target-arc/translate-inst.c | 40 ++++++++++++++++++++++++++++++++++++++++ target-arc/translate-inst.h | 2 ++ 4 files changed, 47 insertions(+), 1 deletion(-)