target-m68k: add exg ops

Backports commit 29cf437da4eeacb46cd7076014d06c85ca47c91d from qemu
This commit is contained in:
Laurent Vivier 2018-02-28 00:35:43 -05:00 committed by Lioncash
parent 56882899be
commit 77b1754376
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -2066,6 +2066,39 @@ DISAS_INSN(eor)
DEST_EA(env, insn, OS_LONG, dest, &addr); DEST_EA(env, insn, OS_LONG, dest, &addr);
} }
static void do_exg(TCGContext *tcg_ctx, TCGv reg1, TCGv reg2)
{
TCGv temp = tcg_temp_new(tcg_ctx);
tcg_gen_mov_i32(tcg_ctx, temp, reg1);
tcg_gen_mov_i32(tcg_ctx, reg1, reg2);
tcg_gen_mov_i32(tcg_ctx, reg2, temp);
tcg_temp_free(tcg_ctx, temp);
}
DISAS_INSN(exg_aa)
{
TCGContext *tcg_ctx = s->uc->tcg_ctx;
/* exchange Dx and Dy */
do_exg(tcg_ctx, DREG(insn, 9), DREG(insn, 0));
}
DISAS_INSN(exg_dd)
{
TCGContext *tcg_ctx = s->uc->tcg_ctx;
/* exchange Ax and Ay */
do_exg(tcg_ctx, AREG(insn, 9), AREG(insn, 0));
}
DISAS_INSN(exg_da)
{
TCGContext *tcg_ctx = s->uc->tcg_ctx;
/* exchange Dx and Ay */
do_exg(tcg_ctx, DREG(insn, 9), AREG(insn, 0));
}
DISAS_INSN(and) DISAS_INSN(and)
{ {
TCGContext *tcg_ctx = s->uc->tcg_ctx; TCGContext *tcg_ctx = s->uc->tcg_ctx;
@ -3231,6 +3264,9 @@ void register_m68k_insns (CPUM68KState *env)
INSN(cmpa, b0c0, f0c0, M68000); INSN(cmpa, b0c0, f0c0, M68000);
INSN(eor, b180, f1c0, CF_ISA_A); INSN(eor, b180, f1c0, CF_ISA_A);
BASE(and, c000, f000); BASE(and, c000, f000);
INSN(exg_dd, c140, f1f8, M68000);
INSN(exg_aa, c148, f1f8, M68000);
INSN(exg_da, c188, f1f8, M68000);
BASE(mulw, c0c0, f0c0); BASE(mulw, c0c0, f0c0);
BASE(addsub, d000, f000); BASE(addsub, d000, f000);
INSN(addx, d180, f1f8, CF_ISA_A); INSN(addx, d180, f1f8, CF_ISA_A);