target/mips: Add emulation of MMI instruction PCPYUD

Add emulation of MMI instruction PCPYUD. The emulation is implemented
using TCG front end operations directly to achieve better performance.

Backports commit fd487f83ea92d790559813c5a0a719c30ca9ecde from qemu
This commit is contained in:
Mateja Marjanovic 2019-06-03 11:08:36 -04:00 committed by Lioncash
parent c5e3fc601c
commit 4b272cbe93
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -24590,6 +24590,46 @@ static void gen_mmi_pcpyld(DisasContext *ctx)
}
}
/*
* PCPYUD rd, rs, rt
*
* Parallel Copy Upper Doubleword
*
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-----------+---------+---------+---------+---------+-----------+
* | MMI | rs | rt | rd | PCPYUD | MMI3 |
* +-----------+---------+---------+---------+---------+-----------+
*/
static void gen_mmi_pcpyud(DisasContext *ctx)
{
TCGContext *tcg_ctx = ctx->uc->tcg_ctx;
uint32_t rs, rt, rd;
uint32_t opcode;
opcode = ctx->opcode;
rs = extract32(opcode, 21, 5);
rt = extract32(opcode, 16, 5);
rd = extract32(opcode, 11, 5);
if (rd == 0) {
/* nop */
} else {
if (rs == 0) {
tcg_gen_movi_i64(tcg_ctx, tcg_ctx->cpu_gpr[rd], 0);
} else {
tcg_gen_mov_i64(tcg_ctx, tcg_ctx->cpu_gpr[rd], tcg_ctx->cpu_mmr[rs]);
}
if (rt == 0) {
tcg_gen_movi_i64(tcg_ctx, tcg_ctx->cpu_mmr[rd], 0);
} else {
if (rd != rt) {
tcg_gen_mov_i64(tcg_ctx, tcg_ctx->cpu_mmr[rd], tcg_ctx->cpu_mmr[rt]);
}
}
}
}
#endif
@ -27654,7 +27694,6 @@ static void decode_mmi3(CPUMIPSState *env, DisasContext *ctx)
case MMI_OPC_3_PINTEH: /* TODO: MMI_OPC_3_PINTEH */
case MMI_OPC_3_PMULTUW: /* TODO: MMI_OPC_3_PMULTUW */
case MMI_OPC_3_PDIVUW: /* TODO: MMI_OPC_3_PDIVUW */
case MMI_OPC_3_PCPYUD: /* TODO: MMI_OPC_3_PCPYUD */
case MMI_OPC_3_POR: /* TODO: MMI_OPC_3_POR */
case MMI_OPC_3_PNOR: /* TODO: MMI_OPC_3_PNOR */
case MMI_OPC_3_PEXCH: /* TODO: MMI_OPC_3_PEXCH */
@ -27664,6 +27703,9 @@ static void decode_mmi3(CPUMIPSState *env, DisasContext *ctx)
case MMI_OPC_3_PCPYH:
gen_mmi_pcpyh(ctx);
break;
case MMI_OPC_3_PCPYUD:
gen_mmi_pcpyud(ctx);
break;
default:
MIPS_INVAL("TX79 MMI class MMI3");
generate_exception_end(ctx, EXCP_RI);