aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-04 22:11:49 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-04 22:11:49 +0000
commitd1258698f5c295a2c34258ea6bcf406794ff6e95 (patch)
treeefd21810fe877208f3be81ab3b9ae7c64c05bc9e
parentb04ae9811a944c2c7356692c13dcf32505b87d84 (diff)
downloadqemu-d1258698f5c295a2c34258ea6bcf406794ff6e95.zip
qemu-d1258698f5c295a2c34258ea6bcf406794ff6e95.tar.gz
qemu-d1258698f5c295a2c34258ea6bcf406794ff6e95.tar.bz2
Add vsel and vperm 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@6180 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--target-ppc/helper.h2
-rw-r--r--target-ppc/op_helper.c26
-rw-r--r--target-ppc/translate.c1
3 files changed, 29 insertions, 0 deletions
diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index 0e93818..6c60426 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -167,6 +167,8 @@ DEF_HELPER_2(vupklsb, void, avr, avr)
DEF_HELPER_2(vupklsh, void, avr, avr)
DEF_HELPER_4(vmsumubm, void, avr, avr, avr, avr)
DEF_HELPER_4(vmsummbm, void, avr, avr, avr, avr)
+DEF_HELPER_4(vsel, void, avr, avr, avr, avr)
+DEF_HELPER_4(vperm, void, avr, avr, avr, avr)
DEF_HELPER_1(efscfsi, i32, i32)
DEF_HELPER_1(efscfui, i32, i32)
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
index 2133529..87ae2ca 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -2143,6 +2143,26 @@ VMUL(uh, u16, u32)
#undef VMUL_DO
#undef VMUL
+void helper_vperm (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
+{
+ ppc_avr_t result;
+ int i;
+ VECTOR_FOR_INORDER_I (i, u8) {
+ int s = c->u8[i] & 0x1f;
+#if defined(WORDS_BIGENDIAN)
+ int index = s & 0xf;
+#else
+ int index = 15 - (s & 0xf);
+#endif
+ if (s & 0x10) {
+ result.u8[i] = b->u8[index];
+ } else {
+ result.u8[i] = a->u8[index];
+ }
+ }
+ *r = result;
+}
+
#define VROTATE(suffix, element) \
void helper_vrl##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
{ \
@@ -2158,6 +2178,12 @@ VROTATE(h, u16)
VROTATE(w, u32)
#undef VROTATE
+void helper_vsel (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
+{
+ r->u64[0] = (a->u64[0] & ~c->u64[0]) | (b->u64[0] & c->u64[0]);
+ r->u64[1] = (a->u64[1] & ~c->u64[1]) | (b->u64[1] & c->u64[1]);
+}
+
#define VSL(suffix, element) \
void helper_vsl##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
{ \
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index e80cdf3..112d05d 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -6377,6 +6377,7 @@ GEN_HANDLER(vsldoi, 0x04, 0x16, 0xFF, 0x00000400, PPC_ALTIVEC)
}
GEN_VAFORM_PAIRED(vmsumubm, vmsummbm, 18)
+GEN_VAFORM_PAIRED(vsel, vperm, 21)
/*** SPE extension ***/
/* Register moves */