Commit 79f85c3ae96b9406809c3ee53881d1d891691c5f

Authored by aurel32
1 parent de5f2484

Add vupk{h,l}px 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@6176 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/helper.h
... ... @@ -159,6 +159,8 @@ DEF_HELPER_4(vsldoi, void, avr, avr, avr, i32)
159 159 DEF_HELPER_3(vspltb, void, avr, avr, i32)
160 160 DEF_HELPER_3(vsplth, void, avr, avr, i32)
161 161 DEF_HELPER_3(vspltw, void, avr, avr, i32)
  162 +DEF_HELPER_2(vupkhpx, void, avr, avr)
  163 +DEF_HELPER_2(vupklpx, void, avr, avr)
162 164  
163 165 DEF_HELPER_1(efscfsi, i32, i32)
164 166 DEF_HELPER_1(efscfui, i32, i32)
... ...
target-ppc/op_helper.c
... ... @@ -2248,6 +2248,35 @@ void helper_vsubcuw (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
2248 2248 }
2249 2249 }
2250 2250  
  2251 +#if defined(WORDS_BIGENDIAN)
  2252 +#define UPKHI 1
  2253 +#define UPKLO 0
  2254 +#else
  2255 +#define UPKHI 0
  2256 +#define UPKLO 1
  2257 +#endif
  2258 +#define VUPKPX(suffix, hi) \
  2259 + void helper_vupk##suffix (ppc_avr_t *r, ppc_avr_t *b) \
  2260 + { \
  2261 + int i; \
  2262 + ppc_avr_t result; \
  2263 + for (i = 0; i < ARRAY_SIZE(r->u32); i++) { \
  2264 + uint16_t e = b->u16[hi ? i : i+4]; \
  2265 + uint8_t a = (e >> 15) ? 0xff : 0; \
  2266 + uint8_t r = (e >> 10) & 0x1f; \
  2267 + uint8_t g = (e >> 5) & 0x1f; \
  2268 + uint8_t b = e & 0x1f; \
  2269 + result.u32[i] = (a << 24) | (r << 16) | (g << 8) | b; \
  2270 + } \
  2271 + *r = result; \
  2272 + }
  2273 +VUPKPX(lpx, UPKLO)
  2274 +VUPKPX(hpx, UPKHI)
  2275 +#undef VUPKPX
  2276 +
  2277 +#undef UPKHI
  2278 +#undef UPKLO
  2279 +
2251 2280 #undef VECTOR_FOR_INORDER_I
2252 2281 #undef HI_IDX
2253 2282 #undef LO_IDX
... ...
target-ppc/translate.c
... ... @@ -6289,6 +6289,9 @@ GEN_VXFORM(vrlw, 2, 2);
6289 6289 tcg_temp_free_ptr(rd); \
6290 6290 }
6291 6291  
  6292 +GEN_VXFORM_NOA(vupkhpx, 7, 13);
  6293 +GEN_VXFORM_NOA(vupklpx, 7, 15);
  6294 +
6292 6295 #define GEN_VXFORM_SIMM(name, opc2, opc3) \
6293 6296 GEN_HANDLER(name, 0x04, opc2, opc3, 0x00000000, PPC_ALTIVEC) \
6294 6297 { \
... ...