diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-04 22:12:29 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-04 22:12:29 +0000 |
commit | b161ae276691ead06850d858ed2bce0eeab1f38d (patch) | |
tree | dd1ea9c6290f14906068d40df29b55b69e6772cd /target-ppc | |
parent | 1dd9ffb969c82e6edff5b0bff0b26519c6daa9c7 (diff) |
Add vmh{,r}addshs instructions.
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6184 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc')
-rw-r--r-- | target-ppc/helper.h | 2 | ||||
-rw-r--r-- | target-ppc/op_helper.c | 32 | ||||
-rw-r--r-- | target-ppc/translate.c | 2 |
3 files changed, 36 insertions, 0 deletions
diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 81f2dea25a..94a06b12c4 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -178,6 +178,8 @@ DEF_HELPER_3(vpkuwus, void, avr, avr, avr) DEF_HELPER_3(vpkuhum, void, avr, avr, avr) DEF_HELPER_3(vpkuwum, void, avr, avr, avr) DEF_HELPER_3(vpkpx, void, avr, avr, avr) +DEF_HELPER_4(vmhaddshs, void, avr, avr, avr, avr) +DEF_HELPER_4(vmhraddshs, void, avr, 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 dcf1aef8a3..f787774a09 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -2061,6 +2061,38 @@ VAVG(w, s32, int64_t, u32, uint64_t) #undef VAVG_DO #undef VAVG +void helper_vmhaddshs (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) +{ + int sat = 0; + int i; + + for (i = 0; i < ARRAY_SIZE(r->s16); i++) { + int32_t prod = a->s16[i] * b->s16[i]; + int32_t t = (int32_t)c->s16[i] + (prod >> 15); + r->s16[i] = cvtswsh (t, &sat); + } + + if (sat) { + env->vscr |= (1 << VSCR_SAT); + } +} + +void helper_vmhraddshs (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) +{ + int sat = 0; + int i; + + for (i = 0; i < ARRAY_SIZE(r->s16); i++) { + int32_t prod = a->s16[i] * b->s16[i] + 0x00004000; + int32_t t = (int32_t)c->s16[i] + (prod >> 15); + r->s16[i] = cvtswsh (t, &sat); + } + + if (sat) { + env->vscr |= (1 << VSCR_SAT); + } +} + #define VMINMAX_DO(name, compare, element) \ void helper_v##name (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 e0f25576b7..4738e084c7 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -6385,6 +6385,8 @@ GEN_HANDLER(vsldoi, 0x04, 0x16, 0xFF, 0x00000400, PPC_ALTIVEC) tcg_temp_free_ptr(rd); \ } +GEN_VAFORM_PAIRED(vmhaddshs, vmhraddshs, 16) + GEN_VAFORM_PAIRED(vmsumubm, vmsummbm, 18) GEN_VAFORM_PAIRED(vsel, vperm, 21) |