Received: from eggs.gnu.org ([2001:4830:134:3::10]:44817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi7sh-0003YM-7o for qemu-devel@nongnu.org; Thu, 08 Sep 2016 18:33:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bi7se-0000pq-2C for qemu-devel@nongnu.org; Thu, 08 Sep 2016 18:33:15 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34006) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi7sd-0000pg-S5 for qemu-devel@nongnu.org; Thu, 08 Sep 2016 18:33:11 -0400 Received: by mail-wm0-x242.google.com with SMTP id w12so203970wmf.1 for ; Thu, 08 Sep 2016 15:33:11 -0700 (PDT) From: Michael Rolnik Date: Fri, 9 Sep 2016 01:32:08 +0300 Message-Id: <1473373930-31547-28-git-send-email-mrolnik@gmail.com> In-Reply-To: <1473373930-31547-1-git-send-email-mrolnik@gmail.com> References: <1473373930-31547-1-git-send-email-mrolnik@gmail.com> Subject: [Qemu-devel] [PATCH RFC v1 27/29] target-arc: LP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Michael Rolnik Signed-off-by: Michael Rolnik --- 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(-) diff --git a/target-arc/helper.h b/target-arc/helper.h index abfd0d2..ef5c12e 100644 --- a/target-arc/helper.h +++ b/target-arc/helper.h @@ -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) diff --git a/target-arc/op_helper.c b/target-arc/op_helper.c index a3f6a46..61e790e 100644 --- a/target-arc/op_helper.c +++ b/target-arc/op_helper.c @@ -437,4 +437,7 @@ void helper_rtie(CPUARCState *env) } } - +void helper_flush(CPUARCState *env) +{ + tb_flush((CPUState *)arc_env_get_cpu(env)); +} diff --git a/target-arc/translate-inst.c b/target-arc/translate-inst.c index 743f2be..87940ed 100644 --- a/target-arc/translate-inst.c +++ b/target-arc/translate-inst.c @@ -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; +} + diff --git a/target-arc/translate-inst.h b/target-arc/translate-inst.h index 8bbac4f..7ea20a0 100644 --- a/target-arc/translate-inst.h +++ b/target-arc/translate-inst.h @@ -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); + -- 2.4.9 (Apple Git-60)