qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
To: qemu-devel@nongnu.org
Cc: arikalo@wavecomp.com
Subject: [PATCH v2 14/20] target/mips: msa: Split helpers for CEQ.<B|H|W|D>
Date: Wed, 25 Sep 2019 14:46:06 +0200	[thread overview]
Message-ID: <1569415572-19635-15-git-send-email-aleksandar.markovic@rt-rk.com> (raw)
In-Reply-To: <1569415572-19635-1-git-send-email-aleksandar.markovic@rt-rk.com>

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 target/mips/helper.h     |  6 +++-
 target/mips/msa_helper.c | 73 +++++++++++++++++++++++++++++++++++++++++++-----
 target/mips/translate.c  | 19 +++++++++++--
 3 files changed, 87 insertions(+), 11 deletions(-)

diff --git a/target/mips/helper.h b/target/mips/helper.h
index 9d4c9f1..95eb065 100644
--- a/target/mips/helper.h
+++ b/target/mips/helper.h
@@ -842,6 +842,11 @@ DEF_HELPER_4(msa_aver_u_h, void, env, i32, i32, i32)
 DEF_HELPER_4(msa_aver_u_w, void, env, i32, i32, i32)
 DEF_HELPER_4(msa_aver_u_d, void, env, i32, i32, i32)
 
+DEF_HELPER_4(msa_ceq_b, void, env, i32, i32, i32)
+DEF_HELPER_4(msa_ceq_h, void, env, i32, i32, i32)
+DEF_HELPER_4(msa_ceq_w, void, env, i32, i32, i32)
+DEF_HELPER_4(msa_ceq_d, void, env, i32, i32, i32)
+
 
 DEF_HELPER_4(msa_andi_b, void, env, i32, i32, i32)
 DEF_HELPER_4(msa_ori_b, void, env, i32, i32, i32)
@@ -891,7 +896,6 @@ DEF_HELPER_5(msa_min_s_df, void, env, i32, i32, i32, i32)
 DEF_HELPER_5(msa_min_u_df, void, env, i32, i32, i32, i32)
 DEF_HELPER_5(msa_max_a_df, void, env, i32, i32, i32, i32)
 DEF_HELPER_5(msa_min_a_df, void, env, i32, i32, i32, i32)
-DEF_HELPER_5(msa_ceq_df, void, env, i32, i32, i32, i32)
 DEF_HELPER_5(msa_clt_s_df, void, env, i32, i32, i32, i32)
 DEF_HELPER_5(msa_clt_u_df, void, env, i32, i32, i32, i32)
 DEF_HELPER_5(msa_cle_s_df, void, env, i32, i32, i32, i32)
diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
index a4f51c6..65d9c9b 100644
--- a/target/mips/msa_helper.c
+++ b/target/mips/msa_helper.c
@@ -1137,7 +1137,72 @@ void helper_msa_aver_u_d(CPUMIPSState *env, uint32_t wd, uint32_t ws, uint32_t w
  * +---------------+----------------------------------------------------------+
  */
 
-/* TODO: insert Int Compare group helpers here */
+static inline int64_t msa_ceq_df(uint32_t df, int64_t arg1, int64_t arg2)
+{
+    return arg1 == arg2 ? -1 : 0;
+}
+
+void helper_msa_ceq_b(CPUMIPSState *env, uint32_t wd, uint32_t ws, uint32_t wt)
+{
+    wr_t *pwd = &(env->active_fpu.fpr[wd].wr);
+    wr_t *pws = &(env->active_fpu.fpr[ws].wr);
+    wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
+
+    pwd->b[0]  = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[0]);
+    pwd->b[1]  = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[1]);
+    pwd->b[2]  = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[2]);
+    pwd->b[3]  = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[3]);
+    pwd->b[4]  = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[4]);
+    pwd->b[5]  = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[5]);
+    pwd->b[6]  = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[6]);
+    pwd->b[7]  = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[7]);
+    pwd->b[8]  = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[8]);
+    pwd->b[9]  = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[9]);
+    pwd->b[10] = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[10]);
+    pwd->b[11] = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[11]);
+    pwd->b[12] = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[12]);
+    pwd->b[13] = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[13]);
+    pwd->b[14] = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[14]);
+    pwd->b[15] = msa_ceq_df(DF_BYTE, pws->b[0],  pwt->b[15]);
+}
+
+void helper_msa_ceq_h(CPUMIPSState *env, uint32_t wd, uint32_t ws, uint32_t wt)
+{
+    wr_t *pwd = &(env->active_fpu.fpr[wd].wr);
+    wr_t *pws = &(env->active_fpu.fpr[ws].wr);
+    wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
+
+    pwd->h[0]  = msa_ceq_df(DF_HALF, pws->h[0],  pwt->h[0]);
+    pwd->h[1]  = msa_ceq_df(DF_HALF, pws->h[0],  pwt->h[1]);
+    pwd->h[2]  = msa_ceq_df(DF_HALF, pws->h[0],  pwt->h[2]);
+    pwd->h[3]  = msa_ceq_df(DF_HALF, pws->h[0],  pwt->h[3]);
+    pwd->h[4]  = msa_ceq_df(DF_HALF, pws->h[0],  pwt->h[4]);
+    pwd->h[5]  = msa_ceq_df(DF_HALF, pws->h[0],  pwt->h[5]);
+    pwd->h[6]  = msa_ceq_df(DF_HALF, pws->h[0],  pwt->h[6]);
+    pwd->h[7]  = msa_ceq_df(DF_HALF, pws->h[0],  pwt->h[7]);
+}
+
+void helper_msa_ceq_w(CPUMIPSState *env, uint32_t wd, uint32_t ws, uint32_t wt)
+{
+    wr_t *pwd = &(env->active_fpu.fpr[wd].wr);
+    wr_t *pws = &(env->active_fpu.fpr[ws].wr);
+    wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
+
+    pwd->w[0]  = msa_ceq_df(DF_WORD, pws->w[0],  pwt->w[0]);
+    pwd->w[1]  = msa_ceq_df(DF_WORD, pws->w[0],  pwt->w[1]);
+    pwd->w[2]  = msa_ceq_df(DF_WORD, pws->w[0],  pwt->w[2]);
+    pwd->w[3]  = msa_ceq_df(DF_WORD, pws->w[0],  pwt->w[3]);
+}
+
+void helper_msa_ceq_d(CPUMIPSState *env, uint32_t wd, uint32_t ws, uint32_t wt)
+{
+    wr_t *pwd = &(env->active_fpu.fpr[wd].wr);
+    wr_t *pws = &(env->active_fpu.fpr[ws].wr);
+    wr_t *pwt = &(env->active_fpu.fpr[wt].wr);
+
+    pwd->d[0]  = msa_ceq_df(DF_DOUBLE, pws->d[0],  pwt->d[0]);
+    pwd->d[1]  = msa_ceq_df(DF_DOUBLE, pws->d[0],  pwt->d[1]);
+}
 
 
 /*
@@ -1546,11 +1611,6 @@ static inline int64_t msa_subv_df(uint32_t df, int64_t arg1, int64_t arg2)
     return arg1 - arg2;
 }
 
-static inline int64_t msa_ceq_df(uint32_t df, int64_t arg1, int64_t arg2)
-{
-    return arg1 == arg2 ? -1 : 0;
-}
-
 static inline int64_t msa_cle_s_df(uint32_t df, int64_t arg1, int64_t arg2)
 {
     return arg1 <= arg2 ? -1 : 0;
@@ -2172,7 +2232,6 @@ MSA_BINOP_DF(min_s)
 MSA_BINOP_DF(min_u)
 MSA_BINOP_DF(max_a)
 MSA_BINOP_DF(min_a)
-MSA_BINOP_DF(ceq)
 MSA_BINOP_DF(clt_s)
 MSA_BINOP_DF(clt_u)
 MSA_BINOP_DF(cle_s)
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 9b186d3..ad1572e 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -28530,15 +28530,28 @@ static void gen_msa_3r(CPUMIPSState *env, DisasContext *ctx)
             break;
         }
         break;
+    case OPC_CEQ_df:
+        switch (df) {
+        case DF_BYTE:
+            gen_helper_msa_ceq_b(cpu_env, twd, tws, twt);
+            break;
+        case DF_HALF:
+            gen_helper_msa_ceq_h(cpu_env, twd, tws, twt);
+            break;
+        case DF_WORD:
+            gen_helper_msa_ceq_w(cpu_env, twd, tws, twt);
+            break;
+        case DF_DOUBLE:
+            gen_helper_msa_ceq_d(cpu_env, twd, tws, twt);
+            break;
+        }
+        break;
     case OPC_SLL_df:
         gen_helper_msa_sll_df(cpu_env, tdf, twd, tws, twt);
         break;
     case OPC_ADDV_df:
         gen_helper_msa_addv_df(cpu_env, tdf, twd, tws, twt);
         break;
-    case OPC_CEQ_df:
-        gen_helper_msa_ceq_df(cpu_env, tdf, twd, tws, twt);
-        break;
     case OPC_ADD_A_df:
         gen_helper_msa_add_a_df(cpu_env, tdf, twd, tws, twt);
         break;
-- 
2.7.4



  parent reply	other threads:[~2019-09-25 12:50 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25 12:45 [PATCH v2 00/20] target/mips: Misc cleanups for September/October 2019 Aleksandar Markovic
2019-09-25 12:45 ` [PATCH v2 01/20] target/mips: Clean up helper.c Aleksandar Markovic
2019-09-25 15:27   ` Philippe Mathieu-Daudé
2019-09-27  4:32     ` Aleksandar Markovic
2019-09-27  8:55       ` Philippe Mathieu-Daudé
2019-09-27 12:03       ` Markus Armbruster
2019-09-27 12:22         ` Peter Maydell
2019-09-27 13:11           ` Aleksandar Markovic
2019-09-28 14:54             ` Markus Armbruster
2019-09-25 12:45 ` [PATCH v2 02/20] target/mips: Clean up internal.h Aleksandar Markovic
2019-09-25 15:07   ` Philippe Mathieu-Daudé
2019-09-25 12:45 ` [PATCH v2 03/20] target/mips: Clean up kvm_mips.h Aleksandar Markovic
2019-09-25 15:08   ` Philippe Mathieu-Daudé
2019-09-25 12:45 ` [PATCH v2 04/20] target/mips: Clean up mips-defs.h Aleksandar Markovic
2019-09-25 15:10   ` Philippe Mathieu-Daudé
2019-09-25 12:45 ` [PATCH v2 05/20] target/mips: Clean up op_helper.c Aleksandar Markovic
2019-09-25 15:24   ` Philippe Mathieu-Daudé
2019-09-25 12:45 ` [PATCH v2 06/20] target/mips: Clean up translate.c Aleksandar Markovic
2019-09-25 12:45 ` [PATCH v2 07/20] target/mips: msa: Split helpers for <NLOC|NLZC>.<B|H|W|D> Aleksandar Markovic
2019-09-25 12:46 ` [PATCH v2 08/20] target/mips: msa: Split helpers for PCNT.<B|H|W|D> Aleksandar Markovic
2019-09-25 12:46 ` [PATCH v2 09/20] target/mips: msa: Split helpers for BINS<L|R>.<B|H|W|D> Aleksandar Markovic
2019-09-25 12:46 ` [PATCH v2 10/20] target/mips: msa: Unroll loops and demacro <BMNZ|BMZ|BSEL>.V Aleksandar Markovic
2019-09-25 12:46 ` [PATCH v2 11/20] target/mips: msa: Split helpers for B<CLR|NEG|SEL>.<B|H|W|D> Aleksandar Markovic
2019-09-25 12:46 ` [PATCH v2 12/20] target/mips: msa: Split helpers for AVE_<S|U>.<B|H|W|D> Aleksandar Markovic
2019-09-25 12:46 ` [PATCH v2 13/20] target/mips: msa: Split helpers for AVER_<S|U>.<B|H|W|D> Aleksandar Markovic
2019-09-25 12:46 ` Aleksandar Markovic [this message]
2019-09-25 12:46 ` [PATCH v2 15/20] target/mips: msa: Split helpers for CLE_<S|U>.<B|H|W|D> Aleksandar Markovic
2019-09-25 12:46 ` [PATCH v2 16/20] target/mips: msa: Split helpers for CLT_<S|U>.<B|H|W|D> Aleksandar Markovic
2019-09-25 12:46 ` [PATCH v2 17/20] target/mips: msa: Split helpers for DIV_<S|U>.<B|H|W|D> Aleksandar Markovic
2019-09-25 12:46 ` [PATCH v2 18/20] target/mips: msa: Split helpers for MOD_<S|U>.<B|H|W|D> Aleksandar Markovic
2019-09-25 12:46 ` [PATCH v2 19/20] target/mips: msa: Simplify and move helper for MOVE.V Aleksandar Markovic
2019-09-25 12:46 ` [PATCH v2 20/20] target/mips: msa: Move helpers for <AND|NOR|OR|XOR>.V Aleksandar Markovic
2019-09-25 14:09 ` [EXTERNAL][PATCH v2 00/20] target/mips: Misc cleanups for September/October 2019 Aleksandar Rikalo
2019-09-25 14:13 ` Aleksandar Rikalo
2019-10-01 15:26 ` [PATCH " 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=1569415572-19635-15-git-send-email-aleksandar.markovic@rt-rk.com \
    --to=aleksandar.markovic@rt-rk.com \
    --cc=arikalo@wavecomp.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).