Commit bcd2ee23ea2ade96427cada5f2967b769b43f373

Authored by aurel32
1 parent eae07261

Add vmladduhm instruction.

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@6187 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/helper.h
... ... @@ -184,6 +184,7 @@ DEF_HELPER_4(vmsumuhm, void, avr, avr, avr, avr)
184 184 DEF_HELPER_4(vmsumuhs, void, avr, avr, avr, avr)
185 185 DEF_HELPER_4(vmsumshm, void, avr, avr, avr, avr)
186 186 DEF_HELPER_4(vmsumshs, void, avr, avr, avr, avr)
  187 +DEF_HELPER_4(vmladduhm, void, avr, avr, avr, avr)
187 188  
188 189 DEF_HELPER_1(efscfsi, i32, i32)
189 190 DEF_HELPER_1(efscfui, i32, i32)
... ...
target-ppc/op_helper.c
... ... @@ -2117,6 +2117,15 @@ VMINMAX(uw, u32)
2117 2117 #undef VMINMAX_DO
2118 2118 #undef VMINMAX
2119 2119  
  2120 +void helper_vmladduhm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
  2121 +{
  2122 + int i;
  2123 + for (i = 0; i < ARRAY_SIZE(r->s16); i++) {
  2124 + int32_t prod = a->s16[i] * b->s16[i];
  2125 + r->s16[i] = (int16_t) (prod + c->s16[i]);
  2126 + }
  2127 +}
  2128 +
2120 2129 #define VMRG_DO(name, element, highp) \
2121 2130 void helper_v##name (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
2122 2131 { \
... ...
target-ppc/translate.c
... ... @@ -6387,6 +6387,24 @@ GEN_HANDLER(vsldoi, 0x04, 0x16, 0xFF, 0x00000400, PPC_ALTIVEC)
6387 6387  
6388 6388 GEN_VAFORM_PAIRED(vmhaddshs, vmhraddshs, 16)
6389 6389  
  6390 +GEN_HANDLER(vmladduhm, 0x04, 0x11, 0xFF, 0x00000000, PPC_ALTIVEC)
  6391 +{
  6392 + TCGv_ptr ra, rb, rc, rd;
  6393 + if (unlikely(!ctx->altivec_enabled)) {
  6394 + gen_exception(ctx, POWERPC_EXCP_VPU);
  6395 + return;
  6396 + }
  6397 + ra = gen_avr_ptr(rA(ctx->opcode));
  6398 + rb = gen_avr_ptr(rB(ctx->opcode));
  6399 + rc = gen_avr_ptr(rC(ctx->opcode));
  6400 + rd = gen_avr_ptr(rD(ctx->opcode));
  6401 + gen_helper_vmladduhm(rd, ra, rb, rc);
  6402 + tcg_temp_free_ptr(ra);
  6403 + tcg_temp_free_ptr(rb);
  6404 + tcg_temp_free_ptr(rc);
  6405 + tcg_temp_free_ptr(rd);
  6406 +}
  6407 +
6390 6408 GEN_VAFORM_PAIRED(vmsumubm, vmsummbm, 18)
6391 6409 GEN_VAFORM_PAIRED(vmsumuhm, vmsumuhs, 19)
6392 6410 GEN_VAFORM_PAIRED(vmsumshm, vmsumshs, 20)
... ...