1 /*===------------- avx512vbmivlintrin.h - VBMI intrinsics ------------------===
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
8 *===-----------------------------------------------------------------------===
11 #error "Never use <avx512vbmivlintrin.h> directly; include <immintrin.h> instead."
14 #ifndef __VBMIVLINTRIN_H
15 #define __VBMIVLINTRIN_H
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS128 \
19 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512vbmi,avx512vl,no-evex512"), \
21 __min_vector_width__(128)))
22 #define __DEFAULT_FN_ATTRS256 \
23 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx512vbmi,avx512vl,no-evex512"), \
25 __min_vector_width__(256)))
27 static __inline__ __m128i __DEFAULT_FN_ATTRS128
28 _mm_permutex2var_epi8(__m128i __A
, __m128i __I
, __m128i __B
)
30 return (__m128i
)__builtin_ia32_vpermi2varqi128((__v16qi
)__A
,
35 static __inline__ __m128i __DEFAULT_FN_ATTRS128
36 _mm_mask_permutex2var_epi8(__m128i __A
, __mmask16 __U
, __m128i __I
,
39 return (__m128i
)__builtin_ia32_selectb_128(__U
,
40 (__v16qi
)_mm_permutex2var_epi8(__A
, __I
, __B
),
44 static __inline__ __m128i __DEFAULT_FN_ATTRS128
45 _mm_mask2_permutex2var_epi8(__m128i __A
, __m128i __I
, __mmask16 __U
,
48 return (__m128i
)__builtin_ia32_selectb_128(__U
,
49 (__v16qi
)_mm_permutex2var_epi8(__A
, __I
, __B
),
53 static __inline__ __m128i __DEFAULT_FN_ATTRS128
54 _mm_maskz_permutex2var_epi8(__mmask16 __U
, __m128i __A
, __m128i __I
,
57 return (__m128i
)__builtin_ia32_selectb_128(__U
,
58 (__v16qi
)_mm_permutex2var_epi8(__A
, __I
, __B
),
59 (__v16qi
)_mm_setzero_si128());
62 static __inline__ __m256i __DEFAULT_FN_ATTRS256
63 _mm256_permutex2var_epi8(__m256i __A
, __m256i __I
, __m256i __B
)
65 return (__m256i
)__builtin_ia32_vpermi2varqi256((__v32qi
)__A
, (__v32qi
)__I
,
69 static __inline__ __m256i __DEFAULT_FN_ATTRS256
70 _mm256_mask_permutex2var_epi8(__m256i __A
, __mmask32 __U
, __m256i __I
,
73 return (__m256i
)__builtin_ia32_selectb_256(__U
,
74 (__v32qi
)_mm256_permutex2var_epi8(__A
, __I
, __B
),
78 static __inline__ __m256i __DEFAULT_FN_ATTRS256
79 _mm256_mask2_permutex2var_epi8(__m256i __A
, __m256i __I
, __mmask32 __U
,
82 return (__m256i
)__builtin_ia32_selectb_256(__U
,
83 (__v32qi
)_mm256_permutex2var_epi8(__A
, __I
, __B
),
87 static __inline__ __m256i __DEFAULT_FN_ATTRS256
88 _mm256_maskz_permutex2var_epi8(__mmask32 __U
, __m256i __A
, __m256i __I
,
91 return (__m256i
)__builtin_ia32_selectb_256(__U
,
92 (__v32qi
)_mm256_permutex2var_epi8(__A
, __I
, __B
),
93 (__v32qi
)_mm256_setzero_si256());
96 static __inline__ __m128i __DEFAULT_FN_ATTRS128
97 _mm_permutexvar_epi8 (__m128i __A
, __m128i __B
)
99 return (__m128i
)__builtin_ia32_permvarqi128((__v16qi
)__B
, (__v16qi
)__A
);
102 static __inline__ __m128i __DEFAULT_FN_ATTRS128
103 _mm_maskz_permutexvar_epi8 (__mmask16 __M
, __m128i __A
, __m128i __B
)
105 return (__m128i
)__builtin_ia32_selectb_128((__mmask16
)__M
,
106 (__v16qi
)_mm_permutexvar_epi8(__A
, __B
),
107 (__v16qi
)_mm_setzero_si128());
110 static __inline__ __m128i __DEFAULT_FN_ATTRS128
111 _mm_mask_permutexvar_epi8 (__m128i __W
, __mmask16 __M
, __m128i __A
,
114 return (__m128i
)__builtin_ia32_selectb_128((__mmask16
)__M
,
115 (__v16qi
)_mm_permutexvar_epi8(__A
, __B
),
119 static __inline__ __m256i __DEFAULT_FN_ATTRS256
120 _mm256_permutexvar_epi8 (__m256i __A
, __m256i __B
)
122 return (__m256i
)__builtin_ia32_permvarqi256((__v32qi
) __B
, (__v32qi
) __A
);
125 static __inline__ __m256i __DEFAULT_FN_ATTRS256
126 _mm256_maskz_permutexvar_epi8 (__mmask32 __M
, __m256i __A
,
129 return (__m256i
)__builtin_ia32_selectb_256((__mmask32
)__M
,
130 (__v32qi
)_mm256_permutexvar_epi8(__A
, __B
),
131 (__v32qi
)_mm256_setzero_si256());
134 static __inline__ __m256i __DEFAULT_FN_ATTRS256
135 _mm256_mask_permutexvar_epi8 (__m256i __W
, __mmask32 __M
, __m256i __A
,
138 return (__m256i
)__builtin_ia32_selectb_256((__mmask32
)__M
,
139 (__v32qi
)_mm256_permutexvar_epi8(__A
, __B
),
143 static __inline__ __m128i __DEFAULT_FN_ATTRS128
144 _mm_multishift_epi64_epi8(__m128i __X
, __m128i __Y
)
146 return (__m128i
)__builtin_ia32_vpmultishiftqb128((__v16qi
)__X
, (__v16qi
)__Y
);
149 static __inline__ __m128i __DEFAULT_FN_ATTRS128
150 _mm_mask_multishift_epi64_epi8(__m128i __W
, __mmask16 __M
, __m128i __X
,
153 return (__m128i
)__builtin_ia32_selectb_128((__mmask16
)__M
,
154 (__v16qi
)_mm_multishift_epi64_epi8(__X
, __Y
),
158 static __inline__ __m128i __DEFAULT_FN_ATTRS128
159 _mm_maskz_multishift_epi64_epi8(__mmask16 __M
, __m128i __X
, __m128i __Y
)
161 return (__m128i
)__builtin_ia32_selectb_128((__mmask16
)__M
,
162 (__v16qi
)_mm_multishift_epi64_epi8(__X
, __Y
),
163 (__v16qi
)_mm_setzero_si128());
166 static __inline__ __m256i __DEFAULT_FN_ATTRS256
167 _mm256_multishift_epi64_epi8(__m256i __X
, __m256i __Y
)
169 return (__m256i
)__builtin_ia32_vpmultishiftqb256((__v32qi
)__X
, (__v32qi
)__Y
);
172 static __inline__ __m256i __DEFAULT_FN_ATTRS256
173 _mm256_mask_multishift_epi64_epi8(__m256i __W
, __mmask32 __M
, __m256i __X
,
176 return (__m256i
)__builtin_ia32_selectb_256((__mmask32
)__M
,
177 (__v32qi
)_mm256_multishift_epi64_epi8(__X
, __Y
),
181 static __inline__ __m256i __DEFAULT_FN_ATTRS256
182 _mm256_maskz_multishift_epi64_epi8(__mmask32 __M
, __m256i __X
, __m256i __Y
)
184 return (__m256i
)__builtin_ia32_selectb_256((__mmask32
)__M
,
185 (__v32qi
)_mm256_multishift_epi64_epi8(__X
, __Y
),
186 (__v32qi
)_mm256_setzero_si256());
190 #undef __DEFAULT_FN_ATTRS128
191 #undef __DEFAULT_FN_ATTRS256