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 1/4] target/mips: Optimize support for MSA instructions ILVEV.<B|H|W|D>
Date: Wed, 27 Feb 2019 18:40:14 +0100 [thread overview]
Message-ID: <1551289217-10072-2-git-send-email-mateja.marjanovic@rt-rk.com> (raw)
In-Reply-To: <1551289217-10072-1-git-send-email-mateja.marjanovic@rt-rk.com>
From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
Optimize support for MSA instructions ILVEV.B, ILVEV.H, ILVEV.W, and
ILVEV.D.
Optimization is done by eliminating loops, and explicitly assigning
desired values to individual data elements. Performance measurement
is done by executing the instructions large number of times on a
computer with Intel Core i7-3770 CPU @ 3.40GHz×8.
Measured time before optimization:
ILVEV.B: 119.02 ms
ILVEV.H: 94.16 ms
ILVEV.W: 120.97 ms
ILVEV.D: 42.99 ms
Measured time after optimization:
ILVEV.B: 61.81 ms
ILVEV.H: 42.78 ms
ILVEV.W: 39.47 ms
ILVEV.D: 39.11 ms
Signed-off-by: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
---
target/mips/msa_helper.c | 60 +++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 52 insertions(+), 8 deletions(-)
diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
index c74e3cd..4e6584e 100644
--- a/target/mips/msa_helper.c
+++ b/target/mips/msa_helper.c
@@ -1198,14 +1198,6 @@ MSA_FN_DF(ilvl_df)
MSA_FN_DF(ilvr_df)
#undef MSA_DO
-#define MSA_DO(DF) \
- do { \
- pwx->DF[2*i] = pwt->DF[2*i]; \
- pwx->DF[2*i+1] = pws->DF[2*i]; \
- } while (0)
-MSA_FN_DF(ilvev_df)
-#undef MSA_DO
-
#define MSA_DO(DF) \
do { \
pwx->DF[2*i] = pwt->DF[2*i+1]; \
@@ -1230,6 +1222,58 @@ MSA_FN_DF(vshf_df)
#undef MSA_LOOP_COND
#undef MSA_FN_DF
+
+void helper_msa_ilvev_df(CPUMIPSState *env, uint32_t df, 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);
+
+ switch (df) {
+ case DF_BYTE:
+ pwd->b[0] = pwt->b[0];
+ pwd->b[1] = pws->b[0];
+ pwd->b[2] = pwt->b[2];
+ pwd->b[3] = pws->b[2];
+ pwd->b[4] = pwt->b[4];
+ pwd->b[5] = pws->b[4];
+ pwd->b[6] = pwt->b[6];
+ pwd->b[7] = pws->b[6];
+ pwd->b[8] = pwt->b[8];
+ pwd->b[9] = pws->b[8];
+ pwd->b[10] = pwt->b[10];
+ pwd->b[11] = pws->b[10];
+ pwd->b[12] = pwt->b[12];
+ pwd->b[13] = pws->b[12];
+ pwd->b[14] = pwt->b[14];
+ pwd->b[15] = pws->b[14];
+ break;
+ case DF_HALF:
+ pwd->h[0] = pwt->h[0];
+ pwd->h[1] = pws->h[0];
+ pwd->h[2] = pwt->h[2];
+ pwd->h[3] = pws->h[2];
+ pwd->h[4] = pwt->h[4];
+ pwd->h[5] = pws->h[4];
+ pwd->h[6] = pwt->h[6];
+ pwd->h[7] = pws->h[6];
+ break;
+ case DF_WORD:
+ pwd->w[0] = pwt->w[0];
+ pwd->w[1] = pws->w[0];
+ pwd->w[2] = pwt->w[2];
+ pwd->w[3] = pws->w[2];
+ break;
+ case DF_DOUBLE:
+ pwd->d[0] = pwt->d[0];
+ pwd->d[1] = pws->d[0];
+ break;
+ default:
+ assert(0);
+ }
+}
+
void helper_msa_sldi_df(CPUMIPSState *env, uint32_t df, uint32_t wd,
uint32_t ws, uint32_t n)
{
--
2.7.4
next prev parent reply other threads:[~2019-02-27 17:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-27 17:40 [Qemu-devel] [PATCH 0/4] target/mips: Optimize support for certain MSA instructions Mateja Marjanovic
2019-02-27 17:40 ` Mateja Marjanovic [this message]
2019-02-28 0:51 ` [Qemu-devel] [PATCH 1/4] target/mips: Optimize support for MSA instructions ILVEV.<B|H|W|D> Richard Henderson
2019-02-27 17:40 ` [Qemu-devel] [PATCH 2/4] target/mips: Optimize support for MSA instructions ILVOD.<B|H|W|D> Mateja Marjanovic
2019-02-27 17:40 ` [Qemu-devel] [PATCH 3/4] target/mips: Optimize support for MSA instructions ILVL.<B|H|W|D> Mateja Marjanovic
2019-02-27 17:40 ` [Qemu-devel] [PATCH 4/4] target/mips: Optimize support for MSA instructions ILVR.<B|H|W|D> Mateja Marjanovic
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=1551289217-10072-2-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).