[clang-format] Fix a bug in aligning comments above PPDirective (#72791)
[llvm-project.git] / clang / lib / Headers / avx512vbmivlintrin.h
blob848ca2d18c3cea51c177307abf2fbbb7fbfe1be6
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 *===-----------------------------------------------------------------------===
9 */
10 #ifndef __IMMINTRIN_H
11 #error "Never use <avx512vbmivlintrin.h> directly; include <immintrin.h> instead."
12 #endif
14 #ifndef __VBMIVLINTRIN_H
15 #define __VBMIVLINTRIN_H
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS128 \
19 __attribute__((__always_inline__, __nodebug__, \
20 __target__("avx512vbmi,avx512vl,no-evex512"), \
21 __min_vector_width__(128)))
22 #define __DEFAULT_FN_ATTRS256 \
23 __attribute__((__always_inline__, __nodebug__, \
24 __target__("avx512vbmi,avx512vl,no-evex512"), \
25 __min_vector_width__(256)))
27 static __inline__ __m128i __DEFAULT_FN_ATTRS128
28 _mm_permutex2var_epi8(__m128i __A, __m128i __I, __m128i __B)
30 return (__m128i)__builtin_ia32_vpermi2varqi128((__v16qi)__A,
31 (__v16qi)__I,
32 (__v16qi)__B);
35 static __inline__ __m128i __DEFAULT_FN_ATTRS128
36 _mm_mask_permutex2var_epi8(__m128i __A, __mmask16 __U, __m128i __I,
37 __m128i __B)
39 return (__m128i)__builtin_ia32_selectb_128(__U,
40 (__v16qi)_mm_permutex2var_epi8(__A, __I, __B),
41 (__v16qi)__A);
44 static __inline__ __m128i __DEFAULT_FN_ATTRS128
45 _mm_mask2_permutex2var_epi8(__m128i __A, __m128i __I, __mmask16 __U,
46 __m128i __B)
48 return (__m128i)__builtin_ia32_selectb_128(__U,
49 (__v16qi)_mm_permutex2var_epi8(__A, __I, __B),
50 (__v16qi)__I);
53 static __inline__ __m128i __DEFAULT_FN_ATTRS128
54 _mm_maskz_permutex2var_epi8(__mmask16 __U, __m128i __A, __m128i __I,
55 __m128i __B)
57 return (__m128i)__builtin_ia32_selectb_128(__U,
58 (__v16qi)_mm_permutex2var_epi8(__A, __I, __B),
59 (__v16qi)_mm_setzero_si128());
62 static __inline__ __m256i __DEFAULT_FN_ATTRS256
63 _mm256_permutex2var_epi8(__m256i __A, __m256i __I, __m256i __B)
65 return (__m256i)__builtin_ia32_vpermi2varqi256((__v32qi)__A, (__v32qi)__I,
66 (__v32qi)__B);
69 static __inline__ __m256i __DEFAULT_FN_ATTRS256
70 _mm256_mask_permutex2var_epi8(__m256i __A, __mmask32 __U, __m256i __I,
71 __m256i __B)
73 return (__m256i)__builtin_ia32_selectb_256(__U,
74 (__v32qi)_mm256_permutex2var_epi8(__A, __I, __B),
75 (__v32qi)__A);
78 static __inline__ __m256i __DEFAULT_FN_ATTRS256
79 _mm256_mask2_permutex2var_epi8(__m256i __A, __m256i __I, __mmask32 __U,
80 __m256i __B)
82 return (__m256i)__builtin_ia32_selectb_256(__U,
83 (__v32qi)_mm256_permutex2var_epi8(__A, __I, __B),
84 (__v32qi)__I);
87 static __inline__ __m256i __DEFAULT_FN_ATTRS256
88 _mm256_maskz_permutex2var_epi8(__mmask32 __U, __m256i __A, __m256i __I,
89 __m256i __B)
91 return (__m256i)__builtin_ia32_selectb_256(__U,
92 (__v32qi)_mm256_permutex2var_epi8(__A, __I, __B),
93 (__v32qi)_mm256_setzero_si256());
96 static __inline__ __m128i __DEFAULT_FN_ATTRS128
97 _mm_permutexvar_epi8 (__m128i __A, __m128i __B)
99 return (__m128i)__builtin_ia32_permvarqi128((__v16qi)__B, (__v16qi)__A);
102 static __inline__ __m128i __DEFAULT_FN_ATTRS128
103 _mm_maskz_permutexvar_epi8 (__mmask16 __M, __m128i __A, __m128i __B)
105 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
106 (__v16qi)_mm_permutexvar_epi8(__A, __B),
107 (__v16qi)_mm_setzero_si128());
110 static __inline__ __m128i __DEFAULT_FN_ATTRS128
111 _mm_mask_permutexvar_epi8 (__m128i __W, __mmask16 __M, __m128i __A,
112 __m128i __B)
114 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
115 (__v16qi)_mm_permutexvar_epi8(__A, __B),
116 (__v16qi)__W);
119 static __inline__ __m256i __DEFAULT_FN_ATTRS256
120 _mm256_permutexvar_epi8 (__m256i __A, __m256i __B)
122 return (__m256i)__builtin_ia32_permvarqi256((__v32qi) __B, (__v32qi) __A);
125 static __inline__ __m256i __DEFAULT_FN_ATTRS256
126 _mm256_maskz_permutexvar_epi8 (__mmask32 __M, __m256i __A,
127 __m256i __B)
129 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
130 (__v32qi)_mm256_permutexvar_epi8(__A, __B),
131 (__v32qi)_mm256_setzero_si256());
134 static __inline__ __m256i __DEFAULT_FN_ATTRS256
135 _mm256_mask_permutexvar_epi8 (__m256i __W, __mmask32 __M, __m256i __A,
136 __m256i __B)
138 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
139 (__v32qi)_mm256_permutexvar_epi8(__A, __B),
140 (__v32qi)__W);
143 static __inline__ __m128i __DEFAULT_FN_ATTRS128
144 _mm_multishift_epi64_epi8(__m128i __X, __m128i __Y)
146 return (__m128i)__builtin_ia32_vpmultishiftqb128((__v16qi)__X, (__v16qi)__Y);
149 static __inline__ __m128i __DEFAULT_FN_ATTRS128
150 _mm_mask_multishift_epi64_epi8(__m128i __W, __mmask16 __M, __m128i __X,
151 __m128i __Y)
153 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
154 (__v16qi)_mm_multishift_epi64_epi8(__X, __Y),
155 (__v16qi)__W);
158 static __inline__ __m128i __DEFAULT_FN_ATTRS128
159 _mm_maskz_multishift_epi64_epi8(__mmask16 __M, __m128i __X, __m128i __Y)
161 return (__m128i)__builtin_ia32_selectb_128((__mmask16)__M,
162 (__v16qi)_mm_multishift_epi64_epi8(__X, __Y),
163 (__v16qi)_mm_setzero_si128());
166 static __inline__ __m256i __DEFAULT_FN_ATTRS256
167 _mm256_multishift_epi64_epi8(__m256i __X, __m256i __Y)
169 return (__m256i)__builtin_ia32_vpmultishiftqb256((__v32qi)__X, (__v32qi)__Y);
172 static __inline__ __m256i __DEFAULT_FN_ATTRS256
173 _mm256_mask_multishift_epi64_epi8(__m256i __W, __mmask32 __M, __m256i __X,
174 __m256i __Y)
176 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
177 (__v32qi)_mm256_multishift_epi64_epi8(__X, __Y),
178 (__v32qi)__W);
181 static __inline__ __m256i __DEFAULT_FN_ATTRS256
182 _mm256_maskz_multishift_epi64_epi8(__mmask32 __M, __m256i __X, __m256i __Y)
184 return (__m256i)__builtin_ia32_selectb_256((__mmask32)__M,
185 (__v32qi)_mm256_multishift_epi64_epi8(__X, __Y),
186 (__v32qi)_mm256_setzero_si256());
190 #undef __DEFAULT_FN_ATTRS128
191 #undef __DEFAULT_FN_ATTRS256
193 #endif