qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 25/40] Add vsplt{b,h,w} instructions.


From: Nathan Froyd
Subject: [Qemu-devel] [PATCH 25/40] Add vsplt{b,h,w} instructions.
Date: Tue, 30 Dec 2008 19:10:07 -0800

Signed-off-by: Nathan Froyd <address@hidden>
---
 target-ppc/helper.h    |    3 +++
 target-ppc/op_helper.c |   23 +++++++++++++++++++++++
 target-ppc/translate.c |    4 ++++
 3 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index 9fbcc4a..2ca4e26 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -182,6 +182,9 @@ DEF_HELPER_4(vsldoi, void, avr, avr, avr, i32)
 DEF_HELPER_2(vspltisb, void, avr, i32)
 DEF_HELPER_2(vspltish, void, avr, i32)
 DEF_HELPER_2(vspltisw, void, avr, i32)
+DEF_HELPER_3(vspltb, void, avr, avr, i32)
+DEF_HELPER_3(vsplth, void, avr, avr, i32)
+DEF_HELPER_3(vspltw, void, avr, avr, i32)
 
 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 55f341f..28b1fb6 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -2302,6 +2302,29 @@ void helper_vslo (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t 
*b)
 #endif
 }
 
+/* Experimental testing shows that hardware masks the immediate.  */
+#define _SPLAT_MASKED(element) (splat & (ARRAY_SIZE(r->element) - 1))
+#if defined(WORDS_BIGENDIAN)
+#define SPLAT_ELEMENT(element) _SPLAT_MASKED(element)
+#else
+#define SPLAT_ELEMENT(element) (ARRAY_SIZE(r->element)-1 - 
_SPLAT_MASKED(element))
+#endif
+#define VSPLT(suffix, element)                                          \
+    void helper_vsplt##suffix (ppc_avr_t *r, ppc_avr_t *b, uint32_t splat) \
+    {                                                                   \
+        uint32_t s = b->element[SPLAT_ELEMENT(element)];                \
+        int i;                                                          \
+        for (i = 0; i < ARRAY_SIZE(r->element); i++) {                  \
+            r->element[i] = s;                                          \
+        }                                                               \
+    }
+VSPLT(b, u8)
+VSPLT(h, u16)
+VSPLT(w, u32)
+#undef VSPLT
+#undef SPLAT_ELEMENT
+#undef _SPLAT_MASKED
+
 #define VSPLTI(suffix, element, splat_type)                     \
     void helper_vspltis##suffix (ppc_avr_t *r, uint32_t splat)  \
     {                                                           \
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 77e93cb..bade2c8 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -6363,6 +6363,10 @@ GEN_VXFORM_SIMM(vspltisw, 6, 14);
         tcg_temp_free_ptr(rd);                                          \
     }
 
+GEN_VXFORM_UIMM(vspltb, 6, 8);
+GEN_VXFORM_UIMM(vsplth, 6, 9);
+GEN_VXFORM_UIMM(vspltw, 6, 10);
+
 #define GEN_VXRFORM1(opname, name, str, opc2, opc3)                     \
     GEN_HANDLER2(name, str, 0x4, opc2, opc3, 0x00000000, PPC_ALTIVEC)   \
     {                                                                   \
-- 
1.6.0.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]