[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 37/40] Add vmsumsh{m,s} instructions.
From: |
Nathan Froyd |
Subject: |
[Qemu-devel] [PATCH 37/40] Add vmsumsh{m,s} instructions. |
Date: |
Tue, 30 Dec 2008 19:10:19 -0800 |
Signed-off-by: Nathan Froyd <address@hidden>
---
target-ppc/helper.h | 2 ++
target-ppc/op_helper.c | 34 ++++++++++++++++++++++++++++++++++
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 ceb7351..b4b9521 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -208,6 +208,8 @@ 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_4(vmsumshm, void, avr, avr, avr, avr)
+DEF_HELPER_4(vmsumshs, 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 7c72a52..097153e 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -2246,6 +2246,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];
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 9e0b58e..a9ab8d5 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -6481,6 +6481,7 @@ GEN_VAFORM_PAIRED(vmhaddshs, vmhraddshs, 16)
GEN_VAFORM_PAIRED(vmsumubm, vmsummbm, 18)
GEN_VAFORM_PAIRED(vmsumuhm, vmsumuhs, 19)
+GEN_VAFORM_PAIRED(vmsumshm, vmsumshs, 20)
GEN_VAFORM_PAIRED(vsel, vperm, 21)
/*** SPE extension ***/
--
1.6.0.5
- [Qemu-devel] [PATCH] target-ppc: add integer Altivec instructions, take 2, Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 09/40] Add vscr access macros., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 15/40] Add v{add,sub}cuw instructions., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 20/40] Add vs{l,r} instructions., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 25/40] Add vsplt{b,h,w} instructions., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 37/40] Add vmsumsh{m,s} instructions.,
Nathan Froyd <=
- [Qemu-devel] [PATCH 31/40] Add vsel and vperm instructions., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 04/40] Add v{add,sub}u{b,h,w}m instructions., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 10/40] Add vmrg{l,h}{b,h,w} instructions., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 12/40] Add vsr{,a}{b,h,w} instructions., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 29/40] Add GEN_VAFORM_PAIRED macro for subsequent instructions., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 02/40] Add helper macros for later patches., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 11/40] Add vmul{e,o}{s,u}{b,h} instructions., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 16/40] Add lvs{l,r} instructions., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 22/40] Add GEN_VXFORM_SIMM macro for subsequent instructions., Nathan Froyd, 2008/12/30
- [Qemu-devel] [PATCH 39/40] Add {l,st}ve{b,h,w}x instructions., Nathan Froyd, 2008/12/30