From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: schwab@linux-m68k.org, agraf@suse.de,
Richard Henderson <rth@twiddle.net>,
gerg@uclinux.org, Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH 04/16] target-m68k: add scc/dbcc
Date: Wed, 26 Oct 2016 18:35:54 +0200 [thread overview]
Message-ID: <1477499766-11722-5-git-send-email-laurent@vivier.eu> (raw)
In-Reply-To: <1477499766-11722-1-git-send-email-laurent@vivier.eu>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
target-m68k/translate.c | 65 ++++++++++++++++++++++++++++++++++---------------
1 file changed, 45 insertions(+), 20 deletions(-)
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index a07b6f5..05efd29 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -1008,25 +1008,6 @@ static void gen_jmpcc(DisasContext *s, int cond, TCGLabel *l1)
free_cond(&c);
}
-DISAS_INSN(scc)
-{
- DisasCompare c;
- int cond;
- TCGv reg, tmp;
-
- cond = (insn >> 8) & 0xf;
- gen_cc_cond(&c, s, cond);
-
- tmp = tcg_temp_new();
- tcg_gen_setcond_i32(c.tcond, tmp, c.v1, c.v2);
- free_cond(&c);
-
- reg = DREG(insn, 0);
- tcg_gen_neg_i32(tmp, tmp);
- tcg_gen_deposit_i32(reg, reg, tmp, 0, 8);
- tcg_temp_free(tmp);
-}
-
/* Force a TB lookup after an instruction that changes the CPU state. */
static void gen_lookup_tb(DisasContext *s)
{
@@ -1106,6 +1087,48 @@ static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest)
s->is_jmp = DISAS_TB_JUMP;
}
+DISAS_INSN(scc)
+{
+ DisasCompare c;
+ int cond;
+ TCGv tmp;
+
+ cond = (insn >> 8) & 0xf;
+ gen_cc_cond(&c, s, cond);
+
+ tmp = tcg_temp_new();
+ tcg_gen_setcond_i32(c.tcond, tmp, c.v1, c.v2);
+ free_cond(&c);
+
+ tcg_gen_neg_i32(tmp, tmp);
+ DEST_EA(env, insn, OS_BYTE, tmp, NULL);
+ tcg_temp_free(tmp);
+}
+
+DISAS_INSN(dbcc)
+{
+ TCGLabel *l1;
+ TCGv reg;
+ TCGv tmp;
+ int16_t offset;
+ uint32_t base;
+
+ reg = DREG(insn, 0);
+ base = s->pc;
+ offset = (int16_t)read_im16(env, s);
+ l1 = gen_new_label();
+ gen_jmpcc(s, (insn >> 8) & 0xf, l1);
+
+ 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, -1, l1);
+ gen_jmp_tb(s, 1, base + offset);
+ gen_set_label(l1);
+ gen_jmp_tb(s, 0, s->pc);
+}
+
DISAS_INSN(undef_mac)
{
gen_exception(s, s->pc - 2, EXCP_LINEA);
@@ -3144,7 +3167,9 @@ void register_m68k_insns (CPUM68KState *env)
INSN(jump, 4ec0, ffc0, M68000);
INSN(addsubq, 5000, f080, M68000);
INSN(addsubq, 5080, f0c0, M68000);
- INSN(scc, 50c0, f0f8, CF_ISA_A);
+ INSN(scc, 50c0, f0f8, CF_ISA_A); /* Scc.B Dx */
+ INSN(scc, 50c0, f0c0, M68000); /* Scc.B <EA> */
+ INSN(dbcc, 50c8, f0f8, M68000);
INSN(addsubq, 5080, f1c0, CF_ISA_A);
INSN(tpf, 51f8, fff8, CF_ISA_A);
--
2.7.4
next prev parent reply other threads:[~2016-10-26 16:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-26 16:35 [Qemu-devel] [PATCH 00/16] 680x0 instruction set, part 1 Laurent Vivier
2016-10-26 16:35 ` [Qemu-devel] [PATCH 01/16] target-m68k: add bkpt instruction Laurent Vivier
2016-10-26 21:38 ` Richard Henderson
2016-10-26 16:35 ` [Qemu-devel] [PATCH 02/16] target-m68k: add linkl Laurent Vivier
2016-10-26 16:35 ` [Qemu-devel] [PATCH 03/16] target-m68k: add exg ops Laurent Vivier
2016-10-26 22:07 ` Richard Henderson
2016-10-26 16:35 ` Laurent Vivier [this message]
2016-10-26 22:12 ` [Qemu-devel] [PATCH 04/16] target-m68k: add scc/dbcc Richard Henderson
2016-10-26 16:35 ` [Qemu-devel] [PATCH 05/16] target-m68k: Inline addx, subx, negx Laurent Vivier
2016-10-26 16:35 ` [Qemu-devel] [PATCH 06/16] target-m68k: add addressing modes to not Laurent Vivier
2016-10-26 16:35 ` [Qemu-devel] [PATCH 07/16] target-m68k: eor can manage word and byte operands Laurent Vivier
2016-10-26 16:35 ` [Qemu-devel] [PATCH 08/16] target-m68k: or " Laurent Vivier
2016-10-26 16:35 ` [Qemu-devel] [PATCH 09/16] target-m68k: and " Laurent Vivier
2016-10-26 16:36 ` [Qemu-devel] [PATCH 10/16] target-m68k: suba/adda can manage word operand Laurent Vivier
2016-10-26 16:36 ` [Qemu-devel] [PATCH 11/16] target-m68k: some bit ops cleanup Laurent Vivier
2016-10-26 16:36 ` [Qemu-devel] [PATCH 12/16] target-m68k: introduce byte and word cc_ops Laurent Vivier
2016-10-26 22:26 ` Richard Henderson
2016-10-26 16:36 ` [Qemu-devel] [PATCH 13/16] target-m68k: add addressing modes to neg Laurent Vivier
2016-10-26 16:36 ` [Qemu-devel] [PATCH 14/16] target-m68k: add/sub manage word and byte operands Laurent Vivier
2016-10-26 16:36 ` [Qemu-devel] [PATCH 15/16] target-m68k: cmp manages word and bytes operands Laurent Vivier
2016-10-26 16:36 ` [Qemu-devel] [PATCH 16/16] target-m68k: immediate ops manage word and byte operands Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1477499766-11722-5-git-send-email-laurent@vivier.eu \
--to=laurent@vivier.eu \
--cc=agraf@suse.de \
--cc=gerg@uclinux.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=schwab@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).