Skip to content

Commit

Permalink
target/mips: Support the R5900 PCPYLD multimedia instruction [#4]
Browse files Browse the repository at this point in the history
Signed-off-by: Fredrik Noring <noring@nocrew.org>
  • Loading branch information
frno7 committed Mar 2, 2019
1 parent 9310416 commit 499f911
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion target/mips/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -27293,11 +27293,35 @@ static void decode_mmi1(CPUMIPSState *env, DisasContext *ctx)
}
}

static void gen_mmi_pcpyld(DisasContext *ctx)
{
int rs = extract32(ctx->opcode, 21, 5);
int rt = extract32(ctx->opcode, 16, 5);
int rd = extract32(ctx->opcode, 11, 5);

if (rd != 0) {
if (rs != 0) {
tcg_gen_mov_i64(cpu_mmr[rd], cpu_gpr[rs]);
} else {
tcg_gen_movi_i64(cpu_mmr[rd], 0);
}

if (rt != 0) {
tcg_gen_mov_i64(cpu_gpr[rd], cpu_gpr[rt]);
} else {
tcg_gen_movi_i64(cpu_gpr[rd], 0);
}
}
}

static void decode_mmi2(CPUMIPSState *env, DisasContext *ctx)
{
uint32_t opc = MASK_MMI2(ctx->opcode);

switch (opc) {
case MMI_OPC_2_PCPYLD:
gen_mmi_pcpyld(ctx);
break;
case MMI_OPC_2_PMADDW: /* TODO: MMI_OPC_2_PMADDW */
case MMI_OPC_2_PSLLVW: /* TODO: MMI_OPC_2_PSLLVW */
case MMI_OPC_2_PSRLVW: /* TODO: MMI_OPC_2_PSRLVW */
Expand All @@ -27307,7 +27331,6 @@ static void decode_mmi2(CPUMIPSState *env, DisasContext *ctx)
case MMI_OPC_2_PINTH: /* TODO: MMI_OPC_2_PINTH */
case MMI_OPC_2_PMULTW: /* TODO: MMI_OPC_2_PMULTW */
case MMI_OPC_2_PDIVW: /* TODO: MMI_OPC_2_PDIVW */
case MMI_OPC_2_PCPYLD: /* TODO: MMI_OPC_2_PCPYLD */
case MMI_OPC_2_PMADDH: /* TODO: MMI_OPC_2_PMADDH */
case MMI_OPC_2_PHMADH: /* TODO: MMI_OPC_2_PHMADH */
case MMI_OPC_2_PAND: /* TODO: MMI_OPC_2_PAND */
Expand Down

0 comments on commit 499f911

Please sign in to comment.