diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-04 22:12:09 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-04 22:12:09 +0000 |
commit | 5335a145a178630a8d157cd927c5bd697d1e362e (patch) | |
tree | c14aad9174d19a30394cbbf8b71103e5f950ec0d /target-ppc/op_helper.c | |
parent | 00d3b8f59bb58e4c7ae52fc73d55d2f27e664443 (diff) | |
download | qemu-5335a145a178630a8d157cd927c5bd697d1e362e.tar.gz qemu-5335a145a178630a8d157cd927c5bd697d1e362e.tar.bz2 qemu-5335a145a178630a8d157cd927c5bd697d1e362e.zip |
Add vpks{h, w}{s, u}s, vpku{h, w}us, and vpku{h, w}um 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@6182 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc/op_helper.c')
-rw-r--r-- | target-ppc/op_helper.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index 869878f7f5..1c820885ab 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -2190,6 +2190,41 @@ void helper_vperm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) *r = result; } +#if defined(WORDS_BIGENDIAN) +#define PKBIG 1 +#else +#define PKBIG 0 +#endif +#define VPK(suffix, from, to, cvt, dosat) \ + void helper_vpk##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ + { \ + int i; \ + int sat = 0; \ + ppc_avr_t result; \ + ppc_avr_t *a0 = PKBIG ? a : b; \ + ppc_avr_t *a1 = PKBIG ? b : a; \ + VECTOR_FOR_INORDER_I (i, from) { \ + result.to[i] = cvt(a0->from[i], &sat); \ + result.to[i+ARRAY_SIZE(r->from)] = cvt(a1->from[i], &sat); \ + } \ + *r = result; \ + if (dosat && sat) { \ + env->vscr |= (1 << VSCR_SAT); \ + } \ + } +#define I(x, y) (x) +VPK(shss, s16, s8, cvtshsb, 1) +VPK(shus, s16, u8, cvtshub, 1) +VPK(swss, s32, s16, cvtswsh, 1) +VPK(swus, s32, u16, cvtswuh, 1) +VPK(uhus, u16, u8, cvtuhub, 1) +VPK(uwus, u32, u16, cvtuwuh, 1) +VPK(uhum, u16, u8, I, 0) +VPK(uwum, u32, u16, I, 0) +#undef I +#undef VPK +#undef PKBIG + #define VROTATE(suffix, element) \ void helper_vrl##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ { \ |