public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2705] rs6000: Add support for _mm_minpos_epu16
@ 2021-08-03 18:59 Paul Clarke
0 siblings, 0 replies; only message in thread
From: Paul Clarke @ 2021-08-03 18:59 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:eaa93a0f3d9f67c8cbc1dc849ea6feba432ff412
commit r12-2705-geaa93a0f3d9f67c8cbc1dc849ea6feba432ff412
Author: Paul A. Clarke <pc@us.ibm.com>
Date: Mon Feb 22 19:13:28 2021 -0600
rs6000: Add support for _mm_minpos_epu16
Add a naive implementation of the subject x86 intrinsic to
ease porting.
2021-08-03 Paul A. Clarke <pc@us.ibm.com>
gcc
* config/rs6000/smmintrin.h (_mm_minpos_epu16): New.
Diff:
---
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 0145b9229a6..3767a67eada 100644
--- a/gcc/config/rs6000/smmintrin.h
+++ b/gcc/config/rs6000/smmintrin.h
@@ -296,4 +296,31 @@ _mm_floor_ss (__m128 __A, __m128 __B)
return __r;
}
+/* 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] only message in thread
only message in thread, other threads:[~2021-08-03 18:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 18:59 [gcc r12-2705] rs6000: Add support for _mm_minpos_epu16 Paul 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).