aboutsummaryrefslogtreecommitdiff
path: root/target-m68k
diff options
context:
space:
mode:
authorLaurent Vivier <laurent@vivier.eu>2016-01-17 14:34:09 +0100
committerLaurent Vivier <laurent@vivier.eu>2016-10-28 10:38:48 +0200
commitff99b952c8280853801fe14f7ae62d0f87464f7d (patch)
tree65e42501a4d899342da0cc4231d8256afbffce19 /target-m68k
parent8a370c6cb770b618f7eb66628116c25e84588df8 (diff)
target-m68k: cmp manages word and bytes operands
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-m68k')
-rw-r--r--target-m68k/translate.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 0448569ffa..57ac2e572f 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -582,6 +582,13 @@ static void gen_logic_cc(DisasContext *s, TCGv val, int opsize)
set_cc_op(s, CC_OP_LOGIC);
}
+static void gen_update_cc_cmp(DisasContext *s, TCGv dest, TCGv src, int opsize)
+{
+ tcg_gen_mov_i32(QREG_CC_N, dest);
+ tcg_gen_mov_i32(QREG_CC_V, src);
+ set_cc_op(s, CC_OP_CMPB + opsize);
+}
+
static void gen_update_cc_add(TCGv dest, TCGv src, int opsize)
{
gen_ext(QREG_CC_N, dest, opsize, 1);
@@ -2132,10 +2139,9 @@ DISAS_INSN(cmp)
int opsize;
opsize = insn_opsize(insn);
- SRC_EA(env, src, opsize, -1, NULL);
- reg = DREG(insn, 9);
- gen_update_cc_add(reg, src, OS_LONG);
- set_cc_op(s, CC_OP_CMPL);
+ SRC_EA(env, src, opsize, 1, NULL);
+ reg = gen_extend(DREG(insn, 9), opsize, 1);
+ gen_update_cc_cmp(s, reg, src, opsize);
}
DISAS_INSN(cmpa)
@@ -2151,8 +2157,7 @@ DISAS_INSN(cmpa)
}
SRC_EA(env, src, opsize, 1, NULL);
reg = AREG(insn, 9);
- gen_update_cc_add(reg, src, OS_LONG);
- set_cc_op(s, CC_OP_CMPL);
+ gen_update_cc_cmp(s, reg, src, opsize);
}
DISAS_INSN(eor)