public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH v3 1/2] rs6000: Add support for _mm_minpos_epu16
@ 2021-07-28  2:29 David Edelsohn
  2021-07-29 22:03 ` Paul A. Clarke
  0 siblings, 1 reply; 6+ messages in thread
From: David Edelsohn @ 2021-07-28  2:29 UTC (permalink / raw)
  To: Paul A. Clarke; +Cc: GCC Patches, Bill Schmidt

> Add a naive implementation of the subject x86 intrinsic to
> ease porting.
>
> 2021-07-15  Paul A. Clarke  <pc@us.ibm.com>
>
> gcc
>         * config/rs6000/smmintrin.h (_mm_minpos_epu16): New.

Segher already approved this with the changes requested.

Thanks, David

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] rs6000: Add support for _mm_minpos_epu16
  2021-07-28  2:29 [PATCH v3 1/2] rs6000: Add support for _mm_minpos_epu16 David Edelsohn
@ 2021-07-29 22:03 ` Paul A. Clarke
  0 siblings, 0 replies; 6+ messages in thread
From: Paul A. Clarke @ 2021-07-29 22:03 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Bill Schmidt, GCC Patches, segher

On Tue, Jul 27, 2021 at 10:29:13PM -0400, David Edelsohn via Gcc-patches wrote:
> > Add a naive implementation of the subject x86 intrinsic to
> > ease porting.
> >
> > 2021-07-15  Paul A. Clarke  <pc@us.ibm.com>
> >
> > gcc
> >         * config/rs6000/smmintrin.h (_mm_minpos_epu16): New.
> 
> Segher already approved this with the changes requested.

Segher said:
| This does not compute the index correctly for big endian (it needs to
| walk from right to left for that).  The construction of the return value
| looks wrong as well.
| 
| Okay for trunk with that fixed.  Thanks!

I responded:
| I'm not seeing the issue here. The values are numbered by element order,
| and the results are in the "first" (minimum value) and "second" (index of
| first encountered minimum value in element order) elements of the result.

I did not get a response, nor did I change any code. It feels like a stretch
to equate the above exchange to "approved", so I'll continue to wait for
explicit approval.

PC

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] rs6000: Add support for _mm_minpos_epu16
  2021-08-02 22:29   ` Segher Boessenkool
@ 2021-08-03 13:01     ` Paul A. Clarke
  0 siblings, 0 replies; 6+ messages in thread
From: Paul A. Clarke @ 2021-08-03 13:01 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: wschmidt, gcc-patches

On Mon, Aug 02, 2021 at 05:29:08PM -0500, Segher Boessenkool wrote:
> On Thu, Jul 15, 2021 at 06:29:17PM -0500, Paul A. Clarke wrote:
> > Add a naive implementation of the subject x86 intrinsic to
> > ease porting.
> 
> > --- a/gcc/config/rs6000/smmintrin.h
> > +++ b/gcc/config/rs6000/smmintrin.h
> > @@ -172,4 +172,31 @@ _mm_test_mix_ones_zeros (__m128i __A, __m128i __mask)
> >    return any_ones * any_zeros;
> >  }
> >  
> > +/* Return horizontal packed word minimum and its index in bits [15:0]
> > +   and bits [18:16] respectively.  */
> > +__inline __m128i
> > +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
> > +_mm_minpos_epu16 (__m128i __A)
> > +{
> > +  union __u
> > +    {
> > +      __m128i __m;
> > +      __v8hu __uh;
> > +    };
> > +  union __u __u = { .__m = __A }, __r = { .__m = {0} };
> > +  unsigned short __ridx = 0;
> > +  unsigned short __rmin = __u.__uh[__ridx];
> > +  for (unsigned long __i = 1; __i < 8; __i++)
> > +    {
> > +      if (__u.__uh[__i] < __rmin)
> > +	{
> > +	  __rmin = __u.__uh[__i];
> > +	  __ridx = __i;
> > +	}
> > +    }
> > +  __r.__uh[0] = __rmin;
> > +  __r.__uh[1] = __ridx;
> > +  return __r.__m;
> > +}
> 
> As before: does this work correctly on BE?  Was it tested there?

Per the "cover letter":
| Tested on BE, LE (32 and 64bit).

> Okay for trunk if so.  Thanks!

Thanks! I'll push this shortly.

PC

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] rs6000: Add support for _mm_minpos_epu16
  2021-07-15 23:29 ` [PATCH v3 1/2] " Paul A. Clarke
  2021-07-16 20:06   ` Bill Schmidt
@ 2021-08-02 22:29   ` Segher Boessenkool
  2021-08-03 13:01     ` Paul A. Clarke
  1 sibling, 1 reply; 6+ messages in thread
From: Segher Boessenkool @ 2021-08-02 22:29 UTC (permalink / raw)
  To: Paul A. Clarke; +Cc: gcc-patches, wschmidt

Hi!

On Thu, Jul 15, 2021 at 06:29:17PM -0500, Paul A. Clarke wrote:
> Add a naive implementation of the subject x86 intrinsic to
> ease porting.

> --- a/gcc/config/rs6000/smmintrin.h
> +++ b/gcc/config/rs6000/smmintrin.h
> @@ -172,4 +172,31 @@ _mm_test_mix_ones_zeros (__m128i __A, __m128i __mask)
>    return any_ones * any_zeros;
>  }
>  
> +/* Return horizontal packed word minimum and its index in bits [15:0]
> +   and bits [18:16] respectively.  */
> +__inline __m128i
> +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
> +_mm_minpos_epu16 (__m128i __A)
> +{
> +  union __u
> +    {
> +      __m128i __m;
> +      __v8hu __uh;
> +    };
> +  union __u __u = { .__m = __A }, __r = { .__m = {0} };
> +  unsigned short __ridx = 0;
> +  unsigned short __rmin = __u.__uh[__ridx];
> +  for (unsigned long __i = 1; __i < 8; __i++)
> +    {
> +      if (__u.__uh[__i] < __rmin)
> +	{
> +	  __rmin = __u.__uh[__i];
> +	  __ridx = __i;
> +	}
> +    }
> +  __r.__uh[0] = __rmin;
> +  __r.__uh[1] = __ridx;
> +  return __r.__m;
> +}

As before: does this work correctly on BE?  Was it tested there?

Okay for trunk if so.  Thanks!


Segher

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] rs6000: Add support for _mm_minpos_epu16
  2021-07-15 23:29 ` [PATCH v3 1/2] " Paul A. Clarke
@ 2021-07-16 20:06   ` Bill Schmidt
  2021-08-02 22:29   ` Segher Boessenkool
  1 sibling, 0 replies; 6+ messages in thread
From: Bill Schmidt @ 2021-07-16 20:06 UTC (permalink / raw)
  To: Paul A. Clarke, gcc-patches; +Cc: segher

Hi Paul,

LGTM.  Recommend maintainers approve.

Thanks for the cleanups,
Bill

On 7/15/21 6:29 PM, Paul A. Clarke wrote:
> Add a naive implementation of the subject x86 intrinsic to
> ease porting.
>
> 2021-07-15  Paul A. Clarke  <pc@us.ibm.com>
>
> gcc
>          * config/rs6000/smmintrin.h (_mm_minpos_epu16): New.
> ---
> v3: Minor formatting changes per review from Bill.
> v2: Minor formatting changes per review from Segher.
>
>   gcc/config/rs6000/smmintrin.h | 27 +++++++++++++++++++++++++++
>   1 file changed, 27 insertions(+)
>
> diff --git a/gcc/config/rs6000/smmintrin.h b/gcc/config/rs6000/smmintrin.h
> index 16fd34d836ff..6a010fdbb96f 100644
> --- a/gcc/config/rs6000/smmintrin.h
> +++ b/gcc/config/rs6000/smmintrin.h
> @@ -172,4 +172,31 @@ _mm_test_mix_ones_zeros (__m128i __A, __m128i __mask)
>     return any_ones * any_zeros;
>   }
>   
> +/* Return horizontal packed word minimum and its index in bits [15:0]
> +   and bits [18:16] respectively.  */
> +__inline __m128i
> +__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
> +_mm_minpos_epu16 (__m128i __A)
> +{
> +  union __u
> +    {
> +      __m128i __m;
> +      __v8hu __uh;
> +    };
> +  union __u __u = { .__m = __A }, __r = { .__m = {0} };
> +  unsigned short __ridx = 0;
> +  unsigned short __rmin = __u.__uh[__ridx];
> +  for (unsigned long __i = 1; __i < 8; __i++)
> +    {
> +      if (__u.__uh[__i] < __rmin)
> +	{
> +	  __rmin = __u.__uh[__i];
> +	  __ridx = __i;
> +	}
> +    }
> +  __r.__uh[0] = __rmin;
> +  __r.__uh[1] = __ridx;
> +  return __r.__m;
> +}
> +
>   #endif

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 1/2] rs6000: Add support for _mm_minpos_epu16
  2021-07-15 23:29 [PATCH v3 0/2] " Paul A. Clarke
@ 2021-07-15 23:29 ` Paul A. Clarke
  2021-07-16 20:06   ` Bill Schmidt
  2021-08-02 22:29   ` Segher Boessenkool
  0 siblings, 2 replies; 6+ messages in thread
From: Paul A. Clarke @ 2021-07-15 23:29 UTC (permalink / raw)
  To: gcc-patches; +Cc: segher, wschmidt

Add a naive implementation of the subject x86 intrinsic to
ease porting.

2021-07-15  Paul A. Clarke  <pc@us.ibm.com>

gcc
        * config/rs6000/smmintrin.h (_mm_minpos_epu16): New.
---
v3: Minor formatting changes per review from Bill.
v2: Minor formatting changes per review from Segher.

 gcc/config/rs6000/smmintrin.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gcc/config/rs6000/smmintrin.h b/gcc/config/rs6000/smmintrin.h
index 16fd34d836ff..6a010fdbb96f 100644
--- a/gcc/config/rs6000/smmintrin.h
+++ b/gcc/config/rs6000/smmintrin.h
@@ -172,4 +172,31 @@ _mm_test_mix_ones_zeros (__m128i __A, __m128i __mask)
   return any_ones * any_zeros;
 }
 
+/* Return horizontal packed word minimum and its index in bits [15:0]
+   and bits [18:16] respectively.  */
+__inline __m128i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_minpos_epu16 (__m128i __A)
+{
+  union __u
+    {
+      __m128i __m;
+      __v8hu __uh;
+    };
+  union __u __u = { .__m = __A }, __r = { .__m = {0} };
+  unsigned short __ridx = 0;
+  unsigned short __rmin = __u.__uh[__ridx];
+  for (unsigned long __i = 1; __i < 8; __i++)
+    {
+      if (__u.__uh[__i] < __rmin)
+	{
+	  __rmin = __u.__uh[__i];
+	  __ridx = __i;
+	}
+    }
+  __r.__uh[0] = __rmin;
+  __r.__uh[1] = __ridx;
+  return __r.__m;
+}
+
 #endif
-- 
2.27.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-03 13:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28  2:29 [PATCH v3 1/2] rs6000: Add support for _mm_minpos_epu16 David Edelsohn
2021-07-29 22:03 ` Paul A. Clarke
  -- strict thread matches above, loose matches on Subject: below --
2021-07-15 23:29 [PATCH v3 0/2] " Paul A. Clarke
2021-07-15 23:29 ` [PATCH v3 1/2] " Paul A. Clarke
2021-07-16 20:06   ` Bill Schmidt
2021-08-02 22:29   ` Segher Boessenkool
2021-08-03 13:01     ` Paul A. Clarke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).