Commit eae07261c7620231ae347878284fa36e3dc0d1c0
1 parent
4d9903b6
Add vmsumsh{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@6186 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
37 additions
and
0 deletions
target-ppc/helper.h
... | ... | @@ -182,6 +182,8 @@ DEF_HELPER_4(vmhaddshs, void, avr, avr, avr, avr) |
182 | 182 | DEF_HELPER_4(vmhraddshs, void, avr, avr, avr, avr) |
183 | 183 | DEF_HELPER_4(vmsumuhm, void, avr, avr, avr, avr) |
184 | 184 | DEF_HELPER_4(vmsumuhs, void, avr, avr, avr, avr) |
185 | +DEF_HELPER_4(vmsumshm, void, avr, avr, avr, avr) | |
186 | +DEF_HELPER_4(vmsumshs, void, avr, avr, avr, avr) | |
185 | 187 | |
186 | 188 | DEF_HELPER_1(efscfsi, i32, i32) |
187 | 189 | DEF_HELPER_1(efscfui, i32, i32) | ... | ... |
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) |
2166 | 2166 | } |
2167 | 2167 | } |
2168 | 2168 | |
2169 | +void helper_vmsumshm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) | |
2170 | +{ | |
2171 | + int32_t prod[8]; | |
2172 | + int i; | |
2173 | + | |
2174 | + for (i = 0; i < ARRAY_SIZE(r->s16); i++) { | |
2175 | + prod[i] = a->s16[i] * b->s16[i]; | |
2176 | + } | |
2177 | + | |
2178 | + VECTOR_FOR_INORDER_I(i, s32) { | |
2179 | + r->s32[i] = c->s32[i] + prod[2*i] + prod[2*i+1]; | |
2180 | + } | |
2181 | +} | |
2182 | + | |
2183 | +void helper_vmsumshs (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) | |
2184 | +{ | |
2185 | + int32_t prod[8]; | |
2186 | + int i; | |
2187 | + int sat = 0; | |
2188 | + | |
2189 | + for (i = 0; i < ARRAY_SIZE(r->s16); i++) { | |
2190 | + prod[i] = (int32_t)a->s16[i] * b->s16[i]; | |
2191 | + } | |
2192 | + | |
2193 | + VECTOR_FOR_INORDER_I (i, s32) { | |
2194 | + int64_t t = (int64_t)c->s32[i] + prod[2*i] + prod[2*i+1]; | |
2195 | + r->u32[i] = cvtsdsw(t, &sat); | |
2196 | + } | |
2197 | + | |
2198 | + if (sat) { | |
2199 | + env->vscr |= (1 << VSCR_SAT); | |
2200 | + } | |
2201 | +} | |
2202 | + | |
2169 | 2203 | void helper_vmsumubm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) |
2170 | 2204 | { |
2171 | 2205 | uint16_t prod[16]; | ... | ... |
target-ppc/translate.c
... | ... | @@ -6389,6 +6389,7 @@ GEN_VAFORM_PAIRED(vmhaddshs, vmhraddshs, 16) |
6389 | 6389 | |
6390 | 6390 | GEN_VAFORM_PAIRED(vmsumubm, vmsummbm, 18) |
6391 | 6391 | GEN_VAFORM_PAIRED(vmsumuhm, vmsumuhs, 19) |
6392 | +GEN_VAFORM_PAIRED(vmsumshm, vmsumshs, 20) | |
6392 | 6393 | GEN_VAFORM_PAIRED(vsel, vperm, 21) |
6393 | 6394 | |
6394 | 6395 | /*** SPE extension ***/ | ... | ... |