GCC maintainers:

The _MM_SHUFFLE and _MM_SHUFFLE2 macros are currently defined in the
i386 branch.  This patch adds the two macro definitions to the rs6000
config directory as requested.  

The patch has been tested on 

    powerpc64le-unknown-linux-gnu (Power 8 LE)

With no regressions.

The request includes backporting the macro definitions to GCC 7 and GCC
8.  The backport to GCC7 will require creating
the config/rs6000/emmintrin.h, config/rs6000/xmmintrin.h and
config/rs6000/x86intrin.h files with the standard header comments.

Please let me know if the patch is acceptable for mainline and for
backporting to GCC 7 and 8.  Thanks

                   Carl Love
--------------------------------------------------------------------

gcc/ChangeLog:

2018-09-11  Carl Love  <c...@us.ibm.com>

        * config/rs6000/emmintrin.h: Add _MM_SHUFFLE2.
        * config/rs6000/xmmintrin.h: Add _MM_SHUFFLE.
---
 gcc/config/rs6000/emmintrin.h | 5 ++++-
 gcc/config/rs6000/xmmintrin.h | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/emmintrin.h b/gcc/config/rs6000/emmintrin.h
index 412ece7..d4543fb 100644
--- a/gcc/config/rs6000/emmintrin.h
+++ b/gcc/config/rs6000/emmintrin.h
@@ -85,6 +85,9 @@ typedef double __m128d __attribute__ ((__vector_size__ (16), 
__may_alias__));
 typedef long long __m128i_u __attribute__ ((__vector_size__ (16), 
__may_alias__, __aligned__ (1)));
 typedef double __m128d_u __attribute__ ((__vector_size__ (16), __may_alias__, 
__aligned__ (1)));
 
+/* Define two value permute mask */
+#define _MM_SHUFFLE2(x,y) (((x) << 1) | (y))
+
 /* Create a vector with element 0 as F and the rest zero.  */
 extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_set_sd (double __F)
@@ -1163,8 +1166,8 @@ _mm_cvtss_sd (__m128d __A, __m128 __B)
   res [0] = ((__v4sf)__B) [0];
   return (__m128d) res;
 #endif
-}
 
+}
 extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))
 _mm_shuffle_pd(__m128d __A, __m128d __B, const int __mask)
 {
diff --git a/gcc/config/rs6000/xmmintrin.h b/gcc/config/rs6000/xmmintrin.h
index 43d03ea..11ecbd8 100644
--- a/gcc/config/rs6000/xmmintrin.h
+++ b/gcc/config/rs6000/xmmintrin.h
@@ -57,6 +57,9 @@
 #ifndef _XMMINTRIN_H_INCLUDED
 #define _XMMINTRIN_H_INCLUDED
 
+/* Define four value permute mask */
+#define _MM_SHUFFLE(w,x,y,z) (((w) << 6) | ((x) << 4) | ((y) << 2) | (z))
+
 #include <altivec.h>
 
 /* Avoid collisions between altivec.h and strict adherence to C++ and
-- 
2.7.4

Reply via email to