public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4334] rs6000: Simplify some SSE4.1 "test" intrinsics
@ 2021-10-12  1:32 Paul Clarke
  0 siblings, 0 replies; only message in thread
From: Paul Clarke @ 2021-10-12  1:32 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1ec08caf7e009053d21b331bd98679fec4ff2900

commit r12-4334-g1ec08caf7e009053d21b331bd98679fec4ff2900
Author: Paul A. Clarke <pc@us.ibm.com>
Date:   Wed Jul 21 09:35:52 2021 -0700

    rs6000: Simplify some SSE4.1 "test" intrinsics
    
    Copy some simple redirections from i386 <smmintrin.h>, for:
    - _mm_test_all_zeros
    - _mm_test_all_ones
    - _mm_test_mix_ones_zeros
    
    2021-10-11  Paul A. Clarke  <pc@us.ibm.com>
    
    gcc
            * config/rs6000/smmintrin.h (_mm_test_all_zeros,
            _mm_test_all_ones, _mm_test_mix_ones_zeros): Rewrite as macro.

Diff:
---
 gcc/config/rs6000/smmintrin.h | 30 ++++--------------------------
 1 file changed, 4 insertions(+), 26 deletions(-)

diff --git a/gcc/config/rs6000/smmintrin.h b/gcc/config/rs6000/smmintrin.h
index af782079cbc..f935ab060ab 100644
--- a/gcc/config/rs6000/smmintrin.h
+++ b/gcc/config/rs6000/smmintrin.h
@@ -203,34 +203,12 @@ _mm_testnzc_si128 (__m128i __A, __m128i __B)
   return _mm_testz_si128 (__A, __B) == 0 && _mm_testc_si128 (__A, __B) == 0;
 }
 
-__inline int
-__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_test_all_zeros (__m128i __A, __m128i __mask)
-{
-  const __v16qu __zero = {0};
-  return vec_all_eq (vec_and ((__v16qu) __A, (__v16qu) __mask), __zero);
-}
+#define _mm_test_all_zeros(M, V) _mm_testz_si128 ((M), (V))
 
-__inline int
-__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_test_all_ones (__m128i __A)
-{
-  const __v16qu __ones = vec_splats ((unsigned char) 0xff);
-  return vec_all_eq ((__v16qu) __A, __ones);
-}
+#define _mm_test_all_ones(V) \
+  _mm_testc_si128 ((V), _mm_cmpeq_epi32 ((V), (V)))
 
-__inline int
-__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_test_mix_ones_zeros (__m128i __A, __m128i __mask)
-{
-  const __v16qu __zero = {0};
-  const __v16qu __Amasked = vec_and ((__v16qu) __A, (__v16qu) __mask);
-  const int any_ones = vec_any_ne (__Amasked, __zero);
-  const __v16qu __notA = vec_nor ((__v16qu) __A, (__v16qu) __A);
-  const __v16qu __notAmasked = vec_and ((__v16qu) __notA, (__v16qu) __mask);
-  const int any_zeros = vec_any_ne (__notAmasked, __zero);
-  return any_ones * any_zeros;
-}
+#define _mm_test_mix_ones_zeros(M, V) _mm_testnzc_si128 ((M), (V))
 
 __inline __m128d
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-12  1:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  1:32 [gcc r12-4334] rs6000: Simplify some SSE4.1 "test" intrinsics 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).