Patchwork [027/111] m68k: add DBcc instruction.

login
register
mail settings
Submitter Bryce Lanham
Date Aug. 17, 2011, 8:46 p.m.
Message ID <1313614076-28878-28-git-send-email-blanham@gmail.com>
Download mbox | patch
Permalink /patch/110393/
State New
Headers show

Comments

Bryce Lanham - Aug. 17, 2011, 8:46 p.m.
From: Andreas Schwab <schwab@linux-m68k.org>

Laurent Vivier <laurent@vivier.eu> writes:

> +    tmp = tcg_temp_new();
> +    tcg_gen_ext16s_i32(tmp, reg);
> +    tcg_gen_addi_i32(tmp, tmp, -1);
> +    gen_partset_reg(OS_WORD, reg, tmp);
> +    tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, l1);

The counter needs to be compared with -1, not 0.

Andreas.
---
 target-m68k/translate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 218210c..d4d2f44 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -939,7 +939,7 @@  DISAS_INSN(dbcc)
     tcg_gen_ext16s_i32(tmp, reg);
     tcg_gen_addi_i32(tmp, tmp, -1);
     gen_partset_reg(OS_WORD, reg, tmp);
-    tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, l1);
+    tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, -1, l1);
     gen_jmp_tb(s, 1, base + offset);
     gen_set_label(l1);
     gen_jmp_tb(s, 0, s->pc);