Commit e4e6bee78704c431547714c0bc1eea537e1fb3ed

Authored by aurel32
1 parent 27a4edb3

Add vsplt{b,h,w} 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@6174 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/helper.h
... ... @@ -156,6 +156,9 @@ DEF_HELPER_3(vrlb, void, avr, avr, avr)
156 156 DEF_HELPER_3(vrlh, void, avr, avr, avr)
157 157 DEF_HELPER_3(vrlw, void, avr, avr, avr)
158 158 DEF_HELPER_4(vsldoi, void, avr, avr, avr, i32)
  159 +DEF_HELPER_3(vspltb, void, avr, avr, i32)
  160 +DEF_HELPER_3(vsplth, void, avr, avr, i32)
  161 +DEF_HELPER_3(vspltw, void, avr, avr, i32)
159 162  
160 163 DEF_HELPER_1(efscfsi, i32, i32)
161 164 DEF_HELPER_1(efscfui, i32, i32)
... ...
target-ppc/op_helper.c
... ... @@ -2186,6 +2186,29 @@ void helper_vslo (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
2186 2186 #endif
2187 2187 }
2188 2188  
  2189 +/* Experimental testing shows that hardware masks the immediate. */
  2190 +#define _SPLAT_MASKED(element) (splat & (ARRAY_SIZE(r->element) - 1))
  2191 +#if defined(WORDS_BIGENDIAN)
  2192 +#define SPLAT_ELEMENT(element) _SPLAT_MASKED(element)
  2193 +#else
  2194 +#define SPLAT_ELEMENT(element) (ARRAY_SIZE(r->element)-1 - _SPLAT_MASKED(element))
  2195 +#endif
  2196 +#define VSPLT(suffix, element) \
  2197 + void helper_vsplt##suffix (ppc_avr_t *r, ppc_avr_t *b, uint32_t splat) \
  2198 + { \
  2199 + uint32_t s = b->element[SPLAT_ELEMENT(element)]; \
  2200 + int i; \
  2201 + for (i = 0; i < ARRAY_SIZE(r->element); i++) { \
  2202 + r->element[i] = s; \
  2203 + } \
  2204 + }
  2205 +VSPLT(b, u8)
  2206 +VSPLT(h, u16)
  2207 +VSPLT(w, u32)
  2208 +#undef VSPLT
  2209 +#undef SPLAT_ELEMENT
  2210 +#undef _SPLAT_MASKED
  2211 +
2189 2212 #define VSR(suffix, element) \
2190 2213 void helper_vsr##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
2191 2214 { \
... ...
target-ppc/translate.c
... ... @@ -6308,6 +6308,10 @@ GEN_VXFORM(vrlw, 2, 2);
6308 6308 tcg_temp_free_ptr(rd); \
6309 6309 }
6310 6310  
  6311 +GEN_VXFORM_UIMM(vspltb, 6, 8);
  6312 +GEN_VXFORM_UIMM(vsplth, 6, 9);
  6313 +GEN_VXFORM_UIMM(vspltw, 6, 10);
  6314 +
6311 6315 GEN_HANDLER(vsldoi, 0x04, 0x16, 0xFF, 0x00000400, PPC_ALTIVEC)
6312 6316 {
6313 6317 TCGv_ptr ra, rb, rd;
... ...