Revision e4e6bee7 target-ppc/op_helper.c

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

Also available in: Unified diff