From: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net, amarkovic@wavecomp.com, arikalo@wavecomp.com
Subject: [Qemu-devel] [PATCH 2/3] target/mips: Add emulation of MMI instruction PCPYLD
Date: Mon, 25 Feb 2019 17:10:36 +0100 [thread overview]
Message-ID: <1551111037-23411-3-git-send-email-mateja.marjanovic@rt-rk.com> (raw)
In-Reply-To: <1551111037-23411-1-git-send-email-mateja.marjanovic@rt-rk.com>
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 <mateja.marjanovic@rt-rk.com>
---
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)
}
}
+/*
+ * 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 = ctx->opcode;
+
+ rs = extract32(opcode, 21, 5);
+ rt = extract32(opcode, 16, 5);
+ rd = extract32(opcode, 11, 5);
+
+ if (rd == 0) {
+ /* nop */
+ } else if ((rt == 0) && (rs == 0)) {
+ tcg_gen_movi_i64(cpu_gpr[rt], 0);
+ tcg_gen_movi_i64(cpu_mmr[rt], 0);
+ } else if (rt == 0) {
+ tcg_gen_movi_i64(cpu_gpr[rd], 0);
+ tcg_gen_mov_i64(cpu_mmr[rd], cpu_gpr[rs]);
+ } else if (rs == 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
@@ -27430,7 +27468,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 */
@@ -27445,6 +27482,9 @@ static void decode_mmi2(CPUMIPSState *env, DisasContext *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);
--
2.7.4
next prev parent reply other threads:[~2019-02-25 16:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 16:10 [Qemu-devel] [PATCH 0/3] target/mips: Add emulation of three MMI instructions Mateja Marjanovic
2019-02-25 16:10 ` [Qemu-devel] [PATCH 1/3] target/mips: Add emulation of MMI instruction PCPYH Mateja Marjanovic
2019-02-25 22:16 ` Richard Henderson
2019-02-25 16:10 ` Mateja Marjanovic [this message]
2019-02-25 22:20 ` [Qemu-devel] [PATCH 2/3] target/mips: Add emulation of MMI instruction PCPYLD Richard Henderson
2019-02-25 16:10 ` [Qemu-devel] [PATCH 3/3] target/mips: Add emulation of MMI instruction PCPYUD Mateja Marjanovic
2019-02-25 22:22 ` Richard Henderson
2019-02-25 16:44 ` [Qemu-devel] [PATCH 0/3] target/mips: Add emulation of three MMI instructions Aleksandar Rikalo
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=1551111037-23411-3-git-send-email-mateja.marjanovic@rt-rk.com \
--to=mateja.marjanovic@rt-rk.com \
--cc=amarkovic@wavecomp.com \
--cc=arikalo@wavecomp.com \
--cc=aurelien@aurel32.net \
--cc=qemu-devel@nongnu.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).