Revision 1add6e23 target-ppc/op_helper.c

b/target-ppc/op_helper.c
2101 2101
#undef VAVG_DO
2102 2102
#undef VAVG
2103 2103

  
2104
#define VCMP_DO(suffix, compare, element, record)                       \
2105
    void helper_vcmp##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
2106
    {                                                                   \
2107
        uint32_t ones = (uint32_t)-1;                                   \
2108
        uint32_t all = ones;                                            \
2109
        uint32_t none = 0;                                              \
2110
        int i;                                                          \
2111
        for (i = 0; i < ARRAY_SIZE(r->element); i++) {                  \
2112
            uint32_t result = (a->element[i] compare b->element[i] ? ones : 0x0); \
2113
            switch (sizeof (a->element[0])) {                           \
2114
            case 4: r->u32[i] = result; break;                          \
2115
            case 2: r->u16[i] = result; break;                          \
2116
            case 1: r->u8[i] = result; break;                           \
2117
            }                                                           \
2118
            all &= result;                                              \
2119
            none |= result;                                             \
2120
        }                                                               \
2121
        if (record) {                                                   \
2122
            env->crf[6] = ((all != 0) << 3) | ((none == 0) << 1);       \
2123
        }                                                               \
2124
    }
2125
#define VCMP(suffix, compare, element)          \
2126
    VCMP_DO(suffix, compare, element, 0)        \
2127
    VCMP_DO(suffix##_dot, compare, element, 1)
2128
VCMP(equb, ==, u8)
2129
VCMP(equh, ==, u16)
2130
VCMP(equw, ==, u32)
2131
VCMP(gtub, >, u8)
2132
VCMP(gtuh, >, u16)
2133
VCMP(gtuw, >, u32)
2134
VCMP(gtsb, >, s8)
2135
VCMP(gtsh, >, s16)
2136
VCMP(gtsw, >, s32)
2137
#undef VCMP_DO
2138
#undef VCMP
2139

  
2104 2140
void helper_vmhaddshs (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
2105 2141
{
2106 2142
    int sat = 0;

Also available in: Unified diff