From eae07261c7620231ae347878284fa36e3dc0d1c0 Mon Sep 17 00:00:00 2001 From: aurel32 Date: Sun, 4 Jan 2009 22:12:49 +0000 Subject: Add vmsumsh{m,s} instructions. Signed-off-by: Nathan Froyd Signed-off-by: Aurelien Jarno git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6186 c046a42c-6fe2-441c-8c8c-71466251a162 --- target-ppc/op_helper.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'target-ppc/op_helper.c') diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index be3e9289ea..6ff215675a 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -2166,6 +2166,40 @@ void helper_vmsummbm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) } } +void helper_vmsumshm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) +{ + int32_t prod[8]; + int i; + + for (i = 0; i < ARRAY_SIZE(r->s16); i++) { + prod[i] = a->s16[i] * b->s16[i]; + } + + VECTOR_FOR_INORDER_I(i, s32) { + r->s32[i] = c->s32[i] + prod[2*i] + prod[2*i+1]; + } +} + +void helper_vmsumshs (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) +{ + int32_t prod[8]; + int i; + int sat = 0; + + for (i = 0; i < ARRAY_SIZE(r->s16); i++) { + prod[i] = (int32_t)a->s16[i] * b->s16[i]; + } + + VECTOR_FOR_INORDER_I (i, s32) { + int64_t t = (int64_t)c->s32[i] + prod[2*i] + prod[2*i+1]; + r->u32[i] = cvtsdsw(t, &sat); + } + + if (sat) { + env->vscr |= (1 << VSCR_SAT); + } +} + void helper_vmsumubm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) { uint16_t prod[16]; -- cgit v1.2.3