From 6cf1c6e5470aa68afdc1185fe289072cb06e8cf7 Mon Sep 17 00:00:00 2001 From: aurel32 Date: Sun, 4 Jan 2009 22:11:20 +0000 Subject: [PATCH] Add vupk{h,l}s{b,h} instructions. Signed-off-by: Nathan Froyd Signed-off-by: Aurelien Jarno git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6177 c046a42c-6fe2-441c-8c8c-71466251a162 --- target-ppc/helper.h | 4 ++++ target-ppc/op_helper.c | 21 +++++++++++++++++++++ target-ppc/translate.c | 4 ++++ 3 files changed, 29 insertions(+) diff --git a/target-ppc/helper.h b/target-ppc/helper.h index f1642a0bbe..d96e030458 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -161,6 +161,10 @@ DEF_HELPER_3(vsplth, void, avr, avr, i32) DEF_HELPER_3(vspltw, void, avr, avr, i32) DEF_HELPER_2(vupkhpx, void, avr, avr) DEF_HELPER_2(vupklpx, void, avr, avr) +DEF_HELPER_2(vupkhsb, void, avr, avr) +DEF_HELPER_2(vupkhsh, void, avr, avr) +DEF_HELPER_2(vupklsb, void, avr, avr) +DEF_HELPER_2(vupklsh, void, 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 9bc213dbc8..ee086527e0 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -2274,6 +2274,27 @@ VUPKPX(lpx, UPKLO) VUPKPX(hpx, UPKHI) #undef VUPKPX +#define VUPK(suffix, unpacked, packee, hi) \ + void helper_vupk##suffix (ppc_avr_t *r, ppc_avr_t *b) \ + { \ + int i; \ + ppc_avr_t result; \ + if (hi) { \ + for (i = 0; i < ARRAY_SIZE(r->unpacked); i++) { \ + result.unpacked[i] = b->packee[i]; \ + } \ + } else { \ + for (i = ARRAY_SIZE(r->unpacked); i < ARRAY_SIZE(r->packee); i++) { \ + result.unpacked[i-ARRAY_SIZE(r->unpacked)] = b->packee[i]; \ + } \ + } \ + *r = result; \ + } +VUPK(hsb, s16, s8, UPKHI) +VUPK(hsh, s32, s16, UPKHI) +VUPK(lsb, s16, s8, UPKLO) +VUPK(lsh, s32, s16, UPKLO) +#undef VUPK #undef UPKHI #undef UPKLO diff --git a/target-ppc/translate.c b/target-ppc/translate.c index e8a620ef3e..0192c408f3 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -6289,6 +6289,10 @@ GEN_VXFORM(vrlw, 2, 2); tcg_temp_free_ptr(rd); \ } +GEN_VXFORM_NOA(vupkhsb, 7, 8); +GEN_VXFORM_NOA(vupkhsh, 7, 9); +GEN_VXFORM_NOA(vupklsb, 7, 10); +GEN_VXFORM_NOA(vupklsh, 7, 11); GEN_VXFORM_NOA(vupkhpx, 7, 13); GEN_VXFORM_NOA(vupklpx, 7, 15);