qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [PATCH 1/4] target/mips: Legalize Loongson insn flags
Date: Sun, 14 Jun 2020 10:42:33 +0200	[thread overview]
Message-ID: <CAHiYmc4WMeHODfEKHeKsucqqB5a2vEcGdO4F=g-nsS+C0zsH1Q@mail.gmail.com> (raw)
In-Reply-To: <20200614080049.31134-2-jiaxun.yang@flygoat.com>

нед, 14. јун 2020. у 10:03 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>

Applied to the next mips queue.

>  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 0c129106c8..f1b833f947 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 2caf4cba5a..e49f32f6ae 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.27.0


  reply	other threads:[~2020-06-14  8:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-14  8:00 [PATCH 0/4] Basic TCG Loongson-3A1000 Support Jiaxun Yang
2020-06-14  8:00 ` [PATCH 1/4] target/mips: Legalize Loongson insn flags Jiaxun Yang
2020-06-14  8:42   ` Aleksandar Markovic [this message]
2020-06-14  8:00 ` [PATCH 2/4] target/mips: Add comments for vendor-specific ASEs Jiaxun Yang
2020-06-14  8:43   ` Aleksandar Markovic
2020-06-14  8:00 ` [PATCH 3/4] target/mips: Add loongson ext lsdc2 instrustions Jiaxun Yang
2020-06-14  9:34   ` Aleksandar Markovic
2020-06-14  9:41 ` [PATCH 0/4] Basic TCG Loongson-3A1000 Support 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='CAHiYmc4WMeHODfEKHeKsucqqB5a2vEcGdO4F=g-nsS+C0zsH1Q@mail.gmail.com' \
    --to=aleksandar.qemu.devel@gmail.com \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=jiaxun.yang@flygoat.com \
    --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).