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 __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi,avx512vl"), __min_vector_width__(128)))
19 #define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi,avx512vl"), __min_vector_width__(256)))
22 static __inline__ __m128i __DEFAULT_FN_ATTRS128
23 _mm_permutex2var_epi8(__m128i __A
, __m128i __I
, __m128i __B
)
25 return (__m128i
)__builtin_ia32_vpermi2varqi128((__v16qi
)__A
,
30 static __inline__ __m128i __DEFAULT_FN_ATTRS128
31 _mm_mask_permutex2var_epi8(__m128i __A
, __mmask16 __U
, __m128i __I
,
34 return (__m128i
)__builtin_ia32_selectb_128(__U
,
35 (__v16qi
)_mm_permutex2var_epi8(__A
, __I
, __B
),
39 static __inline__ __m128i __DEFAULT_FN_ATTRS128
40 _mm_mask2_permutex2var_epi8(__m128i __A
, __m128i __I
, __mmask16 __U
,
43 return (__m128i
)__builtin_ia32_selectb_128(__U
,
44 (__v16qi
)_mm_permutex2var_epi8(__A
, __I
, __B
),
48 static __inline__ __m128i __DEFAULT_FN_ATTRS128
49 _mm_maskz_permutex2var_epi8(__mmask16 __U
, __m128i __A
, __m128i __I
,
52 return (__m128i
)__builtin_ia32_selectb_128(__U
,
53 (__v16qi
)_mm_permutex2var_epi8(__A
, __I
, __B
),
54 (__v16qi
)_mm_setzero_si128());
57 static __inline__ __m256i __DEFAULT_FN_ATTRS256
58 _mm256_permutex2var_epi8(__m256i __A
, __m256i __I
, __m256i __B
)
60 return (__m256i
)__builtin_ia32_vpermi2varqi256((__v32qi
)__A
, (__v32qi
)__I
,
64 static __inline__ __m256i __DEFAULT_FN_ATTRS256
65 _mm256_mask_permutex2var_epi8(__m256i __A
, __mmask32 __U
, __m256i __I
,
68 return (__m256i
)__builtin_ia32_selectb_256(__U
,
69 (__v32qi
)_mm256_permutex2var_epi8(__A
, __I
, __B
),
73 static __inline__ __m256i __DEFAULT_FN_ATTRS256
74 _mm256_mask2_permutex2var_epi8(__m256i __A
, __m256i __I
, __mmask32 __U
,
77 return (__m256i
)__builtin_ia32_selectb_256(__U
,
78 (__v32qi
)_mm256_permutex2var_epi8(__A
, __I
, __B
),
82 static __inline__ __m256i __DEFAULT_FN_ATTRS256
83 _mm256_maskz_permutex2var_epi8(__mmask32 __U
, __m256i __A
, __m256i __I
,
86 return (__m256i
)__builtin_ia32_selectb_256(__U
,
87 (__v32qi
)_mm256_permutex2var_epi8(__A
, __I
, __B
),
88 (__v32qi
)_mm256_setzero_si256());
91 static __inline__ __m128i __DEFAULT_FN_ATTRS128
92 _mm_permutexvar_epi8 (__m128i __A
, __m128i __B
)
94 return (__m128i
)__builtin_ia32_permvarqi128((__v16qi
)__B
, (__v16qi
)__A
);
97 static __inline__ __m128i __DEFAULT_FN_ATTRS128
98 _mm_maskz_permutexvar_epi8 (__mmask16 __M
, __m128i __A
, __m128i __B
)
100 return (__m128i
)__builtin_ia32_selectb_128((__mmask16
)__M
,
101 (__v16qi
)_mm_permutexvar_epi8(__A
, __B
),
102 (__v16qi
)_mm_setzero_si128());
105 static __inline__ __m128i __DEFAULT_FN_ATTRS128
106 _mm_mask_permutexvar_epi8 (__m128i __W
, __mmask16 __M
, __m128i __A
,
109 return (__m128i
)__builtin_ia32_selectb_128((__mmask16
)__M
,
110 (__v16qi
)_mm_permutexvar_epi8(__A
, __B
),
114 static __inline__ __m256i __DEFAULT_FN_ATTRS256
115 _mm256_permutexvar_epi8 (__m256i __A
, __m256i __B
)
117 return (__m256i
)__builtin_ia32_permvarqi256((__v32qi
) __B
, (__v32qi
) __A
);
120 static __inline__ __m256i __DEFAULT_FN_ATTRS256
121 _mm256_maskz_permutexvar_epi8 (__mmask32 __M
, __m256i __A
,
124 return (__m256i
)__builtin_ia32_selectb_256((__mmask32
)__M
,
125 (__v32qi
)_mm256_permutexvar_epi8(__A
, __B
),
126 (__v32qi
)_mm256_setzero_si256());
129 static __inline__ __m256i __DEFAULT_FN_ATTRS256
130 _mm256_mask_permutexvar_epi8 (__m256i __W
, __mmask32 __M
, __m256i __A
,
133 return (__m256i
)__builtin_ia32_selectb_256((__mmask32
)__M
,
134 (__v32qi
)_mm256_permutexvar_epi8(__A
, __B
),
138 static __inline__ __m128i __DEFAULT_FN_ATTRS128
139 _mm_multishift_epi64_epi8(__m128i __X
, __m128i __Y
)
141 return (__m128i
)__builtin_ia32_vpmultishiftqb128((__v16qi
)__X
, (__v16qi
)__Y
);
144 static __inline__ __m128i __DEFAULT_FN_ATTRS128
145 _mm_mask_multishift_epi64_epi8(__m128i __W
, __mmask16 __M
, __m128i __X
,
148 return (__m128i
)__builtin_ia32_selectb_128((__mmask16
)__M
,
149 (__v16qi
)_mm_multishift_epi64_epi8(__X
, __Y
),
153 static __inline__ __m128i __DEFAULT_FN_ATTRS128
154 _mm_maskz_multishift_epi64_epi8(__mmask16 __M
, __m128i __X
, __m128i __Y
)
156 return (__m128i
)__builtin_ia32_selectb_128((__mmask16
)__M
,
157 (__v16qi
)_mm_multishift_epi64_epi8(__X
, __Y
),
158 (__v16qi
)_mm_setzero_si128());
161 static __inline__ __m256i __DEFAULT_FN_ATTRS256
162 _mm256_multishift_epi64_epi8(__m256i __X
, __m256i __Y
)
164 return (__m256i
)__builtin_ia32_vpmultishiftqb256((__v32qi
)__X
, (__v32qi
)__Y
);
167 static __inline__ __m256i __DEFAULT_FN_ATTRS256
168 _mm256_mask_multishift_epi64_epi8(__m256i __W
, __mmask32 __M
, __m256i __X
,
171 return (__m256i
)__builtin_ia32_selectb_256((__mmask32
)__M
,
172 (__v32qi
)_mm256_multishift_epi64_epi8(__X
, __Y
),
176 static __inline__ __m256i __DEFAULT_FN_ATTRS256
177 _mm256_maskz_multishift_epi64_epi8(__mmask32 __M
, __m256i __X
, __m256i __Y
)
179 return (__m256i
)__builtin_ia32_selectb_256((__mmask32
)__M
,
180 (__v32qi
)_mm256_multishift_epi64_epi8(__X
, __Y
),
181 (__v32qi
)_mm256_setzero_si256());
185 #undef __DEFAULT_FN_ATTRS128
186 #undef __DEFAULT_FN_ATTRS256