From d79f08096c4475c785c8584878e722ba4d9ad800 Mon Sep 17 00:00:00 2001 From: aurel32 Date: Sun, 4 Jan 2009 22:09:08 +0000 Subject: [PATCH] Add vsl{b,h,w} instructions. Signed-off-by: Nathan Froyd Signed-off-by: Aurelien Jarno git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6166 c046a42c-6fe2-441c-8c8c-71466251a162 --- target-ppc/helper.h | 3 +++ target-ppc/op_helper.c | 15 +++++++++++++++ target-ppc/translate.c | 3 +++ 3 files changed, 21 insertions(+) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 025679010c..b262b46aa5 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -143,6 +143,9 @@ DEF_HELPER_3(vsraw, void, avr, avr, avr) DEF_HELPER_3(vsrb, void, avr, avr, avr) DEF_HELPER_3(vsrh, void, avr, avr, avr) DEF_HELPER_3(vsrw, void, avr, avr, avr) +DEF_HELPER_3(vslb, void, avr, avr, avr) +DEF_HELPER_3(vslh, void, avr, avr, avr) +DEF_HELPER_3(vslw, 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 648c50f63f..06c101c9ed 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -2088,6 +2088,21 @@ VMUL(uh, u16, u32) #undef VMUL_DO #undef VMUL +#define VSL(suffix, element) \ + void helper_vsl##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ + { \ + int i; \ + for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ + unsigned int mask = ((1 << (3 + (sizeof (a->element[0]) >> 1))) - 1); \ + unsigned int shift = b->element[i] & mask; \ + r->element[i] = a->element[i] << shift; \ + } \ + } +VSL(b, u8) +VSL(h, u16) +VSL(w, u32) +#undef VSL + #define VSR(suffix, element) \ void helper_vsr##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 cd6b5354b7..c0793014c2 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -6219,6 +6219,9 @@ GEN_VXFORM(vmuleub, 4, 8); GEN_VXFORM(vmuleuh, 4, 9); GEN_VXFORM(vmulesb, 4, 12); GEN_VXFORM(vmulesh, 4, 13); +GEN_VXFORM(vslb, 2, 4); +GEN_VXFORM(vslh, 2, 5); +GEN_VXFORM(vslw, 2, 6); GEN_VXFORM(vsrb, 2, 8); GEN_VXFORM(vsrh, 2, 9); GEN_VXFORM(vsrw, 2, 10);