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.
This commit is contained in:
Paul A. Clarke 2021-07-21 09:35:52 -07:00
parent 2be6f6d498
commit 1ec08caf7e

View File

@ -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__))