Commit 4d9903b6c3ae0f6ea6e2158efb93fae11a787358

Authored by aurel32
1 parent b161ae27

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
target-ppc/helper.h
... ... @@ -180,6 +180,8 @@ DEF_HELPER_3(vpkuwum, void, avr, avr, avr)
180 180 DEF_HELPER_3(vpkpx, void, avr, avr, avr)
181 181 DEF_HELPER_4(vmhaddshs, void, avr, avr, avr, avr)
182 182 DEF_HELPER_4(vmhraddshs, void, avr, avr, avr, avr)
  183 +DEF_HELPER_4(vmsumuhm, void, avr, avr, avr, avr)
  184 +DEF_HELPER_4(vmsumuhs, void, avr, avr, avr, avr)
183 185  
184 186 DEF_HELPER_1(efscfsi, i32, i32)
185 187 DEF_HELPER_1(efscfui, i32, i32)
... ...
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)
2180 2180 }
2181 2181 }
2182 2182  
  2183 +void helper_vmsumuhm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
  2184 +{
  2185 + uint32_t prod[8];
  2186 + int i;
  2187 +
  2188 + for (i = 0; i < ARRAY_SIZE(r->u16); i++) {
  2189 + prod[i] = a->u16[i] * b->u16[i];
  2190 + }
  2191 +
  2192 + VECTOR_FOR_INORDER_I(i, u32) {
  2193 + r->u32[i] = c->u32[i] + prod[2*i] + prod[2*i+1];
  2194 + }
  2195 +}
  2196 +
  2197 +void helper_vmsumuhs (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
  2198 +{
  2199 + uint32_t prod[8];
  2200 + int i;
  2201 + int sat = 0;
  2202 +
  2203 + for (i = 0; i < ARRAY_SIZE(r->u16); i++) {
  2204 + prod[i] = a->u16[i] * b->u16[i];
  2205 + }
  2206 +
  2207 + VECTOR_FOR_INORDER_I (i, s32) {
  2208 + uint64_t t = (uint64_t)c->u32[i] + prod[2*i] + prod[2*i+1];
  2209 + r->u32[i] = cvtuduw(t, &sat);
  2210 + }
  2211 +
  2212 + if (sat) {
  2213 + env->vscr |= (1 << VSCR_SAT);
  2214 + }
  2215 +}
  2216 +
2183 2217 #define VMUL_DO(name, mul_element, prod_element, evenp) \
2184 2218 void helper_v##name (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
2185 2219 { \
... ...
target-ppc/translate.c
... ... @@ -6388,6 +6388,7 @@ GEN_HANDLER(vsldoi, 0x04, 0x16, 0xFF, 0x00000400, PPC_ALTIVEC)
6388 6388 GEN_VAFORM_PAIRED(vmhaddshs, vmhraddshs, 16)
6389 6389  
6390 6390 GEN_VAFORM_PAIRED(vmsumubm, vmsummbm, 18)
  6391 +GEN_VAFORM_PAIRED(vmsumuhm, vmsumuhs, 19)
6391 6392 GEN_VAFORM_PAIRED(vsel, vperm, 21)
6392 6393  
6393 6394 /*** SPE extension ***/
... ...