From: Jia Liu <proljc@gmail.com>
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net
Subject: [Qemu-devel] [PATCH V3 08/12] Add helper functions for MIPS DSP Bit/Manipulation instructions
Date: Tue, 27 Mar 2012 17:24:46 +0800 [thread overview]
Message-ID: <1332840290-24553-9-git-send-email-proljc@gmail.com> (raw)
In-Reply-To: <1332840290-24553-1-git-send-email-proljc@gmail.com>
Add helper functions for MIPS DSP Bit/Manipulation instructions.
Signed-off-by: Jia Liu <proljc@gmail.com>
---
target-mips/dsp_helper.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++
target-mips/helper.h | 8 ++++
2 files changed, 93 insertions(+), 0 deletions(-)
diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c
index 4692cc4..cd9764f 100644
--- a/target-mips/dsp_helper.c
+++ b/target-mips/dsp_helper.c
@@ -2912,6 +2912,91 @@ void helper_mulsa_w_ph(int ac, uint32_t rs, uint32_t rt)
env->active_tc.LO[ac] = acc & MIPSDSP_LLO;
}
+/** DSP Bit/Manipulation Sub-class insns **/
+uint32_t helper_bitrev(uint32_t rt)
+{
+ int32_t temp;
+ uint32_t rd;
+
+ temp = rt & MIPSDSP_LO;
+ rd = temp;
+
+ return rd;
+}
+
+void helper_insv(int reg_rt, uint32_t rs, uint32_t rt)
+{
+ uint32_t pos, size, msb, lsb, rs_f, rt_f;
+ uint32_t temp, temprs, temprt;
+ target_ulong dspc;
+
+ dspc = env->active_tc.DSPControl;
+ pos = dspc & 0x1F;
+ size = (dspc >> 7) & 0x1F;
+ msb = pos + size - 1;
+ lsb = pos;
+
+ if (lsb > msb)
+ return;
+
+ rs_f = (((int32_t)0x01 << (msb - lsb + 1 + 1)) - 1) << lsb;
+ rt_f = rs_f ^ 0xFFFFFFFF;
+ temprs = rs & rs_f;
+ temprt = rt & rt_f;
+ temp = temprs | temprt;
+ env->active_tc.gpr[reg_rt] = temp;
+}
+
+uint32_t helper_repl_qb(uint32_t imm)
+{
+ uint8_t temp;
+ uint32_t rd;
+
+ temp = imm & 0x00FF;
+ rd = ((uint32_t)temp << 24) | ((uint32_t)temp << 16) | \
+ ((uint32_t)temp << 8) | (uint32_t)temp;
+
+ return rd;
+}
+
+uint32_t helper_replv_qb(uint32_t rt)
+{
+ uint8_t temp;
+ uint32_t rd;
+
+ temp = rt & MIPSDSP_Q0;
+ rd = ((uint32_t)temp << 24) | ((uint32_t)temp << 16) | \
+ ((uint32_t)temp << 8) | (uint32_t)temp;
+
+ return rd;
+}
+
+uint32_t helper_repl_ph(uint32_t imm)
+{
+ int16_t temp;
+ int16_t imm_temp;
+ uint32_t rd;
+
+ imm_temp = imm & 0x03FF;
+ temp = (imm_temp << 22) >> 22;
+ rd = (((uint32_t)temp << 16) & MIPSDSP_HI) | \
+ ((uint32_t)temp & MIPSDSP_LO);
+
+ return rd;
+}
+
+uint32_t helper_replv_ph(uint32_t rt)
+{
+ uint16_t temp;
+ uint32_t rd;
+
+ temp = rt & MIPSDSP_LO;
+ rd = ((uint32_t)temp << 16) | (uint32_t)temp;
+
+ return rd;
+}
+
+
#undef MIPSDSP_LHI
#undef MIPSDSP_LLO
#undef MIPSDSP_HI
diff --git a/target-mips/helper.h b/target-mips/helper.h
index f3fffa1..c45c173 100644
--- a/target-mips/helper.h
+++ b/target-mips/helper.h
@@ -413,4 +413,12 @@ DEF_HELPER_FLAGS_2(mulq_s_w, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32, i32)
DEF_HELPER_FLAGS_2(mulq_rs_w, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32, i32)
DEF_HELPER_3(mulsa_w_ph, void, int, i32, i32)
+/* DSP Bit/Manipulation Sub-class insns */
+DEF_HELPER_FLAGS_1(bitrev, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32)
+DEF_HELPER_3(insv, void, int, i32, i32)
+DEF_HELPER_FLAGS_1(repl_qb, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32)
+DEF_HELPER_FLAGS_1(replv_qb, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32)
+DEF_HELPER_FLAGS_1(repl_ph, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32)
+DEF_HELPER_FLAGS_1(replv_ph, TCG_CALL_CONST | TCG_CALL_PURE, i32, i32)
+
#include "def-helper.h"
--
1.7.5.4
next prev parent reply other threads:[~2012-03-27 9:27 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-27 9:24 [Qemu-devel] [PATCH V3 00/12] Qemu MIPS ASE DSP Support Jia Liu
2012-03-27 9:24 ` [Qemu-devel] [PATCH V3 01/12] add MIPS DSP internal functions Jia Liu
2012-03-27 15:33 ` Richard Henderson
2012-03-28 2:03 ` Jia Liu
2012-03-29 11:16 ` Richard Henderson
2012-03-27 9:24 ` [Qemu-devel] [PATCH V3 02/12] Use correct acc value to index cpu_HI/cpu_LO rather than using a fix number Jia Liu
2012-03-27 15:34 ` Richard Henderson
2012-03-27 9:24 ` [Qemu-devel] [PATCH V3 03/12] Add MIPS DSP Branch instruction Support Jia Liu
2012-03-27 15:46 ` Richard Henderson
2012-03-28 1:27 ` Jia Liu
2012-03-27 9:24 ` [Qemu-devel] [PATCH V3 04/12] Add MIPS DSP Load instructions Support Jia Liu
2012-03-27 15:49 ` Richard Henderson
2012-03-28 1:46 ` Jia Liu
2012-03-27 9:24 ` [Qemu-devel] [PATCH V3 05/12] Add helper functions for MIPS DSP Arithmetic instructions Jia Liu
2012-03-27 16:03 ` Richard Henderson
2012-03-28 1:45 ` Jia Liu
2012-03-27 9:24 ` [Qemu-devel] [PATCH V3 06/12] Add helper functions for MIPS DSP GPR-Based Shift instructions Jia Liu
2012-03-27 16:11 ` Richard Henderson
2012-03-28 1:43 ` Jia Liu
2012-03-29 13:09 ` Richard Henderson
2012-03-27 9:24 ` [Qemu-devel] [PATCH V3 07/12] Add helper functions for MIPS DSP Multiply instructions Jia Liu
2012-03-27 9:24 ` Jia Liu [this message]
2012-03-27 16:23 ` [Qemu-devel] [PATCH V3 08/12] Add helper functions for MIPS DSP Bit/Manipulation instructions Richard Henderson
2012-03-28 1:47 ` Jia Liu
2012-03-27 9:24 ` [Qemu-devel] [PATCH V3 09/12] Add helper functions for MIPS DSP Compare-Pick instructions Jia Liu
2012-03-27 17:42 ` Richard Henderson
2012-03-28 1:52 ` Jia Liu
2012-03-27 9:24 ` [Qemu-devel] [PATCH V3 10/12] Add helper functions for MIPS DSP Accumulator and DSPControl Access instrutions helpers Jia Liu
2012-03-27 9:24 ` [Qemu-devel] [PATCH V3 11/12] Handle MIPS DSP instructions in target-mips/translate.c Jia Liu
2012-03-27 17:48 ` Richard Henderson
2012-03-28 1:36 ` Jia Liu
2012-03-29 13:20 ` Richard Henderson
2012-03-27 9:24 ` [Qemu-devel] [PATCH V3 12/12] add MIPS DSP testcases Jia Liu
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=1332840290-24553-9-git-send-email-proljc@gmail.com \
--to=proljc@gmail.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).