1 /*===------------- avx512bwintrin.h - AVX512BW intrinsics ------------------===
2  *
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  *
22  *===-----------------------------------------------------------------------===
23  */
24 
25 #ifndef __AVX512BWINTRIN_H
26 #define __AVX512BWINTRIN_H
27 
28 typedef unsigned int __mmask32;
29 typedef unsigned long long __mmask64;
30 typedef char __v64qi __attribute__ ((vector_size (64)));
31 typedef short __v32hi __attribute__ ((__vector_size__ (64)));
32 
33 
34 /* Integer compare */
35 
36 static __inline__ __mmask64 __attribute__((__always_inline__, __nodebug__))
_mm512_cmpeq_epi8_mask(__m512i __a,__m512i __b)37 _mm512_cmpeq_epi8_mask(__m512i __a, __m512i __b) {
38   return (__mmask64)__builtin_ia32_pcmpeqb512_mask((__v64qi)__a, (__v64qi)__b,
39                                                    (__mmask64)-1);
40 }
41 
42 static __inline__ __mmask64 __attribute__((__always_inline__, __nodebug__))
_mm512_mask_cmpeq_epi8_mask(__mmask64 __u,__m512i __a,__m512i __b)43 _mm512_mask_cmpeq_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
44   return (__mmask64)__builtin_ia32_pcmpeqb512_mask((__v64qi)__a, (__v64qi)__b,
45                                                    __u);
46 }
47 
48 static __inline__ __mmask32 __attribute__((__always_inline__, __nodebug__))
_mm512_cmpeq_epi16_mask(__m512i __a,__m512i __b)49 _mm512_cmpeq_epi16_mask(__m512i __a, __m512i __b) {
50   return (__mmask32)__builtin_ia32_pcmpeqw512_mask((__v32hi)__a, (__v32hi)__b,
51                                                    (__mmask32)-1);
52 }
53 
54 static __inline__ __mmask32 __attribute__((__always_inline__, __nodebug__))
_mm512_mask_cmpeq_epi16_mask(__mmask32 __u,__m512i __a,__m512i __b)55 _mm512_mask_cmpeq_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
56   return (__mmask32)__builtin_ia32_pcmpeqw512_mask((__v32hi)__a, (__v32hi)__b,
57                                                    __u);
58 }
59 
60 #endif
61