From: Nathan Froyd <froydnj@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 22/42] target-ppc: add vs{l,r} instructions.
Date: Mon, 15 Dec 2008 14:15:35 -0800 [thread overview]
Message-ID: <1229379335-8782-4-git-send-email-froydnj@codesourcery.com> (raw)
In-Reply-To: <1229379335-8782-1-git-send-email-froydnj@codesourcery.com>
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
---
target-ppc/helper.h | 2 ++
target-ppc/op_helper.c | 35 +++++++++++++++++++++++++++++++++++
target-ppc/translate.c | 2 ++
3 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index cf2a655..5f94e9f 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -176,6 +176,8 @@ DEF_HELPER_3(vsubuws, void, avr, avr, avr)
DEF_HELPER_3(vrlb, void, avr, avr, avr)
DEF_HELPER_3(vrlh, void, avr, avr, avr)
DEF_HELPER_3(vrlw, void, avr, avr, avr)
+DEF_HELPER_3(vsl, void, avr, avr, avr)
+DEF_HELPER_3(vsr, void, avr, avr, avr)
DEF_HELPER_1(efscfsi, i32, i32)
DEF_HELPER_1(efscfui, i32, i32)
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
index 6c744c5..a55450b 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -2264,6 +2264,41 @@ VROTATE(h, u16)
VROTATE(w, u32)
#undef VROTATE
+#if defined(WORDS_BIGENDIAN)
+#define LEFT 0
+#define RIGHT 1
+#else
+#define LEFT 1
+#define RIGHT 0
+#endif
+#define VSHIFT(suffix, leftp) \
+ void helper_vs##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
+ { \
+ int shift = b->u8[LO_IDX*0x15] & 0x7; \
+ int doit = 1; \
+ VECTOR_FOR (u8) { \
+ doit = doit && ((b->u8[i] & 0x7) == shift); \
+ } \
+ if (doit) { \
+ if (shift == 0) { \
+ *r = *a; \
+ } else if (leftp) { \
+ uint64_t carry = a->u64[LO_IDX] >> (64 - shift); \
+ r->u64[HI_IDX] = (a->u64[HI_IDX] << shift) | carry; \
+ r->u64[LO_IDX] = a->u64[LO_IDX] << shift; \
+ } else { \
+ uint64_t carry = a->u64[HI_IDX] << (64 - shift); \
+ r->u64[LO_IDX] = (a->u64[LO_IDX] >> shift) | carry; \
+ r->u64[HI_IDX] = a->u64[HI_IDX] >> shift; \
+ } \
+ } \
+ }
+VSHIFT(l, LEFT)
+VSHIFT(r, RIGHT)
+#undef VSHIFT
+#undef LEFT
+#undef RIGHT
+
#define VSL(suffix, element) \
void helper_vsl##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
{ \
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 7c527b2..45657d2 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -6286,6 +6286,8 @@ GEN_VXFORM(vsubsws, 1920);
GEN_VXFORM(vrlb, 4);
GEN_VXFORM(vrlh, 68);
GEN_VXFORM(vrlw, 132);
+GEN_VXFORM(vsl, 452);
+GEN_VXFORM(vsr, 708);
#define GEN_VXRFORM1(opname, name, str, xo, rc) \
GEN_HANDLER2(name, str, 0x4, (xo >> 1) & 0x1f, ((xo >> 6) & 0x1f) | (rc << 4), 0x00000000, PPC_ALTIVEC) \
--
1.6.0.5
next prev parent reply other threads:[~2008-12-15 23:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-15 22:15 [Qemu-devel] [PATCH] target-ppc: add Altivec instructions, corrections Nathan Froyd
2008-12-15 22:15 ` [Qemu-devel] [PATCH 13/42] target-ppc: add vmul{e, o}{s, u}{b, h} instructions Nathan Froyd
2008-12-15 23:01 ` Andreas Färber
2008-12-16 19:53 ` Nathan Froyd
2008-12-15 22:15 ` [Qemu-devel] [PATCH 19/42] target-ppc: add m{f, t}vscr instructions Nathan Froyd
2008-12-16 19:54 ` Nathan Froyd
2008-12-15 22:15 ` Nathan Froyd [this message]
2008-12-16 19:56 ` [Qemu-devel] [PATCH 22/42] target-ppc: add vs{l,r} instructions Nathan Froyd
-- strict thread matches above, loose matches on Subject: below --
2008-12-15 2:14 [Qemu-devel] [PATCH] target-ppc: add Altivec instructions, patch-bomb version Nathan Froyd
2008-12-15 2:14 ` [Qemu-devel] [PATCH 22/42] target-ppc: add vs{l,r} instructions Nathan Froyd
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=1229379335-8782-4-git-send-email-froydnj@codesourcery.com \
--to=froydnj@codesourcery.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).