1 /*===------------- avx512bitalgintrin.h - BITALG intrinsics ------------------===
2  *
3  *
4  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5  * See https://llvm.org/LICENSE.txt for license information.
6  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7  *
8  *===-----------------------------------------------------------------------===
9  */
10 #ifndef __IMMINTRIN_H
11 #error "Never use <avx512bitalgintrin.h> directly; include <immintrin.h> instead."
12 #endif
13 
14 #ifndef __AVX512BITALGINTRIN_H
15 #define __AVX512BITALGINTRIN_H
16 
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512bitalg"), __min_vector_width__(512)))
19 
20 static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_popcnt_epi16(__m512i __A)21 _mm512_popcnt_epi16(__m512i __A)
22 {
23   return (__m512i) __builtin_ia32_vpopcntw_512((__v32hi) __A);
24 }
25 
26 static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_popcnt_epi16(__m512i __A,__mmask32 __U,__m512i __B)27 _mm512_mask_popcnt_epi16(__m512i __A, __mmask32 __U, __m512i __B)
28 {
29   return (__m512i) __builtin_ia32_selectw_512((__mmask32) __U,
30               (__v32hi) _mm512_popcnt_epi16(__B),
31               (__v32hi) __A);
32 }
33 
34 static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_popcnt_epi16(__mmask32 __U,__m512i __B)35 _mm512_maskz_popcnt_epi16(__mmask32 __U, __m512i __B)
36 {
37   return _mm512_mask_popcnt_epi16((__m512i) _mm512_setzero_si512(),
38               __U,
39               __B);
40 }
41 
42 static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_popcnt_epi8(__m512i __A)43 _mm512_popcnt_epi8(__m512i __A)
44 {
45   return (__m512i) __builtin_ia32_vpopcntb_512((__v64qi) __A);
46 }
47 
48 static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mask_popcnt_epi8(__m512i __A,__mmask64 __U,__m512i __B)49 _mm512_mask_popcnt_epi8(__m512i __A, __mmask64 __U, __m512i __B)
50 {
51   return (__m512i) __builtin_ia32_selectb_512((__mmask64) __U,
52               (__v64qi) _mm512_popcnt_epi8(__B),
53               (__v64qi) __A);
54 }
55 
56 static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_maskz_popcnt_epi8(__mmask64 __U,__m512i __B)57 _mm512_maskz_popcnt_epi8(__mmask64 __U, __m512i __B)
58 {
59   return _mm512_mask_popcnt_epi8((__m512i) _mm512_setzero_si512(),
60               __U,
61               __B);
62 }
63 
64 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
_mm512_mask_bitshuffle_epi64_mask(__mmask64 __U,__m512i __A,__m512i __B)65 _mm512_mask_bitshuffle_epi64_mask(__mmask64 __U, __m512i __A, __m512i __B)
66 {
67   return (__mmask64) __builtin_ia32_vpshufbitqmb512_mask((__v64qi) __A,
68               (__v64qi) __B,
69               __U);
70 }
71 
72 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
_mm512_bitshuffle_epi64_mask(__m512i __A,__m512i __B)73 _mm512_bitshuffle_epi64_mask(__m512i __A, __m512i __B)
74 {
75   return _mm512_mask_bitshuffle_epi64_mask((__mmask64) -1,
76               __A,
77               __B);
78 }
79 
80 
81 #undef __DEFAULT_FN_ATTRS
82 
83 #endif
84