Revision d1258698 target-ppc/op_helper.c

b/target-ppc/op_helper.c
2143 2143
#undef VMUL_DO
2144 2144
#undef VMUL
2145 2145

  
2146
void helper_vperm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
2147
{
2148
    ppc_avr_t result;
2149
    int i;
2150
    VECTOR_FOR_INORDER_I (i, u8) {
2151
        int s = c->u8[i] & 0x1f;
2152
#if defined(WORDS_BIGENDIAN)
2153
        int index = s & 0xf;
2154
#else
2155
        int index = 15 - (s & 0xf);
2156
#endif
2157
        if (s & 0x10) {
2158
            result.u8[i] = b->u8[index];
2159
        } else {
2160
            result.u8[i] = a->u8[index];
2161
        }
2162
    }
2163
    *r = result;
2164
}
2165

  
2146 2166
#define VROTATE(suffix, element)                                        \
2147 2167
    void helper_vrl##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)  \
2148 2168
    {                                                                   \
......
2158 2178
VROTATE(w, u32)
2159 2179
#undef VROTATE
2160 2180

  
2181
void helper_vsel (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
2182
{
2183
    r->u64[0] = (a->u64[0] & ~c->u64[0]) | (b->u64[0] & c->u64[0]);
2184
    r->u64[1] = (a->u64[1] & ~c->u64[1]) | (b->u64[1] & c->u64[1]);
2185
}
2186

  
2161 2187
#define VSL(suffix, element)                                            \
2162 2188
    void helper_vsl##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)  \
2163 2189
    {                                                                   \

Also available in: Unified diff