Commit 875b31db7fb33b8155727d2b1a5232c0d7a0a655

Authored by aurel32
1 parent 819ca121

target-ppc: Add vct{u,s}xs 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@6572 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/helper.h
... ... @@ -253,6 +253,8 @@ DEF_HELPER_2(vrfip, void, avr, avr)
253 253 DEF_HELPER_2(vrfiz, void, avr, avr)
254 254 DEF_HELPER_3(vcfux, void, avr, avr, i32)
255 255 DEF_HELPER_3(vcfsx, void, avr, avr, i32)
  256 +DEF_HELPER_3(vctuxs, void, avr, avr, i32)
  257 +DEF_HELPER_3(vctsxs, void, avr, avr, i32)
256 258  
257 259 DEF_HELPER_1(efscfsi, i32, i32)
258 260 DEF_HELPER_1(efscfui, i32, i32)
... ...
target-ppc/op_helper.c
... ... @@ -2288,6 +2288,33 @@ void helper_vcmpbfp_dot (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
2288 2288 vcmpbfp_internal(r, a, b, 1);
2289 2289 }
2290 2290  
  2291 +#define VCT(suffix, satcvt, element) \
  2292 + void helper_vct##suffix (ppc_avr_t *r, ppc_avr_t *b, uint32_t uim) \
  2293 + { \
  2294 + int i; \
  2295 + int sat = 0; \
  2296 + float_status s = env->vec_status; \
  2297 + set_float_rounding_mode(float_round_to_zero, &s); \
  2298 + for (i = 0; i < ARRAY_SIZE(r->f); i++) { \
  2299 + if (float32_is_nan(b->f[i]) || \
  2300 + float32_is_signaling_nan(b->f[i])) { \
  2301 + r->element[i] = 0; \
  2302 + } else { \
  2303 + float64 t = float32_to_float64(b->f[i], &s); \
  2304 + int64_t j; \
  2305 + t = float64_scalbn(t, uim, &s); \
  2306 + j = float64_to_int64(t, &s); \
  2307 + r->element[i] = satcvt(j, &sat); \
  2308 + } \
  2309 + } \
  2310 + if (sat) { \
  2311 + env->vscr |= (1 << VSCR_SAT); \
  2312 + } \
  2313 + }
  2314 +VCT(uxs, cvtsduw, u32)
  2315 +VCT(sxs, cvtsdsw, s32)
  2316 +#undef VCT
  2317 +
2291 2318 void helper_vmaddfp (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
2292 2319 {
2293 2320 int i;
... ...
target-ppc/translate.c
... ... @@ -6521,6 +6521,8 @@ GEN_VXFORM_UIMM(vsplth, 6, 9);
6521 6521 GEN_VXFORM_UIMM(vspltw, 6, 10);
6522 6522 GEN_VXFORM_UIMM(vcfux, 5, 12);
6523 6523 GEN_VXFORM_UIMM(vcfsx, 5, 13);
  6524 +GEN_VXFORM_UIMM(vctuxs, 5, 14);
  6525 +GEN_VXFORM_UIMM(vctsxs, 5, 15);
6524 6526  
6525 6527 GEN_HANDLER(vsldoi, 0x04, 0x16, 0xFF, 0x00000400, PPC_ALTIVEC)
6526 6528 {
... ...