Revision 875b31db target-ppc/op_helper.c

b/target-ppc/op_helper.c
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;

Also available in: Unified diff