xref: /freebsd/contrib/llvm-project/clang/lib/Headers/avx512vbmi2intrin.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
10b57cec5SDimitry Andric /*===------------- avx512vbmi2intrin.h - VBMI2 intrinsics ------------------===
20b57cec5SDimitry Andric  *
30b57cec5SDimitry Andric  *
40b57cec5SDimitry Andric  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
50b57cec5SDimitry Andric  * See https://llvm.org/LICENSE.txt for license information.
60b57cec5SDimitry Andric  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
70b57cec5SDimitry Andric  *
80b57cec5SDimitry Andric  *===-----------------------------------------------------------------------===
90b57cec5SDimitry Andric  */
100b57cec5SDimitry Andric #ifndef __IMMINTRIN_H
110b57cec5SDimitry Andric #error "Never use <avx512vbmi2intrin.h> directly; include <immintrin.h> instead."
120b57cec5SDimitry Andric #endif
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef __AVX512VBMI2INTRIN_H
150b57cec5SDimitry Andric #define __AVX512VBMI2INTRIN_H
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric /* Define the default attributes for the functions in this file. */
18*5f757f3fSDimitry Andric #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi2,evex512"), __min_vector_width__(512)))
190b57cec5SDimitry Andric 
200b57cec5SDimitry Andric 
210b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
220b57cec5SDimitry Andric _mm512_mask_compress_epi16(__m512i __S, __mmask32 __U, __m512i __D)
230b57cec5SDimitry Andric {
240b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_compresshi512_mask ((__v32hi) __D,
250b57cec5SDimitry Andric               (__v32hi) __S,
260b57cec5SDimitry Andric               __U);
270b57cec5SDimitry Andric }
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
300b57cec5SDimitry Andric _mm512_maskz_compress_epi16(__mmask32 __U, __m512i __D)
310b57cec5SDimitry Andric {
320b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_compresshi512_mask ((__v32hi) __D,
330b57cec5SDimitry Andric               (__v32hi) _mm512_setzero_si512(),
340b57cec5SDimitry Andric               __U);
350b57cec5SDimitry Andric }
360b57cec5SDimitry Andric 
370b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
380b57cec5SDimitry Andric _mm512_mask_compress_epi8(__m512i __S, __mmask64 __U, __m512i __D)
390b57cec5SDimitry Andric {
400b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_compressqi512_mask ((__v64qi) __D,
410b57cec5SDimitry Andric               (__v64qi) __S,
420b57cec5SDimitry Andric               __U);
430b57cec5SDimitry Andric }
440b57cec5SDimitry Andric 
450b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
460b57cec5SDimitry Andric _mm512_maskz_compress_epi8(__mmask64 __U, __m512i __D)
470b57cec5SDimitry Andric {
480b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_compressqi512_mask ((__v64qi) __D,
490b57cec5SDimitry Andric               (__v64qi) _mm512_setzero_si512(),
500b57cec5SDimitry Andric               __U);
510b57cec5SDimitry Andric }
520b57cec5SDimitry Andric 
530b57cec5SDimitry Andric static __inline__ void __DEFAULT_FN_ATTRS
540b57cec5SDimitry Andric _mm512_mask_compressstoreu_epi16(void *__P, __mmask32 __U, __m512i __D)
550b57cec5SDimitry Andric {
560b57cec5SDimitry Andric   __builtin_ia32_compressstorehi512_mask ((__v32hi *) __P, (__v32hi) __D,
570b57cec5SDimitry Andric               __U);
580b57cec5SDimitry Andric }
590b57cec5SDimitry Andric 
600b57cec5SDimitry Andric static __inline__ void __DEFAULT_FN_ATTRS
610b57cec5SDimitry Andric _mm512_mask_compressstoreu_epi8(void *__P, __mmask64 __U, __m512i __D)
620b57cec5SDimitry Andric {
630b57cec5SDimitry Andric   __builtin_ia32_compressstoreqi512_mask ((__v64qi *) __P, (__v64qi) __D,
640b57cec5SDimitry Andric               __U);
650b57cec5SDimitry Andric }
660b57cec5SDimitry Andric 
670b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
680b57cec5SDimitry Andric _mm512_mask_expand_epi16(__m512i __S, __mmask32 __U, __m512i __D)
690b57cec5SDimitry Andric {
700b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_expandhi512_mask ((__v32hi) __D,
710b57cec5SDimitry Andric               (__v32hi) __S,
720b57cec5SDimitry Andric               __U);
730b57cec5SDimitry Andric }
740b57cec5SDimitry Andric 
750b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
760b57cec5SDimitry Andric _mm512_maskz_expand_epi16(__mmask32 __U, __m512i __D)
770b57cec5SDimitry Andric {
780b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_expandhi512_mask ((__v32hi) __D,
790b57cec5SDimitry Andric               (__v32hi) _mm512_setzero_si512(),
800b57cec5SDimitry Andric               __U);
810b57cec5SDimitry Andric }
820b57cec5SDimitry Andric 
830b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
840b57cec5SDimitry Andric _mm512_mask_expand_epi8(__m512i __S, __mmask64 __U, __m512i __D)
850b57cec5SDimitry Andric {
860b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_expandqi512_mask ((__v64qi) __D,
870b57cec5SDimitry Andric               (__v64qi) __S,
880b57cec5SDimitry Andric               __U);
890b57cec5SDimitry Andric }
900b57cec5SDimitry Andric 
910b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
920b57cec5SDimitry Andric _mm512_maskz_expand_epi8(__mmask64 __U, __m512i __D)
930b57cec5SDimitry Andric {
940b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_expandqi512_mask ((__v64qi) __D,
950b57cec5SDimitry Andric               (__v64qi) _mm512_setzero_si512(),
960b57cec5SDimitry Andric               __U);
970b57cec5SDimitry Andric }
980b57cec5SDimitry Andric 
990b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
1000b57cec5SDimitry Andric _mm512_mask_expandloadu_epi16(__m512i __S, __mmask32 __U, void const *__P)
1010b57cec5SDimitry Andric {
1020b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_expandloadhi512_mask ((const __v32hi *)__P,
1030b57cec5SDimitry Andric               (__v32hi) __S,
1040b57cec5SDimitry Andric               __U);
1050b57cec5SDimitry Andric }
1060b57cec5SDimitry Andric 
1070b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
1080b57cec5SDimitry Andric _mm512_maskz_expandloadu_epi16(__mmask32 __U, void const *__P)
1090b57cec5SDimitry Andric {
1100b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_expandloadhi512_mask ((const __v32hi *)__P,
1110b57cec5SDimitry Andric               (__v32hi) _mm512_setzero_si512(),
1120b57cec5SDimitry Andric               __U);
1130b57cec5SDimitry Andric }
1140b57cec5SDimitry Andric 
1150b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
1160b57cec5SDimitry Andric _mm512_mask_expandloadu_epi8(__m512i __S, __mmask64 __U, void const *__P)
1170b57cec5SDimitry Andric {
1180b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_expandloadqi512_mask ((const __v64qi *)__P,
1190b57cec5SDimitry Andric               (__v64qi) __S,
1200b57cec5SDimitry Andric               __U);
1210b57cec5SDimitry Andric }
1220b57cec5SDimitry Andric 
1230b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
1240b57cec5SDimitry Andric _mm512_maskz_expandloadu_epi8(__mmask64 __U, void const *__P)
1250b57cec5SDimitry Andric {
1260b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_expandloadqi512_mask ((const __v64qi *)__P,
1270b57cec5SDimitry Andric               (__v64qi) _mm512_setzero_si512(),
1280b57cec5SDimitry Andric               __U);
1290b57cec5SDimitry Andric }
1300b57cec5SDimitry Andric 
1310b57cec5SDimitry Andric #define _mm512_shldi_epi64(A, B, I) \
132349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_vpshldq512((__v8di)(__m512i)(A), \
133349cc55cSDimitry Andric                                       (__v8di)(__m512i)(B), (int)(I)))
1340b57cec5SDimitry Andric 
1350b57cec5SDimitry Andric #define _mm512_mask_shldi_epi64(S, U, A, B, I) \
136349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectq_512((__mmask8)(U), \
1370b57cec5SDimitry Andric                                      (__v8di)_mm512_shldi_epi64((A), (B), (I)), \
138349cc55cSDimitry Andric                                      (__v8di)(__m512i)(S)))
1390b57cec5SDimitry Andric 
1400b57cec5SDimitry Andric #define _mm512_maskz_shldi_epi64(U, A, B, I) \
141349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectq_512((__mmask8)(U), \
1420b57cec5SDimitry Andric                                      (__v8di)_mm512_shldi_epi64((A), (B), (I)), \
143349cc55cSDimitry Andric                                      (__v8di)_mm512_setzero_si512()))
1440b57cec5SDimitry Andric 
1450b57cec5SDimitry Andric #define _mm512_shldi_epi32(A, B, I) \
146349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_vpshldd512((__v16si)(__m512i)(A), \
147349cc55cSDimitry Andric                                       (__v16si)(__m512i)(B), (int)(I)))
1480b57cec5SDimitry Andric 
1490b57cec5SDimitry Andric #define _mm512_mask_shldi_epi32(S, U, A, B, I) \
150349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
1510b57cec5SDimitry Andric                                     (__v16si)_mm512_shldi_epi32((A), (B), (I)), \
152349cc55cSDimitry Andric                                     (__v16si)(__m512i)(S)))
1530b57cec5SDimitry Andric 
1540b57cec5SDimitry Andric #define _mm512_maskz_shldi_epi32(U, A, B, I) \
155349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
1560b57cec5SDimitry Andric                                     (__v16si)_mm512_shldi_epi32((A), (B), (I)), \
157349cc55cSDimitry Andric                                     (__v16si)_mm512_setzero_si512()))
1580b57cec5SDimitry Andric 
1590b57cec5SDimitry Andric #define _mm512_shldi_epi16(A, B, I) \
160349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_vpshldw512((__v32hi)(__m512i)(A), \
161349cc55cSDimitry Andric                                       (__v32hi)(__m512i)(B), (int)(I)))
1620b57cec5SDimitry Andric 
1630b57cec5SDimitry Andric #define _mm512_mask_shldi_epi16(S, U, A, B, I) \
164349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
1650b57cec5SDimitry Andric                                     (__v32hi)_mm512_shldi_epi16((A), (B), (I)), \
166349cc55cSDimitry Andric                                     (__v32hi)(__m512i)(S)))
1670b57cec5SDimitry Andric 
1680b57cec5SDimitry Andric #define _mm512_maskz_shldi_epi16(U, A, B, I) \
169349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
1700b57cec5SDimitry Andric                                     (__v32hi)_mm512_shldi_epi16((A), (B), (I)), \
171349cc55cSDimitry Andric                                     (__v32hi)_mm512_setzero_si512()))
1720b57cec5SDimitry Andric 
1730b57cec5SDimitry Andric #define _mm512_shrdi_epi64(A, B, I) \
174349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_vpshrdq512((__v8di)(__m512i)(A), \
175349cc55cSDimitry Andric                                       (__v8di)(__m512i)(B), (int)(I)))
1760b57cec5SDimitry Andric 
1770b57cec5SDimitry Andric #define _mm512_mask_shrdi_epi64(S, U, A, B, I) \
178349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectq_512((__mmask8)(U), \
1790b57cec5SDimitry Andric                                      (__v8di)_mm512_shrdi_epi64((A), (B), (I)), \
180349cc55cSDimitry Andric                                      (__v8di)(__m512i)(S)))
1810b57cec5SDimitry Andric 
1820b57cec5SDimitry Andric #define _mm512_maskz_shrdi_epi64(U, A, B, I) \
183349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectq_512((__mmask8)(U), \
1840b57cec5SDimitry Andric                                      (__v8di)_mm512_shrdi_epi64((A), (B), (I)), \
185349cc55cSDimitry Andric                                      (__v8di)_mm512_setzero_si512()))
1860b57cec5SDimitry Andric 
1870b57cec5SDimitry Andric #define _mm512_shrdi_epi32(A, B, I) \
188349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_vpshrdd512((__v16si)(__m512i)(A), \
189349cc55cSDimitry Andric                                       (__v16si)(__m512i)(B), (int)(I)))
1900b57cec5SDimitry Andric 
1910b57cec5SDimitry Andric #define _mm512_mask_shrdi_epi32(S, U, A, B, I) \
192349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
1930b57cec5SDimitry Andric                                     (__v16si)_mm512_shrdi_epi32((A), (B), (I)), \
194349cc55cSDimitry Andric                                     (__v16si)(__m512i)(S)))
1950b57cec5SDimitry Andric 
1960b57cec5SDimitry Andric #define _mm512_maskz_shrdi_epi32(U, A, B, I) \
197349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
1980b57cec5SDimitry Andric                                     (__v16si)_mm512_shrdi_epi32((A), (B), (I)), \
199349cc55cSDimitry Andric                                     (__v16si)_mm512_setzero_si512()))
2000b57cec5SDimitry Andric 
2010b57cec5SDimitry Andric #define _mm512_shrdi_epi16(A, B, I) \
202349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_vpshrdw512((__v32hi)(__m512i)(A), \
203349cc55cSDimitry Andric                                       (__v32hi)(__m512i)(B), (int)(I)))
2040b57cec5SDimitry Andric 
2050b57cec5SDimitry Andric #define _mm512_mask_shrdi_epi16(S, U, A, B, I) \
206349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
2070b57cec5SDimitry Andric                                     (__v32hi)_mm512_shrdi_epi16((A), (B), (I)), \
208349cc55cSDimitry Andric                                     (__v32hi)(__m512i)(S)))
2090b57cec5SDimitry Andric 
2100b57cec5SDimitry Andric #define _mm512_maskz_shrdi_epi16(U, A, B, I) \
211349cc55cSDimitry Andric   ((__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
2120b57cec5SDimitry Andric                                     (__v32hi)_mm512_shrdi_epi16((A), (B), (I)), \
213349cc55cSDimitry Andric                                     (__v32hi)_mm512_setzero_si512()))
2140b57cec5SDimitry Andric 
2150b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
2160b57cec5SDimitry Andric _mm512_shldv_epi64(__m512i __A, __m512i __B, __m512i __C)
2170b57cec5SDimitry Andric {
2180b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_vpshldvq512((__v8di)__A, (__v8di)__B,
2190b57cec5SDimitry Andric                                              (__v8di)__C);
2200b57cec5SDimitry Andric }
2210b57cec5SDimitry Andric 
2220b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
2230b57cec5SDimitry Andric _mm512_mask_shldv_epi64(__m512i __A, __mmask8 __U, __m512i __B, __m512i __C)
2240b57cec5SDimitry Andric {
2250b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectq_512(__U,
2260b57cec5SDimitry Andric                                       (__v8di)_mm512_shldv_epi64(__A, __B, __C),
2270b57cec5SDimitry Andric                                       (__v8di)__A);
2280b57cec5SDimitry Andric }
2290b57cec5SDimitry Andric 
2300b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
2310b57cec5SDimitry Andric _mm512_maskz_shldv_epi64(__mmask8 __U, __m512i __A, __m512i __B, __m512i __C)
2320b57cec5SDimitry Andric {
2330b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectq_512(__U,
2340b57cec5SDimitry Andric                                       (__v8di)_mm512_shldv_epi64(__A, __B, __C),
2350b57cec5SDimitry Andric                                       (__v8di)_mm512_setzero_si512());
2360b57cec5SDimitry Andric }
2370b57cec5SDimitry Andric 
2380b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
2390b57cec5SDimitry Andric _mm512_shldv_epi32(__m512i __A, __m512i __B, __m512i __C)
2400b57cec5SDimitry Andric {
2410b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_vpshldvd512((__v16si)__A, (__v16si)__B,
2420b57cec5SDimitry Andric                                              (__v16si)__C);
2430b57cec5SDimitry Andric }
2440b57cec5SDimitry Andric 
2450b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
2460b57cec5SDimitry Andric _mm512_mask_shldv_epi32(__m512i __A, __mmask16 __U, __m512i __B, __m512i __C)
2470b57cec5SDimitry Andric {
2480b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectd_512(__U,
2490b57cec5SDimitry Andric                                      (__v16si)_mm512_shldv_epi32(__A, __B, __C),
2500b57cec5SDimitry Andric                                      (__v16si)__A);
2510b57cec5SDimitry Andric }
2520b57cec5SDimitry Andric 
2530b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
2540b57cec5SDimitry Andric _mm512_maskz_shldv_epi32(__mmask16 __U, __m512i __A, __m512i __B, __m512i __C)
2550b57cec5SDimitry Andric {
2560b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectd_512(__U,
2570b57cec5SDimitry Andric                                      (__v16si)_mm512_shldv_epi32(__A, __B, __C),
2580b57cec5SDimitry Andric                                      (__v16si)_mm512_setzero_si512());
2590b57cec5SDimitry Andric }
2600b57cec5SDimitry Andric 
2610b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
2620b57cec5SDimitry Andric _mm512_shldv_epi16(__m512i __A, __m512i __B, __m512i __C)
2630b57cec5SDimitry Andric {
2640b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_vpshldvw512((__v32hi)__A, (__v32hi)__B,
2650b57cec5SDimitry Andric                                              (__v32hi)__C);
2660b57cec5SDimitry Andric }
2670b57cec5SDimitry Andric 
2680b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
2690b57cec5SDimitry Andric _mm512_mask_shldv_epi16(__m512i __A, __mmask32 __U, __m512i __B, __m512i __C)
2700b57cec5SDimitry Andric {
2710b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectw_512(__U,
2720b57cec5SDimitry Andric                                      (__v32hi)_mm512_shldv_epi16(__A, __B, __C),
2730b57cec5SDimitry Andric                                      (__v32hi)__A);
2740b57cec5SDimitry Andric }
2750b57cec5SDimitry Andric 
2760b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
2770b57cec5SDimitry Andric _mm512_maskz_shldv_epi16(__mmask32 __U, __m512i __A, __m512i __B, __m512i __C)
2780b57cec5SDimitry Andric {
2790b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectw_512(__U,
2800b57cec5SDimitry Andric                                      (__v32hi)_mm512_shldv_epi16(__A, __B, __C),
2810b57cec5SDimitry Andric                                      (__v32hi)_mm512_setzero_si512());
2820b57cec5SDimitry Andric }
2830b57cec5SDimitry Andric 
2840b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
2850b57cec5SDimitry Andric _mm512_shrdv_epi64(__m512i __A, __m512i __B, __m512i __C)
2860b57cec5SDimitry Andric {
2870b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_vpshrdvq512((__v8di)__A, (__v8di)__B,
2880b57cec5SDimitry Andric                                              (__v8di)__C);
2890b57cec5SDimitry Andric }
2900b57cec5SDimitry Andric 
2910b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
2920b57cec5SDimitry Andric _mm512_mask_shrdv_epi64(__m512i __A, __mmask8 __U, __m512i __B, __m512i __C)
2930b57cec5SDimitry Andric {
2940b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectq_512(__U,
2950b57cec5SDimitry Andric                                       (__v8di)_mm512_shrdv_epi64(__A, __B, __C),
2960b57cec5SDimitry Andric                                       (__v8di)__A);
2970b57cec5SDimitry Andric }
2980b57cec5SDimitry Andric 
2990b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
3000b57cec5SDimitry Andric _mm512_maskz_shrdv_epi64(__mmask8 __U, __m512i __A, __m512i __B, __m512i __C)
3010b57cec5SDimitry Andric {
3020b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectq_512(__U,
3030b57cec5SDimitry Andric                                       (__v8di)_mm512_shrdv_epi64(__A, __B, __C),
3040b57cec5SDimitry Andric                                       (__v8di)_mm512_setzero_si512());
3050b57cec5SDimitry Andric }
3060b57cec5SDimitry Andric 
3070b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
3080b57cec5SDimitry Andric _mm512_shrdv_epi32(__m512i __A, __m512i __B, __m512i __C)
3090b57cec5SDimitry Andric {
3100b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_vpshrdvd512((__v16si)__A, (__v16si)__B,
3110b57cec5SDimitry Andric                                              (__v16si)__C);
3120b57cec5SDimitry Andric }
3130b57cec5SDimitry Andric 
3140b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
3150b57cec5SDimitry Andric _mm512_mask_shrdv_epi32(__m512i __A, __mmask16 __U, __m512i __B, __m512i __C)
3160b57cec5SDimitry Andric {
3170b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_selectd_512(__U,
3180b57cec5SDimitry Andric                                      (__v16si)_mm512_shrdv_epi32(__A, __B, __C),
3190b57cec5SDimitry Andric                                      (__v16si)__A);
3200b57cec5SDimitry Andric }
3210b57cec5SDimitry Andric 
3220b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
3230b57cec5SDimitry Andric _mm512_maskz_shrdv_epi32(__mmask16 __U, __m512i __A, __m512i __B, __m512i __C)
3240b57cec5SDimitry Andric {
3250b57cec5SDimitry Andric   return (__m512i) __builtin_ia32_selectd_512(__U,
3260b57cec5SDimitry Andric                                      (__v16si)_mm512_shrdv_epi32(__A, __B, __C),
3270b57cec5SDimitry Andric                                      (__v16si)_mm512_setzero_si512());
3280b57cec5SDimitry Andric }
3290b57cec5SDimitry Andric 
3300b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
3310b57cec5SDimitry Andric _mm512_shrdv_epi16(__m512i __A, __m512i __B, __m512i __C)
3320b57cec5SDimitry Andric {
3330b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_vpshrdvw512((__v32hi)__A, (__v32hi)__B,
3340b57cec5SDimitry Andric                                              (__v32hi)__C);
3350b57cec5SDimitry Andric }
3360b57cec5SDimitry Andric 
3370b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
3380b57cec5SDimitry Andric _mm512_mask_shrdv_epi16(__m512i __A, __mmask32 __U, __m512i __B, __m512i __C)
3390b57cec5SDimitry Andric {
3400b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectw_512(__U,
3410b57cec5SDimitry Andric                                      (__v32hi)_mm512_shrdv_epi16(__A, __B, __C),
3420b57cec5SDimitry Andric                                      (__v32hi)__A);
3430b57cec5SDimitry Andric }
3440b57cec5SDimitry Andric 
3450b57cec5SDimitry Andric static __inline__ __m512i __DEFAULT_FN_ATTRS
3460b57cec5SDimitry Andric _mm512_maskz_shrdv_epi16(__mmask32 __U, __m512i __A, __m512i __B, __m512i __C)
3470b57cec5SDimitry Andric {
3480b57cec5SDimitry Andric   return (__m512i)__builtin_ia32_selectw_512(__U,
3490b57cec5SDimitry Andric                                      (__v32hi)_mm512_shrdv_epi16(__A, __B, __C),
3500b57cec5SDimitry Andric                                      (__v32hi)_mm512_setzero_si512());
3510b57cec5SDimitry Andric }
3520b57cec5SDimitry Andric 
3530b57cec5SDimitry Andric 
3540b57cec5SDimitry Andric #undef __DEFAULT_FN_ATTRS
3550b57cec5SDimitry Andric 
3560b57cec5SDimitry Andric #endif
3570b57cec5SDimitry Andric 
358