qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org,
	Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Huacai Chen <chenhc@lemote.com>
Subject: [PULL for-5.0 08/10] target/mips: Fix loongson multimedia condition instructions
Date: Mon, 30 Mar 2020 20:54:54 -0700	[thread overview]
Message-ID: <20200331035456.6494-10-richard.henderson@linaro.org> (raw)
In-Reply-To: <20200331035456.6494-1-richard.henderson@linaro.org>

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

Loongson multimedia condition instructions were previously implemented as
write 0 to rd due to lack of documentation. So I just confirmed with Loongson
about their encoding and implemented them correctly.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Acked-by: Huacai Chen <chenhc@lemote.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
Message-Id: <20200324122212.11156-1-jiaxun.yang@flygoat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/mips/translate.c | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)

diff --git a/target/mips/translate.c b/target/mips/translate.c
index d745bd2803..25b595a17d 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -5529,6 +5529,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
 {
     uint32_t opc, shift_max;
     TCGv_i64 t0, t1;
+    TCGCond cond;
 
     opc = MASK_LMI(ctx->opcode);
     switch (opc) {
@@ -5862,14 +5863,39 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
 
     case OPC_SEQU_CP2:
     case OPC_SEQ_CP2:
+        cond = TCG_COND_EQ;
+        goto do_cc_cond;
+        break;
     case OPC_SLTU_CP2:
+        cond = TCG_COND_LTU;
+        goto do_cc_cond;
+        break;
     case OPC_SLT_CP2:
+        cond = TCG_COND_LT;
+        goto do_cc_cond;
+        break;
     case OPC_SLEU_CP2:
+        cond = TCG_COND_LEU;
+        goto do_cc_cond;
+        break;
     case OPC_SLE_CP2:
-        /*
-         * ??? Document is unclear: Set FCC[CC].  Does that mean the
-         * FD field is the CC field?
-         */
+        cond = TCG_COND_LE;
+    do_cc_cond:
+        {
+            int cc = (ctx->opcode >> 8) & 0x7;
+            TCGv_i64 t64 = tcg_temp_new_i64();
+            TCGv_i32 t32 = tcg_temp_new_i32();
+
+            tcg_gen_setcond_i64(cond, t64, t0, t1);
+            tcg_gen_extrl_i64_i32(t32, t64);
+            tcg_gen_deposit_i32(fpu_fcr31, fpu_fcr31, t32,
+                                get_fp_bit(cc), 1);
+
+            tcg_temp_free_i32(t32);
+            tcg_temp_free_i64(t64);
+        }
+        goto no_rd;
+        break;
     default:
         MIPS_INVAL("loongson_cp2");
         generate_exception_end(ctx, EXCP_RI);
@@ -5878,6 +5904,7 @@ static void gen_loongson_multimedia(DisasContext *ctx, int rd, int rs, int rt)
 
     gen_store_fpr64(ctx, t0, rd);
 
+no_rd:
     tcg_temp_free_i64(t0);
     tcg_temp_free_i64(t1);
 }
-- 
2.20.1



  parent reply	other threads:[~2020-03-31  3:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31  3:54 [PULL for-5.0 00/10] tcg patch queue Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 01/10] configure: Drop adjustment of textseg Richard Henderson
2020-03-31  3:54 ` [PATCH for-5.0] tcg/i386: Fix INDEX_op_dup2_vec Richard Henderson
2020-03-31  8:14   ` no-reply
2020-03-31  3:54 ` [PULL for-5.0 02/10] tcg: Remove softmmu code_gen_buffer fixed address Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 03/10] configure: Do not force pie=no for non-x86 Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 04/10] configure: Always detect -no-pie toolchain support Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 05/10] configure: Unnest detection of -z, relro and -z, now Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 06/10] configure: Override the os default with --disable-pie Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 07/10] configure: Support -static-pie if requested Richard Henderson
2020-03-31 13:34   ` Laurent Vivier
2020-03-31 13:44     ` Laurent Vivier
2020-03-31 14:29       ` Richard Henderson
2020-03-31  3:54 ` Richard Henderson [this message]
2020-03-31  3:54 ` [PULL for-5.0 09/10] tcg/i386: Fix INDEX_op_dup2_vec Richard Henderson
2020-03-31  3:54 ` [PULL for-5.0 10/10] decodetree: Use Python3 floor division operator Richard Henderson
2020-03-31 12:20 ` [PULL for-5.0 00/10] tcg patch queue Peter Maydell
2020-03-31 12:53   ` Alex Bennée
2020-03-31 15:02     ` Philippe Mathieu-Daudé

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=20200331035456.6494-10-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=aleksandar.qemu.devel@gmail.com \
    --cc=chenhc@lemote.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).