diff options
author | Swapnil Bokade <bokadeswapnil@gmail.com> | 2016-07-28 23:44:15 +0530 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2016-09-07 12:40:11 +1000 |
commit | f7cc8466f1c29550b5ace0750813bc6c9190f604 (patch) | |
tree | 17ee888f5d67120b7ae037b9b2009b013a222a88 /target-ppc/int_helper.c | |
parent | 377070595a5865a7db6fa671a1e84f149d80809a (diff) |
target-ppc: add vcmpnez[b,h,w][.] instructions
Adds following instructions:
vcmpnezb[.]: Vector Compare Not Equal or Zero Byte
vcmpnezh[.]: Vector Compare Not Equal or Zero Halfword
vcmpnezw[.]: Vector Compare Not Equal or Zero Word
Signed-off-by: Swapnil Bokade <bokadeswapnil@gmail.com>
[ collapse switch case ]
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target-ppc/int_helper.c')
-rw-r--r-- | target-ppc/int_helper.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c index ef487d0b9c..9b4de6926b 100644 --- a/target-ppc/int_helper.c +++ b/target-ppc/int_helper.c @@ -719,6 +719,42 @@ VCMP(gtsd, >, s64) #undef VCMP_DO #undef VCMP +#define VCMPNEZ_DO(suffix, element, etype, record) \ +void helper_vcmpnez##suffix(CPUPPCState *env, ppc_avr_t *r, \ + ppc_avr_t *a, ppc_avr_t *b) \ +{ \ + etype ones = (etype)-1; \ + etype all = ones; \ + etype none = 0; \ + int i; \ + \ + for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ + etype result = ((a->element[i] == 0) \ + || (b->element[i] == 0) \ + || (a->element[i] != b->element[i]) ? \ + ones : 0x0); \ + r->element[i] = result; \ + all &= result; \ + none |= result; \ + } \ + if (record) { \ + env->crf[6] = ((all != 0) << 3) | ((none == 0) << 1); \ + } \ +} + +/* VCMPNEZ - Vector compare not equal to zero + * suffix - instruction mnemonic suffix (b: byte, h: halfword, w: word) + * element - element type to access from vector + */ +#define VCMPNEZ(suffix, element, etype) \ + VCMPNEZ_DO(suffix, element, etype, 0) \ + VCMPNEZ_DO(suffix##_dot, element, etype, 1) +VCMPNEZ(b, u8, uint8_t) +VCMPNEZ(h, u16, uint16_t) +VCMPNEZ(w, u32, uint32_t) +#undef VCMPNEZ_DO +#undef VCMPNEZ + #define VCMPFP_DO(suffix, compare, order, record) \ void helper_vcmp##suffix(CPUPPCState *env, ppc_avr_t *r, \ ppc_avr_t *a, ppc_avr_t *b) \ |