qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: aleksandar.qemu.devel@gmail.com, Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: [PULL 01/18] target/mips: Legalize Loongson insn flags
Date: Mon, 15 Jun 2020 21:28:43 +0200	[thread overview]
Message-ID: <1592249340-8365-2-git-send-email-aleksandar.qemu.devel@gmail.com> (raw)
In-Reply-To: <1592249340-8365-1-git-send-email-aleksandar.qemu.devel@gmail.com>

From: Jiaxun Yang <jiaxun.yang@flygoat.com>

To match the actual status of Loongson insn, we split flags
for LMMI and LEXT from INSN_LOONGSON2F.

As Loongson-2F only implemented interger part of LEXT, we'll
not enable LEXT for the processor, but instead we're still using
INSN_LOONGSON2F as switch flag of these instructions.

All multimedia instructions have been moved to LMMI flag. Loongson-2F
and Loongson-3A are sharing these instructions.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
Signed-off-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
Message-Id: <20200614080049.31134-2-jiaxun.yang@flygoat.com>
---
 target/mips/mips-defs.h |  4 ++--
 target/mips/translate.c | 13 +++++++------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/target/mips/mips-defs.h b/target/mips/mips-defs.h
index 0c12910..f1b833f 100644
--- a/target/mips/mips-defs.h
+++ b/target/mips/mips-defs.h
@@ -70,7 +70,7 @@
 #define CPU_VR54XX      (CPU_MIPS4 | INSN_VR54XX)
 #define CPU_R5900       (CPU_MIPS3 | INSN_R5900)
 #define CPU_LOONGSON2E  (CPU_MIPS3 | INSN_LOONGSON2E)
-#define CPU_LOONGSON2F  (CPU_MIPS3 | INSN_LOONGSON2F)
+#define CPU_LOONGSON2F  (CPU_MIPS3 | INSN_LOONGSON2F | ASE_LMMI)
 
 #define CPU_MIPS5       (CPU_MIPS4 | ISA_MIPS5)
 
@@ -97,7 +97,7 @@
 /* Wave Computing: "nanoMIPS" */
 #define CPU_NANOMIPS32  (CPU_MIPS32R6 | ISA_NANOMIPS32)
 
-#define CPU_LOONGSON3A  (CPU_MIPS64R2 | INSN_LOONGSON3A)
+#define CPU_LOONGSON3A  (CPU_MIPS64R2 | INSN_LOONGSON3A | ASE_LMMI | ASE_LEXT)
 
 /*
  * Strictly follow the architecture standard:
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 2caf4cb..e49f32f 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -1046,7 +1046,7 @@ enum {
     OPC_BC2NEZ  = (0x0D << 21) | OPC_CP2,
 };
 
-#define MASK_LMI(op)    (MASK_OP_MAJOR(op) | (op & (0x1F << 21)) | (op & 0x1F))
+#define MASK_LMMI(op)    (MASK_OP_MAJOR(op) | (op & (0x1F << 21)) | (op & 0x1F))
 
 enum {
     OPC_PADDSH      = (24 << 21) | (0x00) | OPC_CP2,
@@ -3421,7 +3421,8 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,
     TCGv t0, t1, t2;
     int mem_idx = ctx->mem_idx;
 
-    if (rt == 0 && ctx->insn_flags & (INSN_LOONGSON2E | INSN_LOONGSON2F)) {
+    if (rt == 0 && ctx->insn_flags & (INSN_LOONGSON2E | INSN_LOONGSON2F |
+                                      INSN_LOONGSON3A)) {
         /*
          * Loongson CPU uses a load to zero register for prefetch.
          * We emulate it as a NOP. On other CPU we must perform the
@@ -5531,7 +5532,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
     TCGv_i64 t0, t1;
     TCGCond cond;
 
-    opc = MASK_LMI(ctx->opcode);
+    opc = MASK_LMMI(ctx->opcode);
     switch (opc) {
     case OPC_ADD_CP2:
     case OPC_SUB_CP2:
@@ -27161,7 +27162,7 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx)
     case OPC_MULTU_G_2F:
     case OPC_MOD_G_2F:
     case OPC_MODU_G_2F:
-        check_insn(ctx, INSN_LOONGSON2F);
+        check_insn(ctx, INSN_LOONGSON2F | ASE_LEXT);
         gen_loongson_integer(ctx, op1, rd, rs, rt);
         break;
     case OPC_CLO:
@@ -27194,7 +27195,7 @@ static void decode_opc_special2_legacy(CPUMIPSState *env, DisasContext *ctx)
     case OPC_DDIVU_G_2F:
     case OPC_DMOD_G_2F:
     case OPC_DMODU_G_2F:
-        check_insn(ctx, INSN_LOONGSON2F);
+        check_insn(ctx, INSN_LOONGSON2F | ASE_LEXT);
         gen_loongson_integer(ctx, op1, rd, rs, rt);
         break;
 #endif
@@ -30641,7 +30642,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
         }
         break;
     case OPC_CP2:
-        check_insn(ctx, INSN_LOONGSON2F);
+        check_insn(ctx, ASE_LMMI);
         /* Note that these instructions use different fields.  */
         gen_loongson_multimedia(ctx, sa, rd, rt);
         break;
-- 
2.7.4



  reply	other threads:[~2020-06-15 19:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 19:28 [PULL v2 00/18] MIPS + misc queue for June 15th, 2020 Aleksandar Markovic
2020-06-15 19:28 ` Aleksandar Markovic [this message]
2020-06-15 19:28 ` [PULL 02/18] target/mips: Add comments for vendor-specific ASEs Aleksandar Markovic
2020-06-15 19:28 ` [PULL 03/18] target/mips: msa: Split helpers for MADDV.<B|H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 04/18] target/mips: msa: Split helpers for MSUBV.<B|H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 05/18] target/mips: msa: Split helpers for DPADD_S.<H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 06/18] target/mips: msa: Split helpers for DPADD_U.<H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 07/18] target/mips: msa: Split helpers for DPSUB_S.<H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 08/18] target/mips: msa: Split helpers for DPSUB_U.<H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 09/18] target/mips: msa: Split helpers for DOTP_S.<H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 10/18] target/mips: msa: Split helpers for DOTP_U.<H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 11/18] target/mips: msa: Split helpers for SUBS_S.<B|H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 12/18] target/mips: msa: Split helpers for SUBS_U.<B|H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 13/18] target/mips: msa: Split helpers for SUBSUS_U.<B|H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 14/18] target/mips: msa: Split helpers for SUBSUU_S.<B|H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 15/18] target/mips: msa: Split helpers for SUBV.<B|H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 16/18] target/mips: msa: Split helpers for MULV.<B|H|W|D> Aleksandar Markovic
2020-06-15 19:28 ` [PULL 17/18] MAINTAINERS: Adjust sh4 maintainership Aleksandar Markovic
2020-06-15 19:29 ` [PULL 18/18] translations: Add Swedish language Aleksandar Markovic
2020-06-16 10:48 ` [PULL v2 00/18] MIPS + misc queue for June 15th, 2020 Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2020-06-15 19:22 [PULL " Aleksandar Markovic
2020-06-15 19:22 ` [PULL 01/18] target/mips: Legalize Loongson insn flags Aleksandar Markovic

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=1592249340-8365-2-git-send-email-aleksandar.qemu.devel@gmail.com \
    --to=aleksandar.qemu.devel@gmail.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=peter.maydell@linaro.org \
    --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).