qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH RFC v1 22/29] target-arc: ASLS, ASRS


From: Michael Rolnik
Subject: [Qemu-devel] [PATCH RFC v1 22/29] target-arc: ASLS, ASRS
Date: Fri, 9 Sep 2016 01:32:03 +0300

Signed-off-by: Michael Rolnik <address@hidden>
---
 target-arc/translate-inst.c | 57 +++++++++++++++++++++++++++++++++++++++++++++
 target-arc/translate-inst.h |  3 +++
 2 files changed, 60 insertions(+)

diff --git a/target-arc/translate-inst.c b/target-arc/translate-inst.c
index 2a62f30..524b213 100644
--- a/target-arc/translate-inst.c
+++ b/target-arc/translate-inst.c
@@ -2560,3 +2560,60 @@ int arc_gen_SAT16(DisasCtxt *ctx, TCGv dest, TCGv src1)
     return  BS_NONE;
 }
 
+/*
+    ASLS
+*/
+int arc_gen_ASLS(DisasCtxt *ctx, TCGv dest, TCGv src1, TCGv src2)
+{
+    /* TODO */
+
+    return  BS_NONE;
+}
+
+
+/*
+    ASRS
+*/
+int arc_gen_ASRS(DisasCtxt *ctx, TCGv dest, TCGv src1, TCGv src2)
+{
+    /* TODO: check */
+    TCGv rslt = dest;
+    TCGv shft = tcg_temp_new_i32();
+    TCGLabel *label_pos = gen_new_label();
+    TCGLabel *label_done = gen_new_label();
+
+    if (TCGV_EQUAL(dest, src1) || TCGV_EQUAL(dest, src2)) {
+        rslt = tcg_temp_new_i32();
+    }
+
+    tcg_gen_brcond_tl(TCG_COND_LEU, src2, ctx->smax32, label_pos);
+
+    /*  negative    */
+    tcg_gen_movcond_tl(TCG_COND_GT, shft, src2, ctx->smin5, src2, ctx->smin5);
+    tcg_gen_neg_tl(shft, shft);
+    tcg_gen_shl_tl(rslt, src1, shft);
+
+    tcg_gen_br(label_done);
+
+gen_set_label(label_pos);
+    /*  positive    */
+    tcg_gen_movcond_tl(TCG_COND_LT, shft, src2, ctx->smax5, src2, ctx->smax5);
+    tcg_gen_sar_tl(rslt, src1, shft);
+
+gen_set_label(label_done);
+
+    if (ctx->opt.f) {
+        tcg_gen_setcond_tl(TCG_COND_EQ, cpu_Zf, rslt, ctx->zero);
+        tcg_gen_sari_tl(cpu_Nf, rslt, 31);
+    }
+
+    if (!TCGV_EQUAL(dest, rslt)) {
+        tcg_gen_mov_tl(dest, rslt);
+        tcg_temp_free_i32(rslt);
+    }
+
+    tcg_temp_free_i32(shft);
+
+    return BS_NONE;
+}
+
diff --git a/target-arc/translate-inst.h b/target-arc/translate-inst.h
index c84d989..e2b76d4 100644
--- a/target-arc/translate-inst.h
+++ b/target-arc/translate-inst.h
@@ -156,3 +156,6 @@ int arc_gen_RND16(DisasCtxt *c, TCGv dest, TCGv src1);
 int arc_gen_NEGS(DisasCtxt *c, TCGv dest, TCGv src1);
 int arc_gen_NEGSW(DisasCtxt *c, TCGv dest, TCGv src1);
 
+int arc_gen_ASLS(DisasCtxt *c, TCGv dest, TCGv src1, TCGv src2);
+int arc_gen_ASRS(DisasCtxt *ctx, TCGv dest, TCGv src1, TCGv src2);
+
-- 
2.4.9 (Apple Git-60)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]