diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-08 18:54:38 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-08 18:54:38 +0000 |
commit | 1add6e234a1cb25e951fb161f144d294ac2cfd05 (patch) | |
tree | bd951f9fed60e6e1f3b60165e284778a7e8b3df6 /target-ppc | |
parent | 0cbcd90636872c0d56a44d3e1040080660894eec (diff) | |
download | qemu-1add6e234a1cb25e951fb161f144d294ac2cfd05.zip |
Add vcmpequ{b, h, w} and vcmpgt{s, u}{b, h, w} instructions
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6236 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc')
-rw-r--r-- | target-ppc/helper.h | 18 | ||||
-rw-r--r-- | target-ppc/op_helper.c | 36 | ||||
-rw-r--r-- | target-ppc/translate.c | 10 |
3 files changed, 64 insertions, 0 deletions
diff --git a/target-ppc/helper.h b/target-ppc/helper.h index f319fdb5e1..bae137ba2e 100644 --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -123,6 +123,24 @@ DEF_HELPER_3(vminuw, void, avr, avr, avr) DEF_HELPER_3(vmaxub, void, avr, avr, avr) DEF_HELPER_3(vmaxuh, void, avr, avr, avr) DEF_HELPER_3(vmaxuw, void, avr, avr, avr) +DEF_HELPER_3(vcmpequb, void, avr, avr, avr) +DEF_HELPER_3(vcmpequh, void, avr, avr, avr) +DEF_HELPER_3(vcmpequw, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtub, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtuh, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtuw, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtsb, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtsh, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtsw, void, avr, avr, avr) +DEF_HELPER_3(vcmpequb_dot, void, avr, avr, avr) +DEF_HELPER_3(vcmpequh_dot, void, avr, avr, avr) +DEF_HELPER_3(vcmpequw_dot, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtub_dot, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtuh_dot, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtuw_dot, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtsb_dot, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtsh_dot, void, avr, avr, avr) +DEF_HELPER_3(vcmpgtsw_dot, void, avr, avr, avr) DEF_HELPER_3(vmrglb, void, avr, avr, avr) DEF_HELPER_3(vmrglh, void, avr, avr, avr) DEF_HELPER_3(vmrglw, void, avr, avr, avr) diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index 5e40e42ea1..eb155aa50f 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -2101,6 +2101,42 @@ VAVG(w, s32, int64_t, u32, uint64_t) #undef VAVG_DO #undef VAVG +#define VCMP_DO(suffix, compare, element, record) \ + void helper_vcmp##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ + { \ + uint32_t ones = (uint32_t)-1; \ + uint32_t all = ones; \ + uint32_t none = 0; \ + int i; \ + for (i = 0; i < ARRAY_SIZE(r->element); i++) { \ + uint32_t result = (a->element[i] compare b->element[i] ? ones : 0x0); \ + switch (sizeof (a->element[0])) { \ + case 4: r->u32[i] = result; break; \ + case 2: r->u16[i] = result; break; \ + case 1: r->u8[i] = result; break; \ + } \ + all &= result; \ + none |= result; \ + } \ + if (record) { \ + env->crf[6] = ((all != 0) << 3) | ((none == 0) << 1); \ + } \ + } +#define VCMP(suffix, compare, element) \ + VCMP_DO(suffix, compare, element, 0) \ + VCMP_DO(suffix##_dot, compare, element, 1) +VCMP(equb, ==, u8) +VCMP(equh, ==, u16) +VCMP(equw, ==, u32) +VCMP(gtub, >, u8) +VCMP(gtuh, >, u16) +VCMP(gtuw, >, u32) +VCMP(gtsb, >, s8) +VCMP(gtsh, >, s16) +VCMP(gtsw, >, s32) +#undef VCMP_DO +#undef VCMP + void helper_vmhaddshs (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) { int sat = 0; diff --git a/target-ppc/translate.c b/target-ppc/translate.c index ee3c7473dc..20e9e0c048 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -6380,6 +6380,16 @@ GEN_VXFORM(vsumsws, 4, 30); GEN_VXRFORM1(name, name, #name, opc2, opc3) \ GEN_VXRFORM1(name##_dot, name##_, #name ".", opc2, (opc3 | (0x1 << 4))) +GEN_VXRFORM(vcmpequb, 3, 0) +GEN_VXRFORM(vcmpequh, 3, 1) +GEN_VXRFORM(vcmpequw, 3, 2) +GEN_VXRFORM(vcmpgtsb, 3, 12) +GEN_VXRFORM(vcmpgtsh, 3, 13) +GEN_VXRFORM(vcmpgtsw, 3, 14) +GEN_VXRFORM(vcmpgtub, 3, 8) +GEN_VXRFORM(vcmpgtuh, 3, 9) +GEN_VXRFORM(vcmpgtuw, 3, 10) + #define GEN_VXFORM_NOA(name, opc2, opc3) \ GEN_HANDLER(name, 0x04, opc2, opc3, 0x001f0000, PPC_ALTIVEC) \ { \ |