[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / lib / Headers / avx512bwintrin.h
blobaaeb9364801c6c433a7191a9ca836486d80fcdb0
1 /*===------------- avx512bwintrin.h - AVX512BW 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 *===-----------------------------------------------------------------------===
9 */
10 #ifndef __IMMINTRIN_H
11 #error "Never use <avx512bwintrin.h> directly; include <immintrin.h> instead."
12 #endif
14 #ifndef __AVX512BWINTRIN_H
15 #define __AVX512BWINTRIN_H
17 typedef unsigned int __mmask32;
18 typedef unsigned long long __mmask64;
20 /* Define the default attributes for the functions in this file. */
21 #define __DEFAULT_FN_ATTRS512 __attribute__((__always_inline__, __nodebug__, __target__("avx512bw"), __min_vector_width__(512)))
22 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512bw")))
24 static __inline __mmask32 __DEFAULT_FN_ATTRS
25 _knot_mask32(__mmask32 __M)
27 return __builtin_ia32_knotsi(__M);
30 static __inline __mmask64 __DEFAULT_FN_ATTRS
31 _knot_mask64(__mmask64 __M)
33 return __builtin_ia32_knotdi(__M);
36 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
37 _kand_mask32(__mmask32 __A, __mmask32 __B)
39 return (__mmask32)__builtin_ia32_kandsi((__mmask32)__A, (__mmask32)__B);
42 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
43 _kand_mask64(__mmask64 __A, __mmask64 __B)
45 return (__mmask64)__builtin_ia32_kanddi((__mmask64)__A, (__mmask64)__B);
48 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
49 _kandn_mask32(__mmask32 __A, __mmask32 __B)
51 return (__mmask32)__builtin_ia32_kandnsi((__mmask32)__A, (__mmask32)__B);
54 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
55 _kandn_mask64(__mmask64 __A, __mmask64 __B)
57 return (__mmask64)__builtin_ia32_kandndi((__mmask64)__A, (__mmask64)__B);
60 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
61 _kor_mask32(__mmask32 __A, __mmask32 __B)
63 return (__mmask32)__builtin_ia32_korsi((__mmask32)__A, (__mmask32)__B);
66 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
67 _kor_mask64(__mmask64 __A, __mmask64 __B)
69 return (__mmask64)__builtin_ia32_kordi((__mmask64)__A, (__mmask64)__B);
72 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
73 _kxnor_mask32(__mmask32 __A, __mmask32 __B)
75 return (__mmask32)__builtin_ia32_kxnorsi((__mmask32)__A, (__mmask32)__B);
78 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
79 _kxnor_mask64(__mmask64 __A, __mmask64 __B)
81 return (__mmask64)__builtin_ia32_kxnordi((__mmask64)__A, (__mmask64)__B);
84 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
85 _kxor_mask32(__mmask32 __A, __mmask32 __B)
87 return (__mmask32)__builtin_ia32_kxorsi((__mmask32)__A, (__mmask32)__B);
90 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
91 _kxor_mask64(__mmask64 __A, __mmask64 __B)
93 return (__mmask64)__builtin_ia32_kxordi((__mmask64)__A, (__mmask64)__B);
96 static __inline__ unsigned char __DEFAULT_FN_ATTRS
97 _kortestc_mask32_u8(__mmask32 __A, __mmask32 __B)
99 return (unsigned char)__builtin_ia32_kortestcsi(__A, __B);
102 static __inline__ unsigned char __DEFAULT_FN_ATTRS
103 _kortestz_mask32_u8(__mmask32 __A, __mmask32 __B)
105 return (unsigned char)__builtin_ia32_kortestzsi(__A, __B);
108 static __inline__ unsigned char __DEFAULT_FN_ATTRS
109 _kortest_mask32_u8(__mmask32 __A, __mmask32 __B, unsigned char *__C) {
110 *__C = (unsigned char)__builtin_ia32_kortestcsi(__A, __B);
111 return (unsigned char)__builtin_ia32_kortestzsi(__A, __B);
114 static __inline__ unsigned char __DEFAULT_FN_ATTRS
115 _kortestc_mask64_u8(__mmask64 __A, __mmask64 __B)
117 return (unsigned char)__builtin_ia32_kortestcdi(__A, __B);
120 static __inline__ unsigned char __DEFAULT_FN_ATTRS
121 _kortestz_mask64_u8(__mmask64 __A, __mmask64 __B)
123 return (unsigned char)__builtin_ia32_kortestzdi(__A, __B);
126 static __inline__ unsigned char __DEFAULT_FN_ATTRS
127 _kortest_mask64_u8(__mmask64 __A, __mmask64 __B, unsigned char *__C) {
128 *__C = (unsigned char)__builtin_ia32_kortestcdi(__A, __B);
129 return (unsigned char)__builtin_ia32_kortestzdi(__A, __B);
132 static __inline__ unsigned char __DEFAULT_FN_ATTRS
133 _ktestc_mask32_u8(__mmask32 __A, __mmask32 __B)
135 return (unsigned char)__builtin_ia32_ktestcsi(__A, __B);
138 static __inline__ unsigned char __DEFAULT_FN_ATTRS
139 _ktestz_mask32_u8(__mmask32 __A, __mmask32 __B)
141 return (unsigned char)__builtin_ia32_ktestzsi(__A, __B);
144 static __inline__ unsigned char __DEFAULT_FN_ATTRS
145 _ktest_mask32_u8(__mmask32 __A, __mmask32 __B, unsigned char *__C) {
146 *__C = (unsigned char)__builtin_ia32_ktestcsi(__A, __B);
147 return (unsigned char)__builtin_ia32_ktestzsi(__A, __B);
150 static __inline__ unsigned char __DEFAULT_FN_ATTRS
151 _ktestc_mask64_u8(__mmask64 __A, __mmask64 __B)
153 return (unsigned char)__builtin_ia32_ktestcdi(__A, __B);
156 static __inline__ unsigned char __DEFAULT_FN_ATTRS
157 _ktestz_mask64_u8(__mmask64 __A, __mmask64 __B)
159 return (unsigned char)__builtin_ia32_ktestzdi(__A, __B);
162 static __inline__ unsigned char __DEFAULT_FN_ATTRS
163 _ktest_mask64_u8(__mmask64 __A, __mmask64 __B, unsigned char *__C) {
164 *__C = (unsigned char)__builtin_ia32_ktestcdi(__A, __B);
165 return (unsigned char)__builtin_ia32_ktestzdi(__A, __B);
168 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
169 _kadd_mask32(__mmask32 __A, __mmask32 __B)
171 return (__mmask32)__builtin_ia32_kaddsi((__mmask32)__A, (__mmask32)__B);
174 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
175 _kadd_mask64(__mmask64 __A, __mmask64 __B)
177 return (__mmask64)__builtin_ia32_kadddi((__mmask64)__A, (__mmask64)__B);
180 #define _kshiftli_mask32(A, I) \
181 ((__mmask32)__builtin_ia32_kshiftlisi((__mmask32)(A), (unsigned int)(I)))
183 #define _kshiftri_mask32(A, I) \
184 ((__mmask32)__builtin_ia32_kshiftrisi((__mmask32)(A), (unsigned int)(I)))
186 #define _kshiftli_mask64(A, I) \
187 ((__mmask64)__builtin_ia32_kshiftlidi((__mmask64)(A), (unsigned int)(I)))
189 #define _kshiftri_mask64(A, I) \
190 ((__mmask64)__builtin_ia32_kshiftridi((__mmask64)(A), (unsigned int)(I)))
192 static __inline__ unsigned int __DEFAULT_FN_ATTRS
193 _cvtmask32_u32(__mmask32 __A) {
194 return (unsigned int)__builtin_ia32_kmovd((__mmask32)__A);
197 static __inline__ unsigned long long __DEFAULT_FN_ATTRS
198 _cvtmask64_u64(__mmask64 __A) {
199 return (unsigned long long)__builtin_ia32_kmovq((__mmask64)__A);
202 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
203 _cvtu32_mask32(unsigned int __A) {
204 return (__mmask32)__builtin_ia32_kmovd((__mmask32)__A);
207 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
208 _cvtu64_mask64(unsigned long long __A) {
209 return (__mmask64)__builtin_ia32_kmovq((__mmask64)__A);
212 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
213 _load_mask32(__mmask32 *__A) {
214 return (__mmask32)__builtin_ia32_kmovd(*(__mmask32 *)__A);
217 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
218 _load_mask64(__mmask64 *__A) {
219 return (__mmask64)__builtin_ia32_kmovq(*(__mmask64 *)__A);
222 static __inline__ void __DEFAULT_FN_ATTRS
223 _store_mask32(__mmask32 *__A, __mmask32 __B) {
224 *(__mmask32 *)__A = __builtin_ia32_kmovd((__mmask32)__B);
227 static __inline__ void __DEFAULT_FN_ATTRS
228 _store_mask64(__mmask64 *__A, __mmask64 __B) {
229 *(__mmask64 *)__A = __builtin_ia32_kmovq((__mmask64)__B);
232 /* Integer compare */
234 #define _mm512_cmp_epi8_mask(a, b, p) \
235 ((__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)(__m512i)(a), \
236 (__v64qi)(__m512i)(b), (int)(p), \
237 (__mmask64)-1))
239 #define _mm512_mask_cmp_epi8_mask(m, a, b, p) \
240 ((__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)(__m512i)(a), \
241 (__v64qi)(__m512i)(b), (int)(p), \
242 (__mmask64)(m)))
244 #define _mm512_cmp_epu8_mask(a, b, p) \
245 ((__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)(__m512i)(a), \
246 (__v64qi)(__m512i)(b), (int)(p), \
247 (__mmask64)-1))
249 #define _mm512_mask_cmp_epu8_mask(m, a, b, p) \
250 ((__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)(__m512i)(a), \
251 (__v64qi)(__m512i)(b), (int)(p), \
252 (__mmask64)(m)))
254 #define _mm512_cmp_epi16_mask(a, b, p) \
255 ((__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)(__m512i)(a), \
256 (__v32hi)(__m512i)(b), (int)(p), \
257 (__mmask32)-1))
259 #define _mm512_mask_cmp_epi16_mask(m, a, b, p) \
260 ((__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)(__m512i)(a), \
261 (__v32hi)(__m512i)(b), (int)(p), \
262 (__mmask32)(m)))
264 #define _mm512_cmp_epu16_mask(a, b, p) \
265 ((__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)(__m512i)(a), \
266 (__v32hi)(__m512i)(b), (int)(p), \
267 (__mmask32)-1))
269 #define _mm512_mask_cmp_epu16_mask(m, a, b, p) \
270 ((__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)(__m512i)(a), \
271 (__v32hi)(__m512i)(b), (int)(p), \
272 (__mmask32)(m)))
274 #define _mm512_cmpeq_epi8_mask(A, B) \
275 _mm512_cmp_epi8_mask((A), (B), _MM_CMPINT_EQ)
276 #define _mm512_mask_cmpeq_epi8_mask(k, A, B) \
277 _mm512_mask_cmp_epi8_mask((k), (A), (B), _MM_CMPINT_EQ)
278 #define _mm512_cmpge_epi8_mask(A, B) \
279 _mm512_cmp_epi8_mask((A), (B), _MM_CMPINT_GE)
280 #define _mm512_mask_cmpge_epi8_mask(k, A, B) \
281 _mm512_mask_cmp_epi8_mask((k), (A), (B), _MM_CMPINT_GE)
282 #define _mm512_cmpgt_epi8_mask(A, B) \
283 _mm512_cmp_epi8_mask((A), (B), _MM_CMPINT_GT)
284 #define _mm512_mask_cmpgt_epi8_mask(k, A, B) \
285 _mm512_mask_cmp_epi8_mask((k), (A), (B), _MM_CMPINT_GT)
286 #define _mm512_cmple_epi8_mask(A, B) \
287 _mm512_cmp_epi8_mask((A), (B), _MM_CMPINT_LE)
288 #define _mm512_mask_cmple_epi8_mask(k, A, B) \
289 _mm512_mask_cmp_epi8_mask((k), (A), (B), _MM_CMPINT_LE)
290 #define _mm512_cmplt_epi8_mask(A, B) \
291 _mm512_cmp_epi8_mask((A), (B), _MM_CMPINT_LT)
292 #define _mm512_mask_cmplt_epi8_mask(k, A, B) \
293 _mm512_mask_cmp_epi8_mask((k), (A), (B), _MM_CMPINT_LT)
294 #define _mm512_cmpneq_epi8_mask(A, B) \
295 _mm512_cmp_epi8_mask((A), (B), _MM_CMPINT_NE)
296 #define _mm512_mask_cmpneq_epi8_mask(k, A, B) \
297 _mm512_mask_cmp_epi8_mask((k), (A), (B), _MM_CMPINT_NE)
299 #define _mm512_cmpeq_epu8_mask(A, B) \
300 _mm512_cmp_epu8_mask((A), (B), _MM_CMPINT_EQ)
301 #define _mm512_mask_cmpeq_epu8_mask(k, A, B) \
302 _mm512_mask_cmp_epu8_mask((k), (A), (B), _MM_CMPINT_EQ)
303 #define _mm512_cmpge_epu8_mask(A, B) \
304 _mm512_cmp_epu8_mask((A), (B), _MM_CMPINT_GE)
305 #define _mm512_mask_cmpge_epu8_mask(k, A, B) \
306 _mm512_mask_cmp_epu8_mask((k), (A), (B), _MM_CMPINT_GE)
307 #define _mm512_cmpgt_epu8_mask(A, B) \
308 _mm512_cmp_epu8_mask((A), (B), _MM_CMPINT_GT)
309 #define _mm512_mask_cmpgt_epu8_mask(k, A, B) \
310 _mm512_mask_cmp_epu8_mask((k), (A), (B), _MM_CMPINT_GT)
311 #define _mm512_cmple_epu8_mask(A, B) \
312 _mm512_cmp_epu8_mask((A), (B), _MM_CMPINT_LE)
313 #define _mm512_mask_cmple_epu8_mask(k, A, B) \
314 _mm512_mask_cmp_epu8_mask((k), (A), (B), _MM_CMPINT_LE)
315 #define _mm512_cmplt_epu8_mask(A, B) \
316 _mm512_cmp_epu8_mask((A), (B), _MM_CMPINT_LT)
317 #define _mm512_mask_cmplt_epu8_mask(k, A, B) \
318 _mm512_mask_cmp_epu8_mask((k), (A), (B), _MM_CMPINT_LT)
319 #define _mm512_cmpneq_epu8_mask(A, B) \
320 _mm512_cmp_epu8_mask((A), (B), _MM_CMPINT_NE)
321 #define _mm512_mask_cmpneq_epu8_mask(k, A, B) \
322 _mm512_mask_cmp_epu8_mask((k), (A), (B), _MM_CMPINT_NE)
324 #define _mm512_cmpeq_epi16_mask(A, B) \
325 _mm512_cmp_epi16_mask((A), (B), _MM_CMPINT_EQ)
326 #define _mm512_mask_cmpeq_epi16_mask(k, A, B) \
327 _mm512_mask_cmp_epi16_mask((k), (A), (B), _MM_CMPINT_EQ)
328 #define _mm512_cmpge_epi16_mask(A, B) \
329 _mm512_cmp_epi16_mask((A), (B), _MM_CMPINT_GE)
330 #define _mm512_mask_cmpge_epi16_mask(k, A, B) \
331 _mm512_mask_cmp_epi16_mask((k), (A), (B), _MM_CMPINT_GE)
332 #define _mm512_cmpgt_epi16_mask(A, B) \
333 _mm512_cmp_epi16_mask((A), (B), _MM_CMPINT_GT)
334 #define _mm512_mask_cmpgt_epi16_mask(k, A, B) \
335 _mm512_mask_cmp_epi16_mask((k), (A), (B), _MM_CMPINT_GT)
336 #define _mm512_cmple_epi16_mask(A, B) \
337 _mm512_cmp_epi16_mask((A), (B), _MM_CMPINT_LE)
338 #define _mm512_mask_cmple_epi16_mask(k, A, B) \
339 _mm512_mask_cmp_epi16_mask((k), (A), (B), _MM_CMPINT_LE)
340 #define _mm512_cmplt_epi16_mask(A, B) \
341 _mm512_cmp_epi16_mask((A), (B), _MM_CMPINT_LT)
342 #define _mm512_mask_cmplt_epi16_mask(k, A, B) \
343 _mm512_mask_cmp_epi16_mask((k), (A), (B), _MM_CMPINT_LT)
344 #define _mm512_cmpneq_epi16_mask(A, B) \
345 _mm512_cmp_epi16_mask((A), (B), _MM_CMPINT_NE)
346 #define _mm512_mask_cmpneq_epi16_mask(k, A, B) \
347 _mm512_mask_cmp_epi16_mask((k), (A), (B), _MM_CMPINT_NE)
349 #define _mm512_cmpeq_epu16_mask(A, B) \
350 _mm512_cmp_epu16_mask((A), (B), _MM_CMPINT_EQ)
351 #define _mm512_mask_cmpeq_epu16_mask(k, A, B) \
352 _mm512_mask_cmp_epu16_mask((k), (A), (B), _MM_CMPINT_EQ)
353 #define _mm512_cmpge_epu16_mask(A, B) \
354 _mm512_cmp_epu16_mask((A), (B), _MM_CMPINT_GE)
355 #define _mm512_mask_cmpge_epu16_mask(k, A, B) \
356 _mm512_mask_cmp_epu16_mask((k), (A), (B), _MM_CMPINT_GE)
357 #define _mm512_cmpgt_epu16_mask(A, B) \
358 _mm512_cmp_epu16_mask((A), (B), _MM_CMPINT_GT)
359 #define _mm512_mask_cmpgt_epu16_mask(k, A, B) \
360 _mm512_mask_cmp_epu16_mask((k), (A), (B), _MM_CMPINT_GT)
361 #define _mm512_cmple_epu16_mask(A, B) \
362 _mm512_cmp_epu16_mask((A), (B), _MM_CMPINT_LE)
363 #define _mm512_mask_cmple_epu16_mask(k, A, B) \
364 _mm512_mask_cmp_epu16_mask((k), (A), (B), _MM_CMPINT_LE)
365 #define _mm512_cmplt_epu16_mask(A, B) \
366 _mm512_cmp_epu16_mask((A), (B), _MM_CMPINT_LT)
367 #define _mm512_mask_cmplt_epu16_mask(k, A, B) \
368 _mm512_mask_cmp_epu16_mask((k), (A), (B), _MM_CMPINT_LT)
369 #define _mm512_cmpneq_epu16_mask(A, B) \
370 _mm512_cmp_epu16_mask((A), (B), _MM_CMPINT_NE)
371 #define _mm512_mask_cmpneq_epu16_mask(k, A, B) \
372 _mm512_mask_cmp_epu16_mask((k), (A), (B), _MM_CMPINT_NE)
374 static __inline__ __m512i __DEFAULT_FN_ATTRS512
375 _mm512_add_epi8 (__m512i __A, __m512i __B) {
376 return (__m512i) ((__v64qu) __A + (__v64qu) __B);
379 static __inline__ __m512i __DEFAULT_FN_ATTRS512
380 _mm512_mask_add_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
381 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
382 (__v64qi)_mm512_add_epi8(__A, __B),
383 (__v64qi)__W);
386 static __inline__ __m512i __DEFAULT_FN_ATTRS512
387 _mm512_maskz_add_epi8(__mmask64 __U, __m512i __A, __m512i __B) {
388 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
389 (__v64qi)_mm512_add_epi8(__A, __B),
390 (__v64qi)_mm512_setzero_si512());
393 static __inline__ __m512i __DEFAULT_FN_ATTRS512
394 _mm512_sub_epi8 (__m512i __A, __m512i __B) {
395 return (__m512i) ((__v64qu) __A - (__v64qu) __B);
398 static __inline__ __m512i __DEFAULT_FN_ATTRS512
399 _mm512_mask_sub_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
400 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
401 (__v64qi)_mm512_sub_epi8(__A, __B),
402 (__v64qi)__W);
405 static __inline__ __m512i __DEFAULT_FN_ATTRS512
406 _mm512_maskz_sub_epi8(__mmask64 __U, __m512i __A, __m512i __B) {
407 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
408 (__v64qi)_mm512_sub_epi8(__A, __B),
409 (__v64qi)_mm512_setzero_si512());
412 static __inline__ __m512i __DEFAULT_FN_ATTRS512
413 _mm512_add_epi16 (__m512i __A, __m512i __B) {
414 return (__m512i) ((__v32hu) __A + (__v32hu) __B);
417 static __inline__ __m512i __DEFAULT_FN_ATTRS512
418 _mm512_mask_add_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
419 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
420 (__v32hi)_mm512_add_epi16(__A, __B),
421 (__v32hi)__W);
424 static __inline__ __m512i __DEFAULT_FN_ATTRS512
425 _mm512_maskz_add_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
426 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
427 (__v32hi)_mm512_add_epi16(__A, __B),
428 (__v32hi)_mm512_setzero_si512());
431 static __inline__ __m512i __DEFAULT_FN_ATTRS512
432 _mm512_sub_epi16 (__m512i __A, __m512i __B) {
433 return (__m512i) ((__v32hu) __A - (__v32hu) __B);
436 static __inline__ __m512i __DEFAULT_FN_ATTRS512
437 _mm512_mask_sub_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
438 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
439 (__v32hi)_mm512_sub_epi16(__A, __B),
440 (__v32hi)__W);
443 static __inline__ __m512i __DEFAULT_FN_ATTRS512
444 _mm512_maskz_sub_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
445 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
446 (__v32hi)_mm512_sub_epi16(__A, __B),
447 (__v32hi)_mm512_setzero_si512());
450 static __inline__ __m512i __DEFAULT_FN_ATTRS512
451 _mm512_mullo_epi16 (__m512i __A, __m512i __B) {
452 return (__m512i) ((__v32hu) __A * (__v32hu) __B);
455 static __inline__ __m512i __DEFAULT_FN_ATTRS512
456 _mm512_mask_mullo_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
457 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
458 (__v32hi)_mm512_mullo_epi16(__A, __B),
459 (__v32hi)__W);
462 static __inline__ __m512i __DEFAULT_FN_ATTRS512
463 _mm512_maskz_mullo_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
464 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
465 (__v32hi)_mm512_mullo_epi16(__A, __B),
466 (__v32hi)_mm512_setzero_si512());
469 static __inline__ __m512i __DEFAULT_FN_ATTRS512
470 _mm512_mask_blend_epi8 (__mmask64 __U, __m512i __A, __m512i __W)
472 return (__m512i) __builtin_ia32_selectb_512 ((__mmask64) __U,
473 (__v64qi) __W,
474 (__v64qi) __A);
477 static __inline__ __m512i __DEFAULT_FN_ATTRS512
478 _mm512_mask_blend_epi16 (__mmask32 __U, __m512i __A, __m512i __W)
480 return (__m512i) __builtin_ia32_selectw_512 ((__mmask32) __U,
481 (__v32hi) __W,
482 (__v32hi) __A);
485 static __inline__ __m512i __DEFAULT_FN_ATTRS512
486 _mm512_abs_epi8 (__m512i __A)
488 return (__m512i)__builtin_elementwise_abs((__v64qs)__A);
491 static __inline__ __m512i __DEFAULT_FN_ATTRS512
492 _mm512_mask_abs_epi8 (__m512i __W, __mmask64 __U, __m512i __A)
494 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
495 (__v64qi)_mm512_abs_epi8(__A),
496 (__v64qi)__W);
499 static __inline__ __m512i __DEFAULT_FN_ATTRS512
500 _mm512_maskz_abs_epi8 (__mmask64 __U, __m512i __A)
502 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
503 (__v64qi)_mm512_abs_epi8(__A),
504 (__v64qi)_mm512_setzero_si512());
507 static __inline__ __m512i __DEFAULT_FN_ATTRS512
508 _mm512_abs_epi16 (__m512i __A)
510 return (__m512i)__builtin_elementwise_abs((__v32hi)__A);
513 static __inline__ __m512i __DEFAULT_FN_ATTRS512
514 _mm512_mask_abs_epi16 (__m512i __W, __mmask32 __U, __m512i __A)
516 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
517 (__v32hi)_mm512_abs_epi16(__A),
518 (__v32hi)__W);
521 static __inline__ __m512i __DEFAULT_FN_ATTRS512
522 _mm512_maskz_abs_epi16 (__mmask32 __U, __m512i __A)
524 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
525 (__v32hi)_mm512_abs_epi16(__A),
526 (__v32hi)_mm512_setzero_si512());
529 static __inline__ __m512i __DEFAULT_FN_ATTRS512
530 _mm512_packs_epi32(__m512i __A, __m512i __B)
532 return (__m512i)__builtin_ia32_packssdw512((__v16si)__A, (__v16si)__B);
535 static __inline__ __m512i __DEFAULT_FN_ATTRS512
536 _mm512_maskz_packs_epi32(__mmask32 __M, __m512i __A, __m512i __B)
538 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
539 (__v32hi)_mm512_packs_epi32(__A, __B),
540 (__v32hi)_mm512_setzero_si512());
543 static __inline__ __m512i __DEFAULT_FN_ATTRS512
544 _mm512_mask_packs_epi32(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B)
546 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
547 (__v32hi)_mm512_packs_epi32(__A, __B),
548 (__v32hi)__W);
551 static __inline__ __m512i __DEFAULT_FN_ATTRS512
552 _mm512_packs_epi16(__m512i __A, __m512i __B)
554 return (__m512i)__builtin_ia32_packsswb512((__v32hi)__A, (__v32hi) __B);
557 static __inline__ __m512i __DEFAULT_FN_ATTRS512
558 _mm512_mask_packs_epi16(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
560 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
561 (__v64qi)_mm512_packs_epi16(__A, __B),
562 (__v64qi)__W);
565 static __inline__ __m512i __DEFAULT_FN_ATTRS512
566 _mm512_maskz_packs_epi16(__mmask64 __M, __m512i __A, __m512i __B)
568 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
569 (__v64qi)_mm512_packs_epi16(__A, __B),
570 (__v64qi)_mm512_setzero_si512());
573 static __inline__ __m512i __DEFAULT_FN_ATTRS512
574 _mm512_packus_epi32(__m512i __A, __m512i __B)
576 return (__m512i)__builtin_ia32_packusdw512((__v16si) __A, (__v16si) __B);
579 static __inline__ __m512i __DEFAULT_FN_ATTRS512
580 _mm512_maskz_packus_epi32(__mmask32 __M, __m512i __A, __m512i __B)
582 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
583 (__v32hi)_mm512_packus_epi32(__A, __B),
584 (__v32hi)_mm512_setzero_si512());
587 static __inline__ __m512i __DEFAULT_FN_ATTRS512
588 _mm512_mask_packus_epi32(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B)
590 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
591 (__v32hi)_mm512_packus_epi32(__A, __B),
592 (__v32hi)__W);
595 static __inline__ __m512i __DEFAULT_FN_ATTRS512
596 _mm512_packus_epi16(__m512i __A, __m512i __B)
598 return (__m512i)__builtin_ia32_packuswb512((__v32hi) __A, (__v32hi) __B);
601 static __inline__ __m512i __DEFAULT_FN_ATTRS512
602 _mm512_mask_packus_epi16(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
604 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
605 (__v64qi)_mm512_packus_epi16(__A, __B),
606 (__v64qi)__W);
609 static __inline__ __m512i __DEFAULT_FN_ATTRS512
610 _mm512_maskz_packus_epi16(__mmask64 __M, __m512i __A, __m512i __B)
612 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
613 (__v64qi)_mm512_packus_epi16(__A, __B),
614 (__v64qi)_mm512_setzero_si512());
617 static __inline__ __m512i __DEFAULT_FN_ATTRS512
618 _mm512_adds_epi8 (__m512i __A, __m512i __B)
620 return (__m512i)__builtin_elementwise_add_sat((__v64qs)__A, (__v64qs)__B);
623 static __inline__ __m512i __DEFAULT_FN_ATTRS512
624 _mm512_mask_adds_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
626 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
627 (__v64qi)_mm512_adds_epi8(__A, __B),
628 (__v64qi)__W);
631 static __inline__ __m512i __DEFAULT_FN_ATTRS512
632 _mm512_maskz_adds_epi8 (__mmask64 __U, __m512i __A, __m512i __B)
634 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
635 (__v64qi)_mm512_adds_epi8(__A, __B),
636 (__v64qi)_mm512_setzero_si512());
639 static __inline__ __m512i __DEFAULT_FN_ATTRS512
640 _mm512_adds_epi16 (__m512i __A, __m512i __B)
642 return (__m512i)__builtin_elementwise_add_sat((__v32hi)__A, (__v32hi)__B);
645 static __inline__ __m512i __DEFAULT_FN_ATTRS512
646 _mm512_mask_adds_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
648 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
649 (__v32hi)_mm512_adds_epi16(__A, __B),
650 (__v32hi)__W);
653 static __inline__ __m512i __DEFAULT_FN_ATTRS512
654 _mm512_maskz_adds_epi16 (__mmask32 __U, __m512i __A, __m512i __B)
656 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
657 (__v32hi)_mm512_adds_epi16(__A, __B),
658 (__v32hi)_mm512_setzero_si512());
661 static __inline__ __m512i __DEFAULT_FN_ATTRS512
662 _mm512_adds_epu8 (__m512i __A, __m512i __B)
664 return (__m512i)__builtin_elementwise_add_sat((__v64qu) __A, (__v64qu) __B);
667 static __inline__ __m512i __DEFAULT_FN_ATTRS512
668 _mm512_mask_adds_epu8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
670 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
671 (__v64qi)_mm512_adds_epu8(__A, __B),
672 (__v64qi)__W);
675 static __inline__ __m512i __DEFAULT_FN_ATTRS512
676 _mm512_maskz_adds_epu8 (__mmask64 __U, __m512i __A, __m512i __B)
678 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
679 (__v64qi)_mm512_adds_epu8(__A, __B),
680 (__v64qi)_mm512_setzero_si512());
683 static __inline__ __m512i __DEFAULT_FN_ATTRS512
684 _mm512_adds_epu16 (__m512i __A, __m512i __B)
686 return (__m512i)__builtin_elementwise_add_sat((__v32hu) __A, (__v32hu) __B);
689 static __inline__ __m512i __DEFAULT_FN_ATTRS512
690 _mm512_mask_adds_epu16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
692 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
693 (__v32hi)_mm512_adds_epu16(__A, __B),
694 (__v32hi)__W);
697 static __inline__ __m512i __DEFAULT_FN_ATTRS512
698 _mm512_maskz_adds_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
700 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
701 (__v32hi)_mm512_adds_epu16(__A, __B),
702 (__v32hi)_mm512_setzero_si512());
705 static __inline__ __m512i __DEFAULT_FN_ATTRS512
706 _mm512_avg_epu8 (__m512i __A, __m512i __B)
708 return (__m512i)__builtin_ia32_pavgb512((__v64qi)__A, (__v64qi)__B);
711 static __inline__ __m512i __DEFAULT_FN_ATTRS512
712 _mm512_mask_avg_epu8 (__m512i __W, __mmask64 __U, __m512i __A,
713 __m512i __B)
715 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
716 (__v64qi)_mm512_avg_epu8(__A, __B),
717 (__v64qi)__W);
720 static __inline__ __m512i __DEFAULT_FN_ATTRS512
721 _mm512_maskz_avg_epu8 (__mmask64 __U, __m512i __A, __m512i __B)
723 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
724 (__v64qi)_mm512_avg_epu8(__A, __B),
725 (__v64qi)_mm512_setzero_si512());
728 static __inline__ __m512i __DEFAULT_FN_ATTRS512
729 _mm512_avg_epu16 (__m512i __A, __m512i __B)
731 return (__m512i)__builtin_ia32_pavgw512((__v32hi)__A, (__v32hi)__B);
734 static __inline__ __m512i __DEFAULT_FN_ATTRS512
735 _mm512_mask_avg_epu16 (__m512i __W, __mmask32 __U, __m512i __A,
736 __m512i __B)
738 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
739 (__v32hi)_mm512_avg_epu16(__A, __B),
740 (__v32hi)__W);
743 static __inline__ __m512i __DEFAULT_FN_ATTRS512
744 _mm512_maskz_avg_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
746 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
747 (__v32hi)_mm512_avg_epu16(__A, __B),
748 (__v32hi) _mm512_setzero_si512());
751 static __inline__ __m512i __DEFAULT_FN_ATTRS512
752 _mm512_max_epi8 (__m512i __A, __m512i __B)
754 return (__m512i)__builtin_elementwise_max((__v64qs) __A, (__v64qs) __B);
757 static __inline__ __m512i __DEFAULT_FN_ATTRS512
758 _mm512_maskz_max_epi8 (__mmask64 __M, __m512i __A, __m512i __B)
760 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
761 (__v64qi)_mm512_max_epi8(__A, __B),
762 (__v64qi)_mm512_setzero_si512());
765 static __inline__ __m512i __DEFAULT_FN_ATTRS512
766 _mm512_mask_max_epi8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
768 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
769 (__v64qi)_mm512_max_epi8(__A, __B),
770 (__v64qi)__W);
773 static __inline__ __m512i __DEFAULT_FN_ATTRS512
774 _mm512_max_epi16 (__m512i __A, __m512i __B)
776 return (__m512i)__builtin_elementwise_max((__v32hi) __A, (__v32hi) __B);
779 static __inline__ __m512i __DEFAULT_FN_ATTRS512
780 _mm512_maskz_max_epi16 (__mmask32 __M, __m512i __A, __m512i __B)
782 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
783 (__v32hi)_mm512_max_epi16(__A, __B),
784 (__v32hi)_mm512_setzero_si512());
787 static __inline__ __m512i __DEFAULT_FN_ATTRS512
788 _mm512_mask_max_epi16 (__m512i __W, __mmask32 __M, __m512i __A,
789 __m512i __B)
791 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
792 (__v32hi)_mm512_max_epi16(__A, __B),
793 (__v32hi)__W);
796 static __inline__ __m512i __DEFAULT_FN_ATTRS512
797 _mm512_max_epu8 (__m512i __A, __m512i __B)
799 return (__m512i)__builtin_elementwise_max((__v64qu)__A, (__v64qu)__B);
802 static __inline__ __m512i __DEFAULT_FN_ATTRS512
803 _mm512_maskz_max_epu8 (__mmask64 __M, __m512i __A, __m512i __B)
805 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
806 (__v64qi)_mm512_max_epu8(__A, __B),
807 (__v64qi)_mm512_setzero_si512());
810 static __inline__ __m512i __DEFAULT_FN_ATTRS512
811 _mm512_mask_max_epu8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
813 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
814 (__v64qi)_mm512_max_epu8(__A, __B),
815 (__v64qi)__W);
818 static __inline__ __m512i __DEFAULT_FN_ATTRS512
819 _mm512_max_epu16 (__m512i __A, __m512i __B)
821 return (__m512i)__builtin_elementwise_max((__v32hu)__A, (__v32hu)__B);
824 static __inline__ __m512i __DEFAULT_FN_ATTRS512
825 _mm512_maskz_max_epu16 (__mmask32 __M, __m512i __A, __m512i __B)
827 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
828 (__v32hi)_mm512_max_epu16(__A, __B),
829 (__v32hi)_mm512_setzero_si512());
832 static __inline__ __m512i __DEFAULT_FN_ATTRS512
833 _mm512_mask_max_epu16 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B)
835 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
836 (__v32hi)_mm512_max_epu16(__A, __B),
837 (__v32hi)__W);
840 static __inline__ __m512i __DEFAULT_FN_ATTRS512
841 _mm512_min_epi8 (__m512i __A, __m512i __B)
843 return (__m512i)__builtin_elementwise_min((__v64qs) __A, (__v64qs) __B);
846 static __inline__ __m512i __DEFAULT_FN_ATTRS512
847 _mm512_maskz_min_epi8 (__mmask64 __M, __m512i __A, __m512i __B)
849 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
850 (__v64qi)_mm512_min_epi8(__A, __B),
851 (__v64qi)_mm512_setzero_si512());
854 static __inline__ __m512i __DEFAULT_FN_ATTRS512
855 _mm512_mask_min_epi8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
857 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
858 (__v64qi)_mm512_min_epi8(__A, __B),
859 (__v64qi)__W);
862 static __inline__ __m512i __DEFAULT_FN_ATTRS512
863 _mm512_min_epi16 (__m512i __A, __m512i __B)
865 return (__m512i)__builtin_elementwise_min((__v32hi) __A, (__v32hi) __B);
868 static __inline__ __m512i __DEFAULT_FN_ATTRS512
869 _mm512_maskz_min_epi16 (__mmask32 __M, __m512i __A, __m512i __B)
871 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
872 (__v32hi)_mm512_min_epi16(__A, __B),
873 (__v32hi)_mm512_setzero_si512());
876 static __inline__ __m512i __DEFAULT_FN_ATTRS512
877 _mm512_mask_min_epi16 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B)
879 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
880 (__v32hi)_mm512_min_epi16(__A, __B),
881 (__v32hi)__W);
884 static __inline__ __m512i __DEFAULT_FN_ATTRS512
885 _mm512_min_epu8 (__m512i __A, __m512i __B)
887 return (__m512i)__builtin_elementwise_min((__v64qu)__A, (__v64qu)__B);
890 static __inline__ __m512i __DEFAULT_FN_ATTRS512
891 _mm512_maskz_min_epu8 (__mmask64 __M, __m512i __A, __m512i __B)
893 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
894 (__v64qi)_mm512_min_epu8(__A, __B),
895 (__v64qi)_mm512_setzero_si512());
898 static __inline__ __m512i __DEFAULT_FN_ATTRS512
899 _mm512_mask_min_epu8 (__m512i __W, __mmask64 __M, __m512i __A, __m512i __B)
901 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__M,
902 (__v64qi)_mm512_min_epu8(__A, __B),
903 (__v64qi)__W);
906 static __inline__ __m512i __DEFAULT_FN_ATTRS512
907 _mm512_min_epu16 (__m512i __A, __m512i __B)
909 return (__m512i)__builtin_elementwise_min((__v32hu)__A, (__v32hu)__B);
912 static __inline__ __m512i __DEFAULT_FN_ATTRS512
913 _mm512_maskz_min_epu16 (__mmask32 __M, __m512i __A, __m512i __B)
915 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
916 (__v32hi)_mm512_min_epu16(__A, __B),
917 (__v32hi)_mm512_setzero_si512());
920 static __inline__ __m512i __DEFAULT_FN_ATTRS512
921 _mm512_mask_min_epu16 (__m512i __W, __mmask32 __M, __m512i __A, __m512i __B)
923 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
924 (__v32hi)_mm512_min_epu16(__A, __B),
925 (__v32hi)__W);
928 static __inline__ __m512i __DEFAULT_FN_ATTRS512
929 _mm512_shuffle_epi8(__m512i __A, __m512i __B)
931 return (__m512i)__builtin_ia32_pshufb512((__v64qi)__A,(__v64qi)__B);
934 static __inline__ __m512i __DEFAULT_FN_ATTRS512
935 _mm512_mask_shuffle_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
937 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
938 (__v64qi)_mm512_shuffle_epi8(__A, __B),
939 (__v64qi)__W);
942 static __inline__ __m512i __DEFAULT_FN_ATTRS512
943 _mm512_maskz_shuffle_epi8(__mmask64 __U, __m512i __A, __m512i __B)
945 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
946 (__v64qi)_mm512_shuffle_epi8(__A, __B),
947 (__v64qi)_mm512_setzero_si512());
950 static __inline__ __m512i __DEFAULT_FN_ATTRS512
951 _mm512_subs_epi8 (__m512i __A, __m512i __B)
953 return (__m512i)__builtin_elementwise_sub_sat((__v64qs)__A, (__v64qs)__B);
956 static __inline__ __m512i __DEFAULT_FN_ATTRS512
957 _mm512_mask_subs_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
959 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
960 (__v64qi)_mm512_subs_epi8(__A, __B),
961 (__v64qi)__W);
964 static __inline__ __m512i __DEFAULT_FN_ATTRS512
965 _mm512_maskz_subs_epi8 (__mmask64 __U, __m512i __A, __m512i __B)
967 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
968 (__v64qi)_mm512_subs_epi8(__A, __B),
969 (__v64qi)_mm512_setzero_si512());
972 static __inline__ __m512i __DEFAULT_FN_ATTRS512
973 _mm512_subs_epi16 (__m512i __A, __m512i __B)
975 return (__m512i)__builtin_elementwise_sub_sat((__v32hi)__A, (__v32hi)__B);
978 static __inline__ __m512i __DEFAULT_FN_ATTRS512
979 _mm512_mask_subs_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
981 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
982 (__v32hi)_mm512_subs_epi16(__A, __B),
983 (__v32hi)__W);
986 static __inline__ __m512i __DEFAULT_FN_ATTRS512
987 _mm512_maskz_subs_epi16 (__mmask32 __U, __m512i __A, __m512i __B)
989 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
990 (__v32hi)_mm512_subs_epi16(__A, __B),
991 (__v32hi)_mm512_setzero_si512());
994 static __inline__ __m512i __DEFAULT_FN_ATTRS512
995 _mm512_subs_epu8 (__m512i __A, __m512i __B)
997 return (__m512i)__builtin_elementwise_sub_sat((__v64qu) __A, (__v64qu) __B);
1000 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1001 _mm512_mask_subs_epu8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B)
1003 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
1004 (__v64qi)_mm512_subs_epu8(__A, __B),
1005 (__v64qi)__W);
1008 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1009 _mm512_maskz_subs_epu8 (__mmask64 __U, __m512i __A, __m512i __B)
1011 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
1012 (__v64qi)_mm512_subs_epu8(__A, __B),
1013 (__v64qi)_mm512_setzero_si512());
1016 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1017 _mm512_subs_epu16 (__m512i __A, __m512i __B)
1019 return (__m512i)__builtin_elementwise_sub_sat((__v32hu) __A, (__v32hu) __B);
1022 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1023 _mm512_mask_subs_epu16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
1025 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1026 (__v32hi)_mm512_subs_epu16(__A, __B),
1027 (__v32hi)__W);
1030 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1031 _mm512_maskz_subs_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
1033 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1034 (__v32hi)_mm512_subs_epu16(__A, __B),
1035 (__v32hi)_mm512_setzero_si512());
1038 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1039 _mm512_permutex2var_epi16(__m512i __A, __m512i __I, __m512i __B)
1041 return (__m512i)__builtin_ia32_vpermi2varhi512((__v32hi)__A, (__v32hi)__I,
1042 (__v32hi)__B);
1045 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1046 _mm512_mask_permutex2var_epi16(__m512i __A, __mmask32 __U, __m512i __I,
1047 __m512i __B)
1049 return (__m512i)__builtin_ia32_selectw_512(__U,
1050 (__v32hi)_mm512_permutex2var_epi16(__A, __I, __B),
1051 (__v32hi)__A);
1054 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1055 _mm512_mask2_permutex2var_epi16(__m512i __A, __m512i __I, __mmask32 __U,
1056 __m512i __B)
1058 return (__m512i)__builtin_ia32_selectw_512(__U,
1059 (__v32hi)_mm512_permutex2var_epi16(__A, __I, __B),
1060 (__v32hi)__I);
1063 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1064 _mm512_maskz_permutex2var_epi16(__mmask32 __U, __m512i __A, __m512i __I,
1065 __m512i __B)
1067 return (__m512i)__builtin_ia32_selectw_512(__U,
1068 (__v32hi)_mm512_permutex2var_epi16(__A, __I, __B),
1069 (__v32hi)_mm512_setzero_si512());
1072 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1073 _mm512_mulhrs_epi16(__m512i __A, __m512i __B)
1075 return (__m512i)__builtin_ia32_pmulhrsw512((__v32hi)__A, (__v32hi)__B);
1078 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1079 _mm512_mask_mulhrs_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
1081 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1082 (__v32hi)_mm512_mulhrs_epi16(__A, __B),
1083 (__v32hi)__W);
1086 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1087 _mm512_maskz_mulhrs_epi16(__mmask32 __U, __m512i __A, __m512i __B)
1089 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1090 (__v32hi)_mm512_mulhrs_epi16(__A, __B),
1091 (__v32hi)_mm512_setzero_si512());
1094 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1095 _mm512_mulhi_epi16(__m512i __A, __m512i __B)
1097 return (__m512i)__builtin_ia32_pmulhw512((__v32hi) __A, (__v32hi) __B);
1100 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1101 _mm512_mask_mulhi_epi16(__m512i __W, __mmask32 __U, __m512i __A,
1102 __m512i __B)
1104 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1105 (__v32hi)_mm512_mulhi_epi16(__A, __B),
1106 (__v32hi)__W);
1109 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1110 _mm512_maskz_mulhi_epi16(__mmask32 __U, __m512i __A, __m512i __B)
1112 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1113 (__v32hi)_mm512_mulhi_epi16(__A, __B),
1114 (__v32hi)_mm512_setzero_si512());
1117 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1118 _mm512_mulhi_epu16(__m512i __A, __m512i __B)
1120 return (__m512i)__builtin_ia32_pmulhuw512((__v32hi) __A, (__v32hi) __B);
1123 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1124 _mm512_mask_mulhi_epu16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
1126 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1127 (__v32hi)_mm512_mulhi_epu16(__A, __B),
1128 (__v32hi)__W);
1131 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1132 _mm512_maskz_mulhi_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
1134 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1135 (__v32hi)_mm512_mulhi_epu16(__A, __B),
1136 (__v32hi)_mm512_setzero_si512());
1139 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1140 _mm512_maddubs_epi16(__m512i __X, __m512i __Y) {
1141 return (__m512i)__builtin_ia32_pmaddubsw512((__v64qi)__X, (__v64qi)__Y);
1144 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1145 _mm512_mask_maddubs_epi16(__m512i __W, __mmask32 __U, __m512i __X,
1146 __m512i __Y) {
1147 return (__m512i)__builtin_ia32_selectw_512((__mmask32) __U,
1148 (__v32hi)_mm512_maddubs_epi16(__X, __Y),
1149 (__v32hi)__W);
1152 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1153 _mm512_maskz_maddubs_epi16(__mmask32 __U, __m512i __X, __m512i __Y) {
1154 return (__m512i)__builtin_ia32_selectw_512((__mmask32) __U,
1155 (__v32hi)_mm512_maddubs_epi16(__X, __Y),
1156 (__v32hi)_mm512_setzero_si512());
1159 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1160 _mm512_madd_epi16(__m512i __A, __m512i __B) {
1161 return (__m512i)__builtin_ia32_pmaddwd512((__v32hi)__A, (__v32hi)__B);
1164 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1165 _mm512_mask_madd_epi16(__m512i __W, __mmask16 __U, __m512i __A, __m512i __B) {
1166 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
1167 (__v16si)_mm512_madd_epi16(__A, __B),
1168 (__v16si)__W);
1171 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1172 _mm512_maskz_madd_epi16(__mmask16 __U, __m512i __A, __m512i __B) {
1173 return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U,
1174 (__v16si)_mm512_madd_epi16(__A, __B),
1175 (__v16si)_mm512_setzero_si512());
1178 static __inline__ __m256i __DEFAULT_FN_ATTRS512
1179 _mm512_cvtsepi16_epi8 (__m512i __A) {
1180 return (__m256i) __builtin_ia32_pmovswb512_mask ((__v32hi) __A,
1181 (__v32qi)_mm256_setzero_si256(),
1182 (__mmask32) -1);
1185 static __inline__ __m256i __DEFAULT_FN_ATTRS512
1186 _mm512_mask_cvtsepi16_epi8 (__m256i __O, __mmask32 __M, __m512i __A) {
1187 return (__m256i) __builtin_ia32_pmovswb512_mask ((__v32hi) __A,
1188 (__v32qi)__O,
1189 __M);
1192 static __inline__ __m256i __DEFAULT_FN_ATTRS512
1193 _mm512_maskz_cvtsepi16_epi8 (__mmask32 __M, __m512i __A) {
1194 return (__m256i) __builtin_ia32_pmovswb512_mask ((__v32hi) __A,
1195 (__v32qi) _mm256_setzero_si256(),
1196 __M);
1199 static __inline__ __m256i __DEFAULT_FN_ATTRS512
1200 _mm512_cvtusepi16_epi8 (__m512i __A) {
1201 return (__m256i) __builtin_ia32_pmovuswb512_mask ((__v32hi) __A,
1202 (__v32qi) _mm256_setzero_si256(),
1203 (__mmask32) -1);
1206 static __inline__ __m256i __DEFAULT_FN_ATTRS512
1207 _mm512_mask_cvtusepi16_epi8 (__m256i __O, __mmask32 __M, __m512i __A) {
1208 return (__m256i) __builtin_ia32_pmovuswb512_mask ((__v32hi) __A,
1209 (__v32qi) __O,
1210 __M);
1213 static __inline__ __m256i __DEFAULT_FN_ATTRS512
1214 _mm512_maskz_cvtusepi16_epi8 (__mmask32 __M, __m512i __A) {
1215 return (__m256i) __builtin_ia32_pmovuswb512_mask ((__v32hi) __A,
1216 (__v32qi) _mm256_setzero_si256(),
1217 __M);
1220 static __inline__ __m256i __DEFAULT_FN_ATTRS512
1221 _mm512_cvtepi16_epi8 (__m512i __A) {
1222 return (__m256i) __builtin_ia32_pmovwb512_mask ((__v32hi) __A,
1223 (__v32qi) _mm256_undefined_si256(),
1224 (__mmask32) -1);
1227 static __inline__ __m256i __DEFAULT_FN_ATTRS512
1228 _mm512_mask_cvtepi16_epi8 (__m256i __O, __mmask32 __M, __m512i __A) {
1229 return (__m256i) __builtin_ia32_pmovwb512_mask ((__v32hi) __A,
1230 (__v32qi) __O,
1231 __M);
1234 static __inline__ __m256i __DEFAULT_FN_ATTRS512
1235 _mm512_maskz_cvtepi16_epi8 (__mmask32 __M, __m512i __A) {
1236 return (__m256i) __builtin_ia32_pmovwb512_mask ((__v32hi) __A,
1237 (__v32qi) _mm256_setzero_si256(),
1238 __M);
1241 static __inline__ void __DEFAULT_FN_ATTRS512
1242 _mm512_mask_cvtepi16_storeu_epi8 (void * __P, __mmask32 __M, __m512i __A)
1244 __builtin_ia32_pmovwb512mem_mask ((__v32qi *) __P, (__v32hi) __A, __M);
1247 static __inline__ void __DEFAULT_FN_ATTRS512
1248 _mm512_mask_cvtsepi16_storeu_epi8 (void * __P, __mmask32 __M, __m512i __A)
1250 __builtin_ia32_pmovswb512mem_mask ((__v32qi *) __P, (__v32hi) __A, __M);
1253 static __inline__ void __DEFAULT_FN_ATTRS512
1254 _mm512_mask_cvtusepi16_storeu_epi8 (void * __P, __mmask32 __M, __m512i __A)
1256 __builtin_ia32_pmovuswb512mem_mask ((__v32qi *) __P, (__v32hi) __A, __M);
1259 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1260 _mm512_unpackhi_epi8(__m512i __A, __m512i __B) {
1261 return (__m512i)__builtin_shufflevector((__v64qi)__A, (__v64qi)__B,
1262 8, 64+8, 9, 64+9,
1263 10, 64+10, 11, 64+11,
1264 12, 64+12, 13, 64+13,
1265 14, 64+14, 15, 64+15,
1266 24, 64+24, 25, 64+25,
1267 26, 64+26, 27, 64+27,
1268 28, 64+28, 29, 64+29,
1269 30, 64+30, 31, 64+31,
1270 40, 64+40, 41, 64+41,
1271 42, 64+42, 43, 64+43,
1272 44, 64+44, 45, 64+45,
1273 46, 64+46, 47, 64+47,
1274 56, 64+56, 57, 64+57,
1275 58, 64+58, 59, 64+59,
1276 60, 64+60, 61, 64+61,
1277 62, 64+62, 63, 64+63);
1280 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1281 _mm512_mask_unpackhi_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
1282 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
1283 (__v64qi)_mm512_unpackhi_epi8(__A, __B),
1284 (__v64qi)__W);
1287 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1288 _mm512_maskz_unpackhi_epi8(__mmask64 __U, __m512i __A, __m512i __B) {
1289 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
1290 (__v64qi)_mm512_unpackhi_epi8(__A, __B),
1291 (__v64qi)_mm512_setzero_si512());
1294 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1295 _mm512_unpackhi_epi16(__m512i __A, __m512i __B) {
1296 return (__m512i)__builtin_shufflevector((__v32hi)__A, (__v32hi)__B,
1297 4, 32+4, 5, 32+5,
1298 6, 32+6, 7, 32+7,
1299 12, 32+12, 13, 32+13,
1300 14, 32+14, 15, 32+15,
1301 20, 32+20, 21, 32+21,
1302 22, 32+22, 23, 32+23,
1303 28, 32+28, 29, 32+29,
1304 30, 32+30, 31, 32+31);
1307 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1308 _mm512_mask_unpackhi_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
1309 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1310 (__v32hi)_mm512_unpackhi_epi16(__A, __B),
1311 (__v32hi)__W);
1314 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1315 _mm512_maskz_unpackhi_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
1316 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1317 (__v32hi)_mm512_unpackhi_epi16(__A, __B),
1318 (__v32hi)_mm512_setzero_si512());
1321 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1322 _mm512_unpacklo_epi8(__m512i __A, __m512i __B) {
1323 return (__m512i)__builtin_shufflevector((__v64qi)__A, (__v64qi)__B,
1324 0, 64+0, 1, 64+1,
1325 2, 64+2, 3, 64+3,
1326 4, 64+4, 5, 64+5,
1327 6, 64+6, 7, 64+7,
1328 16, 64+16, 17, 64+17,
1329 18, 64+18, 19, 64+19,
1330 20, 64+20, 21, 64+21,
1331 22, 64+22, 23, 64+23,
1332 32, 64+32, 33, 64+33,
1333 34, 64+34, 35, 64+35,
1334 36, 64+36, 37, 64+37,
1335 38, 64+38, 39, 64+39,
1336 48, 64+48, 49, 64+49,
1337 50, 64+50, 51, 64+51,
1338 52, 64+52, 53, 64+53,
1339 54, 64+54, 55, 64+55);
1342 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1343 _mm512_mask_unpacklo_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
1344 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
1345 (__v64qi)_mm512_unpacklo_epi8(__A, __B),
1346 (__v64qi)__W);
1349 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1350 _mm512_maskz_unpacklo_epi8(__mmask64 __U, __m512i __A, __m512i __B) {
1351 return (__m512i)__builtin_ia32_selectb_512((__mmask64)__U,
1352 (__v64qi)_mm512_unpacklo_epi8(__A, __B),
1353 (__v64qi)_mm512_setzero_si512());
1356 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1357 _mm512_unpacklo_epi16(__m512i __A, __m512i __B) {
1358 return (__m512i)__builtin_shufflevector((__v32hi)__A, (__v32hi)__B,
1359 0, 32+0, 1, 32+1,
1360 2, 32+2, 3, 32+3,
1361 8, 32+8, 9, 32+9,
1362 10, 32+10, 11, 32+11,
1363 16, 32+16, 17, 32+17,
1364 18, 32+18, 19, 32+19,
1365 24, 32+24, 25, 32+25,
1366 26, 32+26, 27, 32+27);
1369 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1370 _mm512_mask_unpacklo_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
1371 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1372 (__v32hi)_mm512_unpacklo_epi16(__A, __B),
1373 (__v32hi)__W);
1376 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1377 _mm512_maskz_unpacklo_epi16(__mmask32 __U, __m512i __A, __m512i __B) {
1378 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1379 (__v32hi)_mm512_unpacklo_epi16(__A, __B),
1380 (__v32hi)_mm512_setzero_si512());
1383 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1384 _mm512_cvtepi8_epi16(__m256i __A)
1386 /* This function always performs a signed extension, but __v32qi is a char
1387 which may be signed or unsigned, so use __v32qs. */
1388 return (__m512i)__builtin_convertvector((__v32qs)__A, __v32hi);
1391 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1392 _mm512_mask_cvtepi8_epi16(__m512i __W, __mmask32 __U, __m256i __A)
1394 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1395 (__v32hi)_mm512_cvtepi8_epi16(__A),
1396 (__v32hi)__W);
1399 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1400 _mm512_maskz_cvtepi8_epi16(__mmask32 __U, __m256i __A)
1402 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1403 (__v32hi)_mm512_cvtepi8_epi16(__A),
1404 (__v32hi)_mm512_setzero_si512());
1407 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1408 _mm512_cvtepu8_epi16(__m256i __A)
1410 return (__m512i)__builtin_convertvector((__v32qu)__A, __v32hi);
1413 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1414 _mm512_mask_cvtepu8_epi16(__m512i __W, __mmask32 __U, __m256i __A)
1416 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1417 (__v32hi)_mm512_cvtepu8_epi16(__A),
1418 (__v32hi)__W);
1421 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1422 _mm512_maskz_cvtepu8_epi16(__mmask32 __U, __m256i __A)
1424 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1425 (__v32hi)_mm512_cvtepu8_epi16(__A),
1426 (__v32hi)_mm512_setzero_si512());
1430 #define _mm512_shufflehi_epi16(A, imm) \
1431 ((__m512i)__builtin_ia32_pshufhw512((__v32hi)(__m512i)(A), (int)(imm)))
1433 #define _mm512_mask_shufflehi_epi16(W, U, A, imm) \
1434 ((__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
1435 (__v32hi)_mm512_shufflehi_epi16((A), \
1436 (imm)), \
1437 (__v32hi)(__m512i)(W)))
1439 #define _mm512_maskz_shufflehi_epi16(U, A, imm) \
1440 ((__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
1441 (__v32hi)_mm512_shufflehi_epi16((A), \
1442 (imm)), \
1443 (__v32hi)_mm512_setzero_si512()))
1445 #define _mm512_shufflelo_epi16(A, imm) \
1446 ((__m512i)__builtin_ia32_pshuflw512((__v32hi)(__m512i)(A), (int)(imm)))
1449 #define _mm512_mask_shufflelo_epi16(W, U, A, imm) \
1450 ((__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
1451 (__v32hi)_mm512_shufflelo_epi16((A), \
1452 (imm)), \
1453 (__v32hi)(__m512i)(W)))
1456 #define _mm512_maskz_shufflelo_epi16(U, A, imm) \
1457 ((__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
1458 (__v32hi)_mm512_shufflelo_epi16((A), \
1459 (imm)), \
1460 (__v32hi)_mm512_setzero_si512()))
1462 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1463 _mm512_sllv_epi16(__m512i __A, __m512i __B)
1465 return (__m512i)__builtin_ia32_psllv32hi((__v32hi) __A, (__v32hi) __B);
1468 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1469 _mm512_mask_sllv_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
1471 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1472 (__v32hi)_mm512_sllv_epi16(__A, __B),
1473 (__v32hi)__W);
1476 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1477 _mm512_maskz_sllv_epi16(__mmask32 __U, __m512i __A, __m512i __B)
1479 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1480 (__v32hi)_mm512_sllv_epi16(__A, __B),
1481 (__v32hi)_mm512_setzero_si512());
1484 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1485 _mm512_sll_epi16(__m512i __A, __m128i __B)
1487 return (__m512i)__builtin_ia32_psllw512((__v32hi) __A, (__v8hi) __B);
1490 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1491 _mm512_mask_sll_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m128i __B)
1493 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1494 (__v32hi)_mm512_sll_epi16(__A, __B),
1495 (__v32hi)__W);
1498 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1499 _mm512_maskz_sll_epi16(__mmask32 __U, __m512i __A, __m128i __B)
1501 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1502 (__v32hi)_mm512_sll_epi16(__A, __B),
1503 (__v32hi)_mm512_setzero_si512());
1506 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1507 _mm512_slli_epi16(__m512i __A, unsigned int __B)
1509 return (__m512i)__builtin_ia32_psllwi512((__v32hi)__A, (int)__B);
1512 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1513 _mm512_mask_slli_epi16(__m512i __W, __mmask32 __U, __m512i __A,
1514 unsigned int __B)
1516 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1517 (__v32hi)_mm512_slli_epi16(__A, __B),
1518 (__v32hi)__W);
1521 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1522 _mm512_maskz_slli_epi16(__mmask32 __U, __m512i __A, unsigned int __B)
1524 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1525 (__v32hi)_mm512_slli_epi16(__A, __B),
1526 (__v32hi)_mm512_setzero_si512());
1529 #define _mm512_bslli_epi128(a, imm) \
1530 ((__m512i)__builtin_ia32_pslldqi512_byteshift((__v8di)(__m512i)(a), (int)(imm)))
1532 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1533 _mm512_srlv_epi16(__m512i __A, __m512i __B)
1535 return (__m512i)__builtin_ia32_psrlv32hi((__v32hi)__A, (__v32hi)__B);
1538 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1539 _mm512_mask_srlv_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
1541 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1542 (__v32hi)_mm512_srlv_epi16(__A, __B),
1543 (__v32hi)__W);
1546 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1547 _mm512_maskz_srlv_epi16(__mmask32 __U, __m512i __A, __m512i __B)
1549 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1550 (__v32hi)_mm512_srlv_epi16(__A, __B),
1551 (__v32hi)_mm512_setzero_si512());
1554 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1555 _mm512_srav_epi16(__m512i __A, __m512i __B)
1557 return (__m512i)__builtin_ia32_psrav32hi((__v32hi)__A, (__v32hi)__B);
1560 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1561 _mm512_mask_srav_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B)
1563 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1564 (__v32hi)_mm512_srav_epi16(__A, __B),
1565 (__v32hi)__W);
1568 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1569 _mm512_maskz_srav_epi16(__mmask32 __U, __m512i __A, __m512i __B)
1571 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1572 (__v32hi)_mm512_srav_epi16(__A, __B),
1573 (__v32hi)_mm512_setzero_si512());
1576 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1577 _mm512_sra_epi16(__m512i __A, __m128i __B)
1579 return (__m512i)__builtin_ia32_psraw512((__v32hi) __A, (__v8hi) __B);
1582 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1583 _mm512_mask_sra_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m128i __B)
1585 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1586 (__v32hi)_mm512_sra_epi16(__A, __B),
1587 (__v32hi)__W);
1590 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1591 _mm512_maskz_sra_epi16(__mmask32 __U, __m512i __A, __m128i __B)
1593 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1594 (__v32hi)_mm512_sra_epi16(__A, __B),
1595 (__v32hi)_mm512_setzero_si512());
1598 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1599 _mm512_srai_epi16(__m512i __A, unsigned int __B)
1601 return (__m512i)__builtin_ia32_psrawi512((__v32hi)__A, (int)__B);
1604 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1605 _mm512_mask_srai_epi16(__m512i __W, __mmask32 __U, __m512i __A,
1606 unsigned int __B)
1608 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1609 (__v32hi)_mm512_srai_epi16(__A, __B),
1610 (__v32hi)__W);
1613 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1614 _mm512_maskz_srai_epi16(__mmask32 __U, __m512i __A, unsigned int __B)
1616 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1617 (__v32hi)_mm512_srai_epi16(__A, __B),
1618 (__v32hi)_mm512_setzero_si512());
1621 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1622 _mm512_srl_epi16(__m512i __A, __m128i __B)
1624 return (__m512i)__builtin_ia32_psrlw512((__v32hi) __A, (__v8hi) __B);
1627 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1628 _mm512_mask_srl_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m128i __B)
1630 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1631 (__v32hi)_mm512_srl_epi16(__A, __B),
1632 (__v32hi)__W);
1635 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1636 _mm512_maskz_srl_epi16(__mmask32 __U, __m512i __A, __m128i __B)
1638 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1639 (__v32hi)_mm512_srl_epi16(__A, __B),
1640 (__v32hi)_mm512_setzero_si512());
1643 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1644 _mm512_srli_epi16(__m512i __A, unsigned int __B)
1646 return (__m512i)__builtin_ia32_psrlwi512((__v32hi)__A, (int)__B);
1649 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1650 _mm512_mask_srli_epi16(__m512i __W, __mmask32 __U, __m512i __A,
1651 unsigned int __B)
1653 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1654 (__v32hi)_mm512_srli_epi16(__A, __B),
1655 (__v32hi)__W);
1658 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1659 _mm512_maskz_srli_epi16(__mmask32 __U, __m512i __A, int __B)
1661 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__U,
1662 (__v32hi)_mm512_srli_epi16(__A, (unsigned int)__B),
1663 (__v32hi)_mm512_setzero_si512());
1666 #define _mm512_bsrli_epi128(a, imm) \
1667 ((__m512i)__builtin_ia32_psrldqi512_byteshift((__v8di)(__m512i)(a), (int)(imm)))
1669 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1670 _mm512_mask_mov_epi16 (__m512i __W, __mmask32 __U, __m512i __A)
1672 return (__m512i) __builtin_ia32_selectw_512 ((__mmask32) __U,
1673 (__v32hi) __A,
1674 (__v32hi) __W);
1677 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1678 _mm512_maskz_mov_epi16 (__mmask32 __U, __m512i __A)
1680 return (__m512i) __builtin_ia32_selectw_512 ((__mmask32) __U,
1681 (__v32hi) __A,
1682 (__v32hi) _mm512_setzero_si512 ());
1685 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1686 _mm512_mask_mov_epi8 (__m512i __W, __mmask64 __U, __m512i __A)
1688 return (__m512i) __builtin_ia32_selectb_512 ((__mmask64) __U,
1689 (__v64qi) __A,
1690 (__v64qi) __W);
1693 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1694 _mm512_maskz_mov_epi8 (__mmask64 __U, __m512i __A)
1696 return (__m512i) __builtin_ia32_selectb_512 ((__mmask64) __U,
1697 (__v64qi) __A,
1698 (__v64qi) _mm512_setzero_si512 ());
1701 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1702 _mm512_mask_set1_epi8 (__m512i __O, __mmask64 __M, char __A)
1704 return (__m512i) __builtin_ia32_selectb_512(__M,
1705 (__v64qi)_mm512_set1_epi8(__A),
1706 (__v64qi) __O);
1709 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1710 _mm512_maskz_set1_epi8 (__mmask64 __M, char __A)
1712 return (__m512i) __builtin_ia32_selectb_512(__M,
1713 (__v64qi) _mm512_set1_epi8(__A),
1714 (__v64qi) _mm512_setzero_si512());
1717 static __inline__ __mmask64 __DEFAULT_FN_ATTRS
1718 _mm512_kunpackd (__mmask64 __A, __mmask64 __B)
1720 return (__mmask64) __builtin_ia32_kunpckdi ((__mmask64) __A,
1721 (__mmask64) __B);
1724 static __inline__ __mmask32 __DEFAULT_FN_ATTRS
1725 _mm512_kunpackw (__mmask32 __A, __mmask32 __B)
1727 return (__mmask32) __builtin_ia32_kunpcksi ((__mmask32) __A,
1728 (__mmask32) __B);
1731 static __inline __m512i __DEFAULT_FN_ATTRS512
1732 _mm512_loadu_epi16 (void const *__P)
1734 struct __loadu_epi16 {
1735 __m512i_u __v;
1736 } __attribute__((__packed__, __may_alias__));
1737 return ((const struct __loadu_epi16*)__P)->__v;
1740 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1741 _mm512_mask_loadu_epi16 (__m512i __W, __mmask32 __U, void const *__P)
1743 return (__m512i) __builtin_ia32_loaddquhi512_mask ((const __v32hi *) __P,
1744 (__v32hi) __W,
1745 (__mmask32) __U);
1748 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1749 _mm512_maskz_loadu_epi16 (__mmask32 __U, void const *__P)
1751 return (__m512i) __builtin_ia32_loaddquhi512_mask ((const __v32hi *) __P,
1752 (__v32hi)
1753 _mm512_setzero_si512 (),
1754 (__mmask32) __U);
1757 static __inline __m512i __DEFAULT_FN_ATTRS512
1758 _mm512_loadu_epi8 (void const *__P)
1760 struct __loadu_epi8 {
1761 __m512i_u __v;
1762 } __attribute__((__packed__, __may_alias__));
1763 return ((const struct __loadu_epi8*)__P)->__v;
1766 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1767 _mm512_mask_loadu_epi8 (__m512i __W, __mmask64 __U, void const *__P)
1769 return (__m512i) __builtin_ia32_loaddquqi512_mask ((const __v64qi *) __P,
1770 (__v64qi) __W,
1771 (__mmask64) __U);
1774 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1775 _mm512_maskz_loadu_epi8 (__mmask64 __U, void const *__P)
1777 return (__m512i) __builtin_ia32_loaddquqi512_mask ((const __v64qi *) __P,
1778 (__v64qi)
1779 _mm512_setzero_si512 (),
1780 (__mmask64) __U);
1783 static __inline void __DEFAULT_FN_ATTRS512
1784 _mm512_storeu_epi16 (void *__P, __m512i __A)
1786 struct __storeu_epi16 {
1787 __m512i_u __v;
1788 } __attribute__((__packed__, __may_alias__));
1789 ((struct __storeu_epi16*)__P)->__v = __A;
1792 static __inline__ void __DEFAULT_FN_ATTRS512
1793 _mm512_mask_storeu_epi16 (void *__P, __mmask32 __U, __m512i __A)
1795 __builtin_ia32_storedquhi512_mask ((__v32hi *) __P,
1796 (__v32hi) __A,
1797 (__mmask32) __U);
1800 static __inline void __DEFAULT_FN_ATTRS512
1801 _mm512_storeu_epi8 (void *__P, __m512i __A)
1803 struct __storeu_epi8 {
1804 __m512i_u __v;
1805 } __attribute__((__packed__, __may_alias__));
1806 ((struct __storeu_epi8*)__P)->__v = __A;
1809 static __inline__ void __DEFAULT_FN_ATTRS512
1810 _mm512_mask_storeu_epi8 (void *__P, __mmask64 __U, __m512i __A)
1812 __builtin_ia32_storedquqi512_mask ((__v64qi *) __P,
1813 (__v64qi) __A,
1814 (__mmask64) __U);
1817 static __inline__ __mmask64 __DEFAULT_FN_ATTRS512
1818 _mm512_test_epi8_mask (__m512i __A, __m512i __B)
1820 return _mm512_cmpneq_epi8_mask (_mm512_and_epi32 (__A, __B),
1821 _mm512_setzero_si512());
1824 static __inline__ __mmask64 __DEFAULT_FN_ATTRS512
1825 _mm512_mask_test_epi8_mask (__mmask64 __U, __m512i __A, __m512i __B)
1827 return _mm512_mask_cmpneq_epi8_mask (__U, _mm512_and_epi32 (__A, __B),
1828 _mm512_setzero_si512());
1831 static __inline__ __mmask32 __DEFAULT_FN_ATTRS512
1832 _mm512_test_epi16_mask (__m512i __A, __m512i __B)
1834 return _mm512_cmpneq_epi16_mask (_mm512_and_epi32 (__A, __B),
1835 _mm512_setzero_si512());
1838 static __inline__ __mmask32 __DEFAULT_FN_ATTRS512
1839 _mm512_mask_test_epi16_mask (__mmask32 __U, __m512i __A, __m512i __B)
1841 return _mm512_mask_cmpneq_epi16_mask (__U, _mm512_and_epi32 (__A, __B),
1842 _mm512_setzero_si512());
1845 static __inline__ __mmask64 __DEFAULT_FN_ATTRS512
1846 _mm512_testn_epi8_mask (__m512i __A, __m512i __B)
1848 return _mm512_cmpeq_epi8_mask (_mm512_and_epi32 (__A, __B), _mm512_setzero_si512());
1851 static __inline__ __mmask64 __DEFAULT_FN_ATTRS512
1852 _mm512_mask_testn_epi8_mask (__mmask64 __U, __m512i __A, __m512i __B)
1854 return _mm512_mask_cmpeq_epi8_mask (__U, _mm512_and_epi32 (__A, __B),
1855 _mm512_setzero_si512());
1858 static __inline__ __mmask32 __DEFAULT_FN_ATTRS512
1859 _mm512_testn_epi16_mask (__m512i __A, __m512i __B)
1861 return _mm512_cmpeq_epi16_mask (_mm512_and_epi32 (__A, __B),
1862 _mm512_setzero_si512());
1865 static __inline__ __mmask32 __DEFAULT_FN_ATTRS512
1866 _mm512_mask_testn_epi16_mask (__mmask32 __U, __m512i __A, __m512i __B)
1868 return _mm512_mask_cmpeq_epi16_mask (__U, _mm512_and_epi32 (__A, __B),
1869 _mm512_setzero_si512());
1872 static __inline__ __mmask64 __DEFAULT_FN_ATTRS512
1873 _mm512_movepi8_mask (__m512i __A)
1875 return (__mmask64) __builtin_ia32_cvtb2mask512 ((__v64qi) __A);
1878 static __inline__ __mmask32 __DEFAULT_FN_ATTRS512
1879 _mm512_movepi16_mask (__m512i __A)
1881 return (__mmask32) __builtin_ia32_cvtw2mask512 ((__v32hi) __A);
1884 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1885 _mm512_movm_epi8 (__mmask64 __A)
1887 return (__m512i) __builtin_ia32_cvtmask2b512 (__A);
1890 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1891 _mm512_movm_epi16 (__mmask32 __A)
1893 return (__m512i) __builtin_ia32_cvtmask2w512 (__A);
1896 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1897 _mm512_broadcastb_epi8 (__m128i __A)
1899 return (__m512i)__builtin_shufflevector((__v16qi) __A, (__v16qi) __A,
1900 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1901 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1902 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1903 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1906 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1907 _mm512_mask_broadcastb_epi8 (__m512i __O, __mmask64 __M, __m128i __A)
1909 return (__m512i)__builtin_ia32_selectb_512(__M,
1910 (__v64qi) _mm512_broadcastb_epi8(__A),
1911 (__v64qi) __O);
1914 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1915 _mm512_maskz_broadcastb_epi8 (__mmask64 __M, __m128i __A)
1917 return (__m512i)__builtin_ia32_selectb_512(__M,
1918 (__v64qi) _mm512_broadcastb_epi8(__A),
1919 (__v64qi) _mm512_setzero_si512());
1922 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1923 _mm512_mask_set1_epi16 (__m512i __O, __mmask32 __M, short __A)
1925 return (__m512i) __builtin_ia32_selectw_512(__M,
1926 (__v32hi) _mm512_set1_epi16(__A),
1927 (__v32hi) __O);
1930 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1931 _mm512_maskz_set1_epi16 (__mmask32 __M, short __A)
1933 return (__m512i) __builtin_ia32_selectw_512(__M,
1934 (__v32hi) _mm512_set1_epi16(__A),
1935 (__v32hi) _mm512_setzero_si512());
1938 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1939 _mm512_broadcastw_epi16 (__m128i __A)
1941 return (__m512i)__builtin_shufflevector((__v8hi) __A, (__v8hi) __A,
1942 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1943 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1946 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1947 _mm512_mask_broadcastw_epi16 (__m512i __O, __mmask32 __M, __m128i __A)
1949 return (__m512i)__builtin_ia32_selectw_512(__M,
1950 (__v32hi) _mm512_broadcastw_epi16(__A),
1951 (__v32hi) __O);
1954 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1955 _mm512_maskz_broadcastw_epi16 (__mmask32 __M, __m128i __A)
1957 return (__m512i)__builtin_ia32_selectw_512(__M,
1958 (__v32hi) _mm512_broadcastw_epi16(__A),
1959 (__v32hi) _mm512_setzero_si512());
1962 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1963 _mm512_permutexvar_epi16 (__m512i __A, __m512i __B)
1965 return (__m512i)__builtin_ia32_permvarhi512((__v32hi)__B, (__v32hi)__A);
1968 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1969 _mm512_maskz_permutexvar_epi16 (__mmask32 __M, __m512i __A,
1970 __m512i __B)
1972 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
1973 (__v32hi)_mm512_permutexvar_epi16(__A, __B),
1974 (__v32hi)_mm512_setzero_si512());
1977 static __inline__ __m512i __DEFAULT_FN_ATTRS512
1978 _mm512_mask_permutexvar_epi16 (__m512i __W, __mmask32 __M, __m512i __A,
1979 __m512i __B)
1981 return (__m512i)__builtin_ia32_selectw_512((__mmask32)__M,
1982 (__v32hi)_mm512_permutexvar_epi16(__A, __B),
1983 (__v32hi)__W);
1986 #define _mm512_alignr_epi8(A, B, N) \
1987 ((__m512i)__builtin_ia32_palignr512((__v64qi)(__m512i)(A), \
1988 (__v64qi)(__m512i)(B), (int)(N)))
1990 #define _mm512_mask_alignr_epi8(W, U, A, B, N) \
1991 ((__m512i)__builtin_ia32_selectb_512((__mmask64)(U), \
1992 (__v64qi)_mm512_alignr_epi8((A), (B), (int)(N)), \
1993 (__v64qi)(__m512i)(W)))
1995 #define _mm512_maskz_alignr_epi8(U, A, B, N) \
1996 ((__m512i)__builtin_ia32_selectb_512((__mmask64)(U), \
1997 (__v64qi)_mm512_alignr_epi8((A), (B), (int)(N)), \
1998 (__v64qi)(__m512i)_mm512_setzero_si512()))
2000 #define _mm512_dbsad_epu8(A, B, imm) \
2001 ((__m512i)__builtin_ia32_dbpsadbw512((__v64qi)(__m512i)(A), \
2002 (__v64qi)(__m512i)(B), (int)(imm)))
2004 #define _mm512_mask_dbsad_epu8(W, U, A, B, imm) \
2005 ((__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
2006 (__v32hi)_mm512_dbsad_epu8((A), (B), (imm)), \
2007 (__v32hi)(__m512i)(W)))
2009 #define _mm512_maskz_dbsad_epu8(U, A, B, imm) \
2010 ((__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
2011 (__v32hi)_mm512_dbsad_epu8((A), (B), (imm)), \
2012 (__v32hi)_mm512_setzero_si512()))
2014 static __inline__ __m512i __DEFAULT_FN_ATTRS512
2015 _mm512_sad_epu8 (__m512i __A, __m512i __B)
2017 return (__m512i) __builtin_ia32_psadbw512 ((__v64qi) __A,
2018 (__v64qi) __B);
2021 #undef __DEFAULT_FN_ATTRS512
2022 #undef __DEFAULT_FN_ATTRS
2024 #endif