From nobody Sun Nov 9 12:53:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551113200811779.4339191739132; Mon, 25 Feb 2019 08:46:40 -0800 (PST) Received: from localhost ([127.0.0.1]:40483 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyJOm-0002ab-KV for importer@patchew.org; Mon, 25 Feb 2019 11:46:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyIrY-0000Zd-OC for qemu-devel@nongnu.org; Mon, 25 Feb 2019 11:12:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyIrX-0003Iq-Lh for qemu-devel@nongnu.org; Mon, 25 Feb 2019 11:12:16 -0500 Received: from mx2.rt-rk.com ([89.216.37.149]:53604 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyIrX-0002cb-B5 for qemu-devel@nongnu.org; Mon, 25 Feb 2019 11:12:15 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 241161A207A; Mon, 25 Feb 2019 17:10:54 +0100 (CET) Received: from rtrkw310-lin.domain.local (rtrkw310-lin.domain.local [10.10.13.57]) by mail.rt-rk.com (Postfix) with ESMTPSA id 01FEA1A213B; Mon, 25 Feb 2019 17:10:54 +0100 (CET) X-Virus-Scanned: amavisd-new at rt-rk.com From: Mateja Marjanovic To: qemu-devel@nongnu.org Date: Mon, 25 Feb 2019 17:10:35 +0100 Message-Id: <1551111037-23411-2-git-send-email-mateja.marjanovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551111037-23411-1-git-send-email-mateja.marjanovic@rt-rk.com> References: <1551111037-23411-1-git-send-email-mateja.marjanovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 X-Mailman-Approved-At: Mon, 25 Feb 2019 11:21:37 -0500 Subject: [Qemu-devel] [PATCH 1/3] target/mips: Add emulation of MMI instruction PCPYH X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arikalo@wavecomp.com, amarkovic@wavecomp.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add emulation of MMI instruction PCPYH. The emulation is implemented using TCG front end operations directly to achieve better performance. Signed-off-by: Mateja Marjanovic Reviewed-by: Aleksandar Rikalo --- target/mips/translate.c | 115 ++++++++++++++++++++++++++++++++++++++++++++= ++-- 1 file changed, 112 insertions(+), 3 deletions(-) diff --git a/target/mips/translate.c b/target/mips/translate.c index 3b17020..a3a5f9b 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -4362,6 +4362,7 @@ static void gen_shift(DisasContext *ctx, uint32_t opc, tcg_temp_free(t1); } =20 +#if defined(TARGET_MIPS64) /* Copy GPR to and from TX79 HI1/LO1 register. */ static void gen_HILO1_tx79(DisasContext *ctx, uint32_t opc, int reg) { @@ -4397,6 +4398,7 @@ static void gen_HILO1_tx79(DisasContext *ctx, uint32_= t opc, int reg) break; } } +#endif =20 /* Arithmetic on HI/LO registers */ static void gen_HILO(DisasContext *ctx, uint32_t opc, int acc, int reg) @@ -4746,6 +4748,7 @@ static void gen_r6_muldiv(DisasContext *ctx, int opc,= int rd, int rs, int rt) tcg_temp_free(t1); } =20 +#if defined(TARGET_MIPS64) static void gen_div1_tx79(DisasContext *ctx, uint32_t opc, int rs, int rt) { TCGv t0, t1; @@ -4802,6 +4805,7 @@ static void gen_div1_tx79(DisasContext *ctx, uint32_t= opc, int rs, int rt) tcg_temp_free(t0); tcg_temp_free(t1); } +#endif =20 static void gen_muldiv(DisasContext *ctx, uint32_t opc, int acc, int rs, int rt) @@ -24324,6 +24328,97 @@ static void decode_opc_special(CPUMIPSState *env, = DisasContext *ctx) } =20 =20 +#if defined(TARGET_MIPS64) + + +/* + * + * MMI (MultiMedia Interface) ASE instructions + * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + */ + +/* + * MMI instructions category: data communication + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * PCPYH PEXCH PEXTLB PINTH PPACB PEXT5 PREVH + * PCPYLD PEXCW PEXTLH PINTEH PPACH PPAC5 PROT3W + * PCPYUD PEXCEH PEXTLW PPACW + * PEXCEW PEXTUB + * PEXTUB + * PEXTUB + */ + +/* + * PCPYH rd, rt + * + * Parallel Copy Halfword + * + * 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 |0 0 0 0 0| rt | rd | PCPYH | MMI3 | + * +-----------+---------+---------+---------+---------+-----------+ + */ +static void gen_mmi_pcpyh(DisasContext *ctx) +{ + uint32_t pd, rt, rd; + uint32_t opcode; + + opcode =3D ctx->opcode; + + pd =3D extract32(opcode, 21, 5); + rt =3D extract32(opcode, 16, 5); + rd =3D extract32(opcode, 11, 5); + + if (unlikely(pd !=3D 0)) { + generate_exception_end(ctx, EXCP_RI); + } else if (rd =3D=3D 0) { + /* nop */ + } else if (rt =3D=3D 0) { + tcg_gen_movi_i64(cpu_gpr[rt], 0); + tcg_gen_movi_i64(cpu_mmr[rt], 0); + } else { + TCGv_i64 t0; + TCGv_i64 t1; + TCGv_i64 t2; + uint64_t mask =3D (1ULL << 16) - 1; + + t0 =3D tcg_temp_new(); + t1 =3D tcg_temp_new(); + t2 =3D tcg_temp_new(); + + tcg_gen_andi_i64(t0, cpu_gpr[rt], mask); + tcg_gen_movi_i64(t1, 0); + tcg_gen_or_i64(t1, t0, t1); + tcg_gen_shli_i64(t0, t0, 16); + tcg_gen_or_i64(t1, t0, t1); + tcg_gen_shli_i64(t0, t0, 16); + tcg_gen_or_i64(t1, t0, t1); + tcg_gen_shli_i64(t0, t0, 16); + tcg_gen_or_i64(t1, t0, t1); + + tcg_gen_andi_i64(t0, cpu_mmr[rt], mask); + tcg_gen_movi_i64(t2, 0); + tcg_gen_or_i64(t2, t0, t2); + tcg_gen_shli_i64(t0, t0, 16); + tcg_gen_or_i64(t2, t0, t2); + tcg_gen_shli_i64(t0, t0, 16); + tcg_gen_or_i64(t2, t0, t2); + tcg_gen_shli_i64(t0, t0, 16); + tcg_gen_or_i64(t2, t0, t2); + + tcg_gen_mov_i64(cpu_gpr[rd], t1); + tcg_gen_mov_i64(cpu_mmr[rd], t2); + + tcg_temp_free(t0); + tcg_temp_free(t1); + tcg_temp_free(t2); + } +} + +#endif + + #if !defined(TARGET_MIPS64) =20 /* MXU accumulate add/subtract 1-bit pattern 'aptn1' */ @@ -27247,6 +27342,9 @@ static void decode_opc_special3_legacy(CPUMIPSState= *env, DisasContext *ctx) } } =20 + +#if defined(TARGET_MIPS64) + static void decode_mmi0(CPUMIPSState *env, DisasContext *ctx) { uint32_t opc =3D MASK_MMI0(ctx->opcode); @@ -27370,10 +27468,12 @@ static void decode_mmi3(CPUMIPSState *env, DisasC= ontext *ctx) 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 */ - case MMI_OPC_3_PCPYH: /* TODO: MMI_OPC_3_PCPYH */ case MMI_OPC_3_PEXCW: /* TODO: MMI_OPC_3_PEXCW */ generate_exception_end(ctx, EXCP_RI); /* TODO: MMI_OPC_CLASS_MMI3 = */ break; + case MMI_OPC_3_PCPYH: + gen_mmi_pcpyh(ctx); + break; default: MIPS_INVAL("TX79 MMI class MMI3"); generate_exception_end(ctx, EXCP_RI); @@ -27491,6 +27591,8 @@ static void decode_mmi_sq(CPUMIPSState *env, DisasC= ontext *ctx) gen_mmi_sq(ctx, base, rt, offset); } =20 +#endif + static void decode_opc_special3(CPUMIPSState *env, DisasContext *ctx) { int rs, rt, rd, sa; @@ -28796,10 +28898,11 @@ static void decode_opc(CPUMIPSState *env, DisasCo= ntext *ctx) decode_opc_special(env, ctx); break; case OPC_SPECIAL2: +#if defined(TARGET_MIPS64) if ((ctx->insn_flags & INSN_R5900) && (ctx->insn_flags & ASE_MMI))= { decode_mmi(env, ctx); -#if !defined(TARGET_MIPS64) - } else if (ctx->insn_flags & ASE_MXU) { +#else + if (ctx->insn_flags & ASE_MXU) { decode_opc_mxu(env, ctx); #endif } else { @@ -28807,11 +28910,15 @@ static void decode_opc(CPUMIPSState *env, DisasCo= ntext *ctx) } break; case OPC_SPECIAL3: +#if defined(TARGET_MIPS64) if (ctx->insn_flags & INSN_R5900) { decode_mmi_sq(env, ctx); /* MMI_OPC_SQ */ } else { decode_opc_special3(env, ctx); } +#else + decode_opc_special3(env, ctx); +#endif break; case OPC_REGIMM: op1 =3D MASK_REGIMM(ctx->opcode); @@ -29483,7 +29590,9 @@ static void decode_opc(CPUMIPSState *env, DisasCont= ext *ctx) break; case OPC_MSA: /* OPC_MDMX */ if (ctx->insn_flags & INSN_R5900) { +#if defined(TARGET_MIPS64) gen_mmi_lq(env, ctx); /* MMI_OPC_LQ */ +#endif } else { /* MDMX: Not implemented. */ gen_msa(env, ctx); --=20 2.7.4 From nobody Sun Nov 9 12:53:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551112841551326.03969072839277; Mon, 25 Feb 2019 08:40:41 -0800 (PST) Received: from localhost ([127.0.0.1]:40332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyJIy-0006CD-74 for importer@patchew.org; Mon, 25 Feb 2019 11:40:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyIrR-0000TP-HF for qemu-devel@nongnu.org; Mon, 25 Feb 2019 11:12:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyIrQ-0003GD-FO for qemu-devel@nongnu.org; Mon, 25 Feb 2019 11:12:09 -0500 Received: from mx2.rt-rk.com ([89.216.37.149]:53607 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyIrQ-0002cf-7t for qemu-devel@nongnu.org; Mon, 25 Feb 2019 11:12:08 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 2E4201A21E6; Mon, 25 Feb 2019 17:10:54 +0100 (CET) Received: from rtrkw310-lin.domain.local (rtrkw310-lin.domain.local [10.10.13.57]) by mail.rt-rk.com (Postfix) with ESMTPSA id 0CF141A21DA; Mon, 25 Feb 2019 17:10:54 +0100 (CET) X-Virus-Scanned: amavisd-new at rt-rk.com From: Mateja Marjanovic To: qemu-devel@nongnu.org Date: Mon, 25 Feb 2019 17:10:36 +0100 Message-Id: <1551111037-23411-3-git-send-email-mateja.marjanovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551111037-23411-1-git-send-email-mateja.marjanovic@rt-rk.com> References: <1551111037-23411-1-git-send-email-mateja.marjanovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 X-Mailman-Approved-At: Mon, 25 Feb 2019 11:21:37 -0500 Subject: [Qemu-devel] [PATCH 2/3] target/mips: Add emulation of MMI instruction PCPYLD X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arikalo@wavecomp.com, amarkovic@wavecomp.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add emulation of MMI instruction PCPYLD. The emulation is implemented using TCG front end operations directly to achieve better performance. Signed-off-by: Mateja Marjanovic Reviewed-by: Aleksandar Rikalo --- target/mips/translate.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/target/mips/translate.c b/target/mips/translate.c index a3a5f9b..117a29c 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -24416,6 +24416,44 @@ static void gen_mmi_pcpyh(DisasContext *ctx) } } =20 +/* + * PCPYLD rd, rs, rt + * + * Parallel Copy Lower 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 | PCPYLD | MMI2 | + * +-----------+---------+---------+---------+---------+-----------+ + */ +static void gen_mmi_pcpyld(DisasContext *ctx) +{ + uint32_t rs, rt, rd; + uint32_t opcode; + + opcode =3D ctx->opcode; + + rs =3D extract32(opcode, 21, 5); + rt =3D extract32(opcode, 16, 5); + rd =3D extract32(opcode, 11, 5); + + if (rd =3D=3D 0) { + /* nop */ + } else if ((rt =3D=3D 0) && (rs =3D=3D 0)) { + tcg_gen_movi_i64(cpu_gpr[rt], 0); + tcg_gen_movi_i64(cpu_mmr[rt], 0); + } else if (rt =3D=3D 0) { + tcg_gen_movi_i64(cpu_gpr[rd], 0); + tcg_gen_mov_i64(cpu_mmr[rd], cpu_gpr[rs]); + } else if (rs =3D=3D 0) { + tcg_gen_mov_i64(cpu_gpr[rd], cpu_gpr[rt]); + tcg_gen_movi_i64(cpu_mmr[rd], 0); + } else { + tcg_gen_mov_i64(cpu_gpr[rd], cpu_gpr[rt]); + tcg_gen_mov_i64(cpu_mmr[rd], cpu_gpr[rs]); + } +} + #endif =20 =20 @@ -27430,7 +27468,6 @@ static void decode_mmi2(CPUMIPSState *env, DisasCon= text *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 */ @@ -27445,6 +27482,9 @@ static void decode_mmi2(CPUMIPSState *env, DisasCon= text *ctx) case MMI_OPC_2_PROT3W: /* TODO: MMI_OPC_2_PROT3W */ generate_exception_end(ctx, EXCP_RI); /* TODO: MMI_OPC_CLASS_MMI2 = */ break; + case MMI_OPC_2_PCPYLD: + gen_mmi_pcpyld(ctx); + break; default: MIPS_INVAL("TX79 MMI class MMI2"); generate_exception_end(ctx, EXCP_RI); --=20 2.7.4 From nobody Sun Nov 9 12:53:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551113241096402.40071660332444; Mon, 25 Feb 2019 08:47:21 -0800 (PST) Received: from localhost ([127.0.0.1]:40497 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyJPQ-00036r-1x for importer@patchew.org; Mon, 25 Feb 2019 11:47:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyIrU-0000Vn-B8 for qemu-devel@nongnu.org; Mon, 25 Feb 2019 11:12:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyIrT-0003HF-E7 for qemu-devel@nongnu.org; Mon, 25 Feb 2019 11:12:12 -0500 Received: from mx2.rt-rk.com ([89.216.37.149]:53610 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyIrT-0002ci-6m for qemu-devel@nongnu.org; Mon, 25 Feb 2019 11:12:11 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 3D89C1A21DA; Mon, 25 Feb 2019 17:10:54 +0100 (CET) Received: from rtrkw310-lin.domain.local (rtrkw310-lin.domain.local [10.10.13.57]) by mail.rt-rk.com (Postfix) with ESMTPSA id 15C921A21E2; Mon, 25 Feb 2019 17:10:54 +0100 (CET) X-Virus-Scanned: amavisd-new at rt-rk.com From: Mateja Marjanovic To: qemu-devel@nongnu.org Date: Mon, 25 Feb 2019 17:10:37 +0100 Message-Id: <1551111037-23411-4-git-send-email-mateja.marjanovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551111037-23411-1-git-send-email-mateja.marjanovic@rt-rk.com> References: <1551111037-23411-1-git-send-email-mateja.marjanovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 X-Mailman-Approved-At: Mon, 25 Feb 2019 11:21:37 -0500 Subject: [Qemu-devel] [PATCH 3/3] target/mips: Add emulation of MMI instruction PCPYUD X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arikalo@wavecomp.com, amarkovic@wavecomp.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mateja Marjanovic Add emulation of MMI instruction PCPYUD. The emulation is implemented using TCG front end operations directly to achieve better performance. Signed-off-by: Mateja Marjanovic Reviewed-by: Aleksandar Rikalo --- target/mips/translate.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/target/mips/translate.c b/target/mips/translate.c index 117a29c..124f766 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -24454,6 +24454,44 @@ static void gen_mmi_pcpyld(DisasContext *ctx) } } =20 +/* + * 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) +{ + uint32_t rs, rt, rd; + uint32_t opcode; + + opcode =3D ctx->opcode; + + rs =3D extract32(opcode, 21, 5); + rt =3D extract32(opcode, 16, 5); + rd =3D extract32(opcode, 11, 5); + + if (rd =3D=3D 0) { + /* nop */ + } else if ((rt =3D=3D 0) && (rs =3D=3D 0)) { + tcg_gen_movi_i64(cpu_gpr[rt], 0); + tcg_gen_movi_i64(cpu_mmr[rt], 0); + } else if (rt =3D=3D 0) { + tcg_gen_movi_i64(cpu_mmr[rd], 0); + tcg_gen_mov_i64(cpu_gpr[rd], cpu_mmr[rs]); + } else if (rs =3D=3D 0) { + tcg_gen_mov_i64(cpu_mmr[rd], cpu_mmr[rt]); + tcg_gen_movi_i64(cpu_gpr[rd], 0); + } else { + tcg_gen_mov_i64(cpu_mmr[rd], cpu_mmr[rt]); + tcg_gen_mov_i64(cpu_gpr[rd], cpu_mmr[rs]); + } +} + #endif =20 =20 @@ -27504,7 +27542,6 @@ static void decode_mmi3(CPUMIPSState *env, DisasCon= text *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 */ @@ -27514,6 +27551,9 @@ static void decode_mmi3(CPUMIPSState *env, DisasCon= text *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); --=20 2.7.4