Commit b161ae276691ead06850d858ed2bce0eeab1f38d

Authored by aurel32
1 parent 1dd9ffb9

Add vmh{,r}addshs 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@6184 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/helper.h
... ... @@ -178,6 +178,8 @@ DEF_HELPER_3(vpkuwus, void, avr, avr, avr)
178 178 DEF_HELPER_3(vpkuhum, void, avr, avr, avr)
179 179 DEF_HELPER_3(vpkuwum, void, avr, avr, avr)
180 180 DEF_HELPER_3(vpkpx, void, avr, avr, avr)
  181 +DEF_HELPER_4(vmhaddshs, void, avr, avr, avr, avr)
  182 +DEF_HELPER_4(vmhraddshs, void, avr, avr, avr, avr)
181 183  
182 184 DEF_HELPER_1(efscfsi, i32, i32)
183 185 DEF_HELPER_1(efscfui, i32, i32)
... ...
target-ppc/op_helper.c
... ... @@ -2061,6 +2061,38 @@ VAVG(w, s32, int64_t, u32, uint64_t)
2061 2061 #undef VAVG_DO
2062 2062 #undef VAVG
2063 2063  
  2064 +void helper_vmhaddshs (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
  2065 +{
  2066 + int sat = 0;
  2067 + int i;
  2068 +
  2069 + for (i = 0; i < ARRAY_SIZE(r->s16); i++) {
  2070 + int32_t prod = a->s16[i] * b->s16[i];
  2071 + int32_t t = (int32_t)c->s16[i] + (prod >> 15);
  2072 + r->s16[i] = cvtswsh (t, &sat);
  2073 + }
  2074 +
  2075 + if (sat) {
  2076 + env->vscr |= (1 << VSCR_SAT);
  2077 + }
  2078 +}
  2079 +
  2080 +void helper_vmhraddshs (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
  2081 +{
  2082 + int sat = 0;
  2083 + int i;
  2084 +
  2085 + for (i = 0; i < ARRAY_SIZE(r->s16); i++) {
  2086 + int32_t prod = a->s16[i] * b->s16[i] + 0x00004000;
  2087 + int32_t t = (int32_t)c->s16[i] + (prod >> 15);
  2088 + r->s16[i] = cvtswsh (t, &sat);
  2089 + }
  2090 +
  2091 + if (sat) {
  2092 + env->vscr |= (1 << VSCR_SAT);
  2093 + }
  2094 +}
  2095 +
2064 2096 #define VMINMAX_DO(name, compare, element) \
2065 2097 void helper_v##name (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
2066 2098 { \
... ...
target-ppc/translate.c
... ... @@ -6385,6 +6385,8 @@ GEN_HANDLER(vsldoi, 0x04, 0x16, 0xFF, 0x00000400, PPC_ALTIVEC)
6385 6385 tcg_temp_free_ptr(rd); \
6386 6386 }
6387 6387  
  6388 +GEN_VAFORM_PAIRED(vmhaddshs, vmhraddshs, 16)
  6389 +
6388 6390 GEN_VAFORM_PAIRED(vmsumubm, vmsummbm, 18)
6389 6391 GEN_VAFORM_PAIRED(vsel, vperm, 21)
6390 6392  
... ...