diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-04 22:12:39 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-04 22:12:39 +0000 |
commit | 4d9903b6c3ae0f6ea6e2158efb93fae11a787358 (patch) | |
tree | bc77b3dcb4401814cb4db51f8fb31719dbf0036c | |
parent | b161ae276691ead06850d858ed2bce0eeab1f38d (diff) |
Add vmsumuh{m,s} 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@6185 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | target-ppc/helper.h | 2 | ||||
-rw-r--r-- | target-ppc/op_helper.c | 34 | ||||
-rw-r--r-- | target-ppc/translate.c | 1 |
3 files changed, 37 insertions, 0 deletions
diff --git a/target-ppc/helper.h b/target-ppc/helper.h index 94a06b12c4..5709a3831b 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -180,6 +180,8 @@ 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_4(vmsumuhm, void, avr, avr, avr, avr) +DEF_HELPER_4(vmsumuhs, 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 f787774a09..be3e9289ea 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -2180,6 +2180,40 @@ void helper_vmsumubm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) } } +void helper_vmsumuhm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) +{ + uint32_t prod[8]; + int i; + + for (i = 0; i < ARRAY_SIZE(r->u16); i++) { + prod[i] = a->u16[i] * b->u16[i]; + } + + VECTOR_FOR_INORDER_I(i, u32) { + r->u32[i] = c->u32[i] + prod[2*i] + prod[2*i+1]; + } +} + +void helper_vmsumuhs (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) +{ + uint32_t prod[8]; + int i; + int sat = 0; + + for (i = 0; i < ARRAY_SIZE(r->u16); i++) { + prod[i] = a->u16[i] * b->u16[i]; + } + + VECTOR_FOR_INORDER_I (i, s32) { + uint64_t t = (uint64_t)c->u32[i] + prod[2*i] + prod[2*i+1]; + r->u32[i] = cvtuduw(t, &sat); + } + + if (sat) { + env->vscr |= (1 << VSCR_SAT); + } +} + #define VMUL_DO(name, mul_element, prod_element, evenp) \ 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 4738e084c7..246d099ced 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -6388,6 +6388,7 @@ GEN_HANDLER(vsldoi, 0x04, 0x16, 0xFF, 0x00000400, PPC_ALTIVEC) GEN_VAFORM_PAIRED(vmhaddshs, vmhraddshs, 16) GEN_VAFORM_PAIRED(vmsumubm, vmsummbm, 18) +GEN_VAFORM_PAIRED(vmsumuhm, vmsumuhs, 19) GEN_VAFORM_PAIRED(vsel, vperm, 21) /*** SPE extension ***/ |