[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 38/40] Add vmladduhm instruction.
From: |
Nathan Froyd |
Subject: |
[Qemu-devel] [PATCH 38/40] Add vmladduhm instruction. |
Date: |
Tue, 30 Dec 2008 19:10:20 -0800 |
Signed-off-by: Nathan Froyd <address@hidden>
---
target-ppc/helper.h | 1 +
target-ppc/op_helper.c | 11 ++++++++++-
target-ppc/translate.c | 18 ++++++++++++++++++
3 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index b4b9521..f97480e 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -210,6 +210,7 @@ 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_4(vmladduhm, 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 097153e..4fe6d43 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -2197,12 +2197,21 @@ VMINMAX(uw, u32)
#undef VMINMAX_DO
#undef VMINMAX
+void helper_vmladduhm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
+{
+ int i;
+ for (i = 0; i < ARRAY_SIZE(r->s16); i++) {
+ int32_t prod = a->s16[i] * b->s16[i];
+ r->s16[i] = (int16_t) (prod + c->s16[i]);
+ }
+}
+
#define VMRG_DO(name, element, highp) \
void helper_v##name (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
{ \
ppc_avr_t result; \
int i; \
- size_t n_elems = N_ELEMS(element); \
+ size_t n_elems = ARRAY_SIZE(r->element); \
for (i = 0; i < n_elems/2; i++) { \
if (highp) { \
result.element[i*2+HI_IDX] = a->element[i]; \
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index a9ab8d5..93cebcf 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -6479,6 +6479,24 @@ GEN_HANDLER(vsldoi, 0x04, 0x16, 0xFF, 0x00000400,
PPC_ALTIVEC)
GEN_VAFORM_PAIRED(vmhaddshs, vmhraddshs, 16)
+GEN_HANDLER(vmladduhm, 0x04, 0x11, 0xFF, 0x00000000, PPC_ALTIVEC)
+{
+ TCGv_ptr ra, rb, rc, rd;
+ if (unlikely(!ctx->altivec_enabled)) {
+ gen_exception(ctx, POWERPC_EXCP_VPU);
+ return;
+ }
+ ra = gen_avr_ptr(rA(ctx->opcode));
+ rb = gen_avr_ptr(rB(ctx->opcode));
+ rc = gen_avr_ptr(rC(ctx->opcode));
+ rd = gen_avr_ptr(rD(ctx->opcode));
+ gen_helper_vmladduhm(rd, ra, rb, rc);
+ tcg_temp_free_ptr(ra);
+ tcg_temp_free_ptr(rb);
+ tcg_temp_free_ptr(rc);
+ tcg_temp_free_ptr(rd);
+}
+
GEN_VAFORM_PAIRED(vmsumubm, vmsummbm, 18)
GEN_VAFORM_PAIRED(vmsumuhm, vmsumuhs, 19)
GEN_VAFORM_PAIRED(vmsumshm, vmsumshs, 20)
--
1.6.0.5
- [Qemu-devel] [PATCH 06/40] Add v{min, max}{s, u}{b, h, w} instructions., (continued)
- [Qemu-devel] [PATCH 06/40] Add v{min, max}{s, u}{b, h, w} instructions., Nathan Froyd, 2008/12/31
- [Qemu-devel] [PATCH 33/40] Add vpks{h, w}{s, u}s, vpku{h, w}us, and vpku{h, w}um instructions., Nathan Froyd, 2008/12/31
- [Qemu-devel] [PATCH 07/40] Add GEN_VXRFORM{, 1} macros for subsequent instructions., Nathan Froyd, 2008/12/31
- [Qemu-devel] [PATCH 08/40] Add vcmpequ{b, h, w} and vcmpgt{s, u}{b, h, w} instructions., Nathan Froyd, 2008/12/31
- [Qemu-devel] [PATCH 19/40] Add vrl{b,h,w} instructions., Nathan Froyd, 2008/12/31
- [Qemu-devel] [PATCH 32/40] Add saturating arithmetic conversion functions for subsequent instructions., Nathan Froyd, 2008/12/31
- [Qemu-devel] [PATCH 14/40] Add vs{l,r}o instructions., Nathan Froyd, 2008/12/31
- [Qemu-devel] [PATCH 34/40] Add vpkpx instruction., Nathan Froyd, 2008/12/31
- [Qemu-devel] [PATCH 17/40] Add m{f,t}vscr instructions., Nathan Froyd, 2008/12/31
- [Qemu-devel] [PATCH 35/40] Add vmh{,r}addshs instructions., Nathan Froyd, 2008/12/31
- [Qemu-devel] [PATCH 38/40] Add vmladduhm instruction.,
Nathan Froyd <=