diff mbox series

[rs6000] Add _MM_SHUFFLE definitions for rs6000

Message ID 1536865681.5624.2.camel@us.ibm.com
State New
Headers show
Series [rs6000] Add _MM_SHUFFLE definitions for rs6000 | expand

Commit Message

Carl Love Sept. 13, 2018, 7:08 p.m. UTC
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  <cel@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(-)

-- 
2.7.4

Comments

Bill Schmidt Sept. 13, 2018, 7:11 p.m. UTC | #1
On 9/13/18 2:08 PM, Carl Love wrote:
> 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

Hi Carl,

No, it should not be backported to GCC 7.  To clarify what I was saying:
these header files exist in branches/ibm/gcc-7-branch but do NOT exist
in branches/gcc-7-branch.  That IBM-private branch (used for AT 11.0)
should have these macros added, but the main gcc-7-branch should not.
We don't want any new files added anywhere as part of this work.

Thanks,
Bill

>
>                    Carl Love
> --------------------------------------------------------------------
>
> gcc/ChangeLog:
>
> 2018-09-11  Carl Love  <cel@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
>
Carl Love Sept. 13, 2018, 7:24 p.m. UTC | #2
Bill:

Ah, I read your note as Power 8, Power 7 and the IBM AT 11.  Thanks for
the clarification.

                Carl Love

On Thu, 2018-09-13 at 14:11 -0500, Bill Schmidt wrote:
> On 9/13/18 2:08 PM, Carl Love wrote:
> > 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
> 
> Hi Carl,
> 
> No, it should not be backported to GCC 7.  To clarify what I was
> saying:
> these header files exist in branches/ibm/gcc-7-branch but do NOT
> exist
> in branches/gcc-7-branch.  That IBM-private branch (used for AT 11.0)
> should have these macros added, but the main gcc-7-branch should not.
> We don't want any new files added anywhere as part of this work.
> 
> Thanks,
> Bill
> 
> > 
> >                    Carl Love
> > -----------------------------------------------------------------
> > ---
> > 
> > gcc/ChangeLog:
> > 
> > 2018-09-11  Carl Love  <cel@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
> > 
> 
>
Segher Boessenkool Sept. 13, 2018, 10:51 p.m. UTC | #3
Hi Carl,

On Thu, Sep 13, 2018 at 12:08:01PM -0700, Carl Love wrote:
> 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.  


> @@ -1163,8 +1166,8 @@ _mm_cvtss_sd (__m128d __A, __m128 __B)
>    res [0] = ((__v4sf)__B) [0];
>    return (__m128d) res;
>  #endif
> -}
>  
> +}

Please don't do this (accidental) change.

Other than that it is fine.  Thanks!  Okay for trunk and 8.


Segher
diff mbox series

Patch

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