On 09/08/2016 03:31 PM, Michael Rolnik wrote:
Signed-off-by: Michael Rolnik <mrol...@gmail.com>
---
target-arc/translate-inst.c | 105 ++++++++++++++++++++++++++++++++++++++++++++
target-arc/translate-inst.h | 4 ++
2 files changed, 109 insertions(+)
diff --git a/target-arc/translate-inst.c b/target-arc/translate-inst.c
index 92c75ac..c3795fe 100644
--- a/target-arc/translate-inst.c
+++ b/target-arc/translate-inst.c
@@ -1546,3 +1546,108 @@ int arc_gen_MPYU(DisasCtxt *ctx, TCGv dest, TCGv src1,
TCGv src2)
return BS_NONE;
}
+/*
+ DIVAW
+*/
+int arc_gen_DIVAW(DisasCtxt *ctx, TCGv dest, TCGv src1, TCGv src2)
+{
+ TCGLabel *label_else = gen_new_label();
+ TCGLabel *label_done = gen_new_label();
+ TCGv rslt = dest;
+ TCGv temp = dest;
+
+ if (TCGV_EQUAL(dest, src1) || TCGV_EQUAL(dest, src2)) {
+ rslt = tcg_temp_new_i32();
+ }
+
+ /*
+ if (src1 == 0)
+ dest = 0
+ else
+ {
+ src1_temp = src1 << 1
+ if (src1_temp >= src2)
+ dest = ((src1_temp - src2) | 0x0000_0001)
+ else
+ dest = src1_temp
+ }
+ */
Probably better with two movcond instead of branches.
r~