1 /*===---- avx2intrin.h - AVX2 intrinsics -----------------------------------===
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 *===-----------------------------------------------------------------------===
11 #error "Never use <avx2intrin.h> directly; include <immintrin.h> instead."
14 #ifndef __AVX2INTRIN_H
15 #define __AVX2INTRIN_H
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("avx2"), __min_vector_width__(256)))
19 #define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("avx2"), __min_vector_width__(128)))
21 /* SSE4 Multiple Packed Sums of Absolute Difference. */
22 #define _mm256_mpsadbw_epu8(X, Y, M) \
23 ((__m256i)__builtin_ia32_mpsadbw256((__v32qi)(__m256i)(X), \
24 (__v32qi)(__m256i)(Y), (int)(M)))
26 static __inline__ __m256i __DEFAULT_FN_ATTRS256
27 _mm256_abs_epi8(__m256i __a
)
29 return (__m256i
)__builtin_elementwise_abs((__v32qs
)__a
);
32 static __inline__ __m256i __DEFAULT_FN_ATTRS256
33 _mm256_abs_epi16(__m256i __a
)
35 return (__m256i
)__builtin_elementwise_abs((__v16hi
)__a
);
38 static __inline__ __m256i __DEFAULT_FN_ATTRS256
39 _mm256_abs_epi32(__m256i __a
)
41 return (__m256i
)__builtin_elementwise_abs((__v8si
)__a
);
44 static __inline__ __m256i __DEFAULT_FN_ATTRS256
45 _mm256_packs_epi16(__m256i __a
, __m256i __b
)
47 return (__m256i
)__builtin_ia32_packsswb256((__v16hi
)__a
, (__v16hi
)__b
);
50 static __inline__ __m256i __DEFAULT_FN_ATTRS256
51 _mm256_packs_epi32(__m256i __a
, __m256i __b
)
53 return (__m256i
)__builtin_ia32_packssdw256((__v8si
)__a
, (__v8si
)__b
);
56 static __inline__ __m256i __DEFAULT_FN_ATTRS256
57 _mm256_packus_epi16(__m256i __a
, __m256i __b
)
59 return (__m256i
)__builtin_ia32_packuswb256((__v16hi
)__a
, (__v16hi
)__b
);
62 static __inline__ __m256i __DEFAULT_FN_ATTRS256
63 _mm256_packus_epi32(__m256i __V1
, __m256i __V2
)
65 return (__m256i
) __builtin_ia32_packusdw256((__v8si
)__V1
, (__v8si
)__V2
);
68 static __inline__ __m256i __DEFAULT_FN_ATTRS256
69 _mm256_add_epi8(__m256i __a
, __m256i __b
)
71 return (__m256i
)((__v32qu
)__a
+ (__v32qu
)__b
);
74 static __inline__ __m256i __DEFAULT_FN_ATTRS256
75 _mm256_add_epi16(__m256i __a
, __m256i __b
)
77 return (__m256i
)((__v16hu
)__a
+ (__v16hu
)__b
);
80 static __inline__ __m256i __DEFAULT_FN_ATTRS256
81 _mm256_add_epi32(__m256i __a
, __m256i __b
)
83 return (__m256i
)((__v8su
)__a
+ (__v8su
)__b
);
86 static __inline__ __m256i __DEFAULT_FN_ATTRS256
87 _mm256_add_epi64(__m256i __a
, __m256i __b
)
89 return (__m256i
)((__v4du
)__a
+ (__v4du
)__b
);
92 static __inline__ __m256i __DEFAULT_FN_ATTRS256
93 _mm256_adds_epi8(__m256i __a
, __m256i __b
)
95 return (__m256i
)__builtin_elementwise_add_sat((__v32qs
)__a
, (__v32qs
)__b
);
98 static __inline__ __m256i __DEFAULT_FN_ATTRS256
99 _mm256_adds_epi16(__m256i __a
, __m256i __b
)
101 return (__m256i
)__builtin_elementwise_add_sat((__v16hi
)__a
, (__v16hi
)__b
);
104 static __inline__ __m256i __DEFAULT_FN_ATTRS256
105 _mm256_adds_epu8(__m256i __a
, __m256i __b
)
107 return (__m256i
)__builtin_elementwise_add_sat((__v32qu
)__a
, (__v32qu
)__b
);
110 static __inline__ __m256i __DEFAULT_FN_ATTRS256
111 _mm256_adds_epu16(__m256i __a
, __m256i __b
)
113 return (__m256i
)__builtin_elementwise_add_sat((__v16hu
)__a
, (__v16hu
)__b
);
116 #define _mm256_alignr_epi8(a, b, n) \
117 ((__m256i)__builtin_ia32_palignr256((__v32qi)(__m256i)(a), \
118 (__v32qi)(__m256i)(b), (n)))
120 static __inline__ __m256i __DEFAULT_FN_ATTRS256
121 _mm256_and_si256(__m256i __a
, __m256i __b
)
123 return (__m256i
)((__v4du
)__a
& (__v4du
)__b
);
126 static __inline__ __m256i __DEFAULT_FN_ATTRS256
127 _mm256_andnot_si256(__m256i __a
, __m256i __b
)
129 return (__m256i
)(~(__v4du
)__a
& (__v4du
)__b
);
132 static __inline__ __m256i __DEFAULT_FN_ATTRS256
133 _mm256_avg_epu8(__m256i __a
, __m256i __b
)
135 return (__m256i
)__builtin_ia32_pavgb256((__v32qi
)__a
, (__v32qi
)__b
);
138 static __inline__ __m256i __DEFAULT_FN_ATTRS256
139 _mm256_avg_epu16(__m256i __a
, __m256i __b
)
141 return (__m256i
)__builtin_ia32_pavgw256((__v16hi
)__a
, (__v16hi
)__b
);
144 static __inline__ __m256i __DEFAULT_FN_ATTRS256
145 _mm256_blendv_epi8(__m256i __V1
, __m256i __V2
, __m256i __M
)
147 return (__m256i
)__builtin_ia32_pblendvb256((__v32qi
)__V1
, (__v32qi
)__V2
,
151 #define _mm256_blend_epi16(V1, V2, M) \
152 ((__m256i)__builtin_ia32_pblendw256((__v16hi)(__m256i)(V1), \
153 (__v16hi)(__m256i)(V2), (int)(M)))
155 static __inline__ __m256i __DEFAULT_FN_ATTRS256
156 _mm256_cmpeq_epi8(__m256i __a
, __m256i __b
)
158 return (__m256i
)((__v32qi
)__a
== (__v32qi
)__b
);
161 static __inline__ __m256i __DEFAULT_FN_ATTRS256
162 _mm256_cmpeq_epi16(__m256i __a
, __m256i __b
)
164 return (__m256i
)((__v16hi
)__a
== (__v16hi
)__b
);
167 static __inline__ __m256i __DEFAULT_FN_ATTRS256
168 _mm256_cmpeq_epi32(__m256i __a
, __m256i __b
)
170 return (__m256i
)((__v8si
)__a
== (__v8si
)__b
);
173 static __inline__ __m256i __DEFAULT_FN_ATTRS256
174 _mm256_cmpeq_epi64(__m256i __a
, __m256i __b
)
176 return (__m256i
)((__v4di
)__a
== (__v4di
)__b
);
179 static __inline__ __m256i __DEFAULT_FN_ATTRS256
180 _mm256_cmpgt_epi8(__m256i __a
, __m256i __b
)
182 /* This function always performs a signed comparison, but __v32qi is a char
183 which may be signed or unsigned, so use __v32qs. */
184 return (__m256i
)((__v32qs
)__a
> (__v32qs
)__b
);
187 static __inline__ __m256i __DEFAULT_FN_ATTRS256
188 _mm256_cmpgt_epi16(__m256i __a
, __m256i __b
)
190 return (__m256i
)((__v16hi
)__a
> (__v16hi
)__b
);
193 static __inline__ __m256i __DEFAULT_FN_ATTRS256
194 _mm256_cmpgt_epi32(__m256i __a
, __m256i __b
)
196 return (__m256i
)((__v8si
)__a
> (__v8si
)__b
);
199 static __inline__ __m256i __DEFAULT_FN_ATTRS256
200 _mm256_cmpgt_epi64(__m256i __a
, __m256i __b
)
202 return (__m256i
)((__v4di
)__a
> (__v4di
)__b
);
205 static __inline__ __m256i __DEFAULT_FN_ATTRS256
206 _mm256_hadd_epi16(__m256i __a
, __m256i __b
)
208 return (__m256i
)__builtin_ia32_phaddw256((__v16hi
)__a
, (__v16hi
)__b
);
211 static __inline__ __m256i __DEFAULT_FN_ATTRS256
212 _mm256_hadd_epi32(__m256i __a
, __m256i __b
)
214 return (__m256i
)__builtin_ia32_phaddd256((__v8si
)__a
, (__v8si
)__b
);
217 static __inline__ __m256i __DEFAULT_FN_ATTRS256
218 _mm256_hadds_epi16(__m256i __a
, __m256i __b
)
220 return (__m256i
)__builtin_ia32_phaddsw256((__v16hi
)__a
, (__v16hi
)__b
);
223 static __inline__ __m256i __DEFAULT_FN_ATTRS256
224 _mm256_hsub_epi16(__m256i __a
, __m256i __b
)
226 return (__m256i
)__builtin_ia32_phsubw256((__v16hi
)__a
, (__v16hi
)__b
);
229 static __inline__ __m256i __DEFAULT_FN_ATTRS256
230 _mm256_hsub_epi32(__m256i __a
, __m256i __b
)
232 return (__m256i
)__builtin_ia32_phsubd256((__v8si
)__a
, (__v8si
)__b
);
235 static __inline__ __m256i __DEFAULT_FN_ATTRS256
236 _mm256_hsubs_epi16(__m256i __a
, __m256i __b
)
238 return (__m256i
)__builtin_ia32_phsubsw256((__v16hi
)__a
, (__v16hi
)__b
);
241 static __inline__ __m256i __DEFAULT_FN_ATTRS256
242 _mm256_maddubs_epi16(__m256i __a
, __m256i __b
)
244 return (__m256i
)__builtin_ia32_pmaddubsw256((__v32qi
)__a
, (__v32qi
)__b
);
247 static __inline__ __m256i __DEFAULT_FN_ATTRS256
248 _mm256_madd_epi16(__m256i __a
, __m256i __b
)
250 return (__m256i
)__builtin_ia32_pmaddwd256((__v16hi
)__a
, (__v16hi
)__b
);
253 static __inline__ __m256i __DEFAULT_FN_ATTRS256
254 _mm256_max_epi8(__m256i __a
, __m256i __b
)
256 return (__m256i
)__builtin_elementwise_max((__v32qs
)__a
, (__v32qs
)__b
);
259 static __inline__ __m256i __DEFAULT_FN_ATTRS256
260 _mm256_max_epi16(__m256i __a
, __m256i __b
)
262 return (__m256i
)__builtin_elementwise_max((__v16hi
)__a
, (__v16hi
)__b
);
265 static __inline__ __m256i __DEFAULT_FN_ATTRS256
266 _mm256_max_epi32(__m256i __a
, __m256i __b
)
268 return (__m256i
)__builtin_elementwise_max((__v8si
)__a
, (__v8si
)__b
);
271 static __inline__ __m256i __DEFAULT_FN_ATTRS256
272 _mm256_max_epu8(__m256i __a
, __m256i __b
)
274 return (__m256i
)__builtin_elementwise_max((__v32qu
)__a
, (__v32qu
)__b
);
277 static __inline__ __m256i __DEFAULT_FN_ATTRS256
278 _mm256_max_epu16(__m256i __a
, __m256i __b
)
280 return (__m256i
)__builtin_elementwise_max((__v16hu
)__a
, (__v16hu
)__b
);
283 static __inline__ __m256i __DEFAULT_FN_ATTRS256
284 _mm256_max_epu32(__m256i __a
, __m256i __b
)
286 return (__m256i
)__builtin_elementwise_max((__v8su
)__a
, (__v8su
)__b
);
289 static __inline__ __m256i __DEFAULT_FN_ATTRS256
290 _mm256_min_epi8(__m256i __a
, __m256i __b
)
292 return (__m256i
)__builtin_elementwise_min((__v32qs
)__a
, (__v32qs
)__b
);
295 static __inline__ __m256i __DEFAULT_FN_ATTRS256
296 _mm256_min_epi16(__m256i __a
, __m256i __b
)
298 return (__m256i
)__builtin_elementwise_min((__v16hi
)__a
, (__v16hi
)__b
);
301 static __inline__ __m256i __DEFAULT_FN_ATTRS256
302 _mm256_min_epi32(__m256i __a
, __m256i __b
)
304 return (__m256i
)__builtin_elementwise_min((__v8si
)__a
, (__v8si
)__b
);
307 static __inline__ __m256i __DEFAULT_FN_ATTRS256
308 _mm256_min_epu8(__m256i __a
, __m256i __b
)
310 return (__m256i
)__builtin_elementwise_min((__v32qu
)__a
, (__v32qu
)__b
);
313 static __inline__ __m256i __DEFAULT_FN_ATTRS256
314 _mm256_min_epu16(__m256i __a
, __m256i __b
)
316 return (__m256i
)__builtin_elementwise_min((__v16hu
)__a
, (__v16hu
)__b
);
319 static __inline__ __m256i __DEFAULT_FN_ATTRS256
320 _mm256_min_epu32(__m256i __a
, __m256i __b
)
322 return (__m256i
)__builtin_elementwise_min((__v8su
)__a
, (__v8su
)__b
);
325 static __inline__
int __DEFAULT_FN_ATTRS256
326 _mm256_movemask_epi8(__m256i __a
)
328 return __builtin_ia32_pmovmskb256((__v32qi
)__a
);
331 static __inline__ __m256i __DEFAULT_FN_ATTRS256
332 _mm256_cvtepi8_epi16(__m128i __V
)
334 /* This function always performs a signed extension, but __v16qi is a char
335 which may be signed or unsigned, so use __v16qs. */
336 return (__m256i
)__builtin_convertvector((__v16qs
)__V
, __v16hi
);
339 static __inline__ __m256i __DEFAULT_FN_ATTRS256
340 _mm256_cvtepi8_epi32(__m128i __V
)
342 /* This function always performs a signed extension, but __v16qi is a char
343 which may be signed or unsigned, so use __v16qs. */
344 return (__m256i
)__builtin_convertvector(__builtin_shufflevector((__v16qs
)__V
, (__v16qs
)__V
, 0, 1, 2, 3, 4, 5, 6, 7), __v8si
);
347 static __inline__ __m256i __DEFAULT_FN_ATTRS256
348 _mm256_cvtepi8_epi64(__m128i __V
)
350 /* This function always performs a signed extension, but __v16qi is a char
351 which may be signed or unsigned, so use __v16qs. */
352 return (__m256i
)__builtin_convertvector(__builtin_shufflevector((__v16qs
)__V
, (__v16qs
)__V
, 0, 1, 2, 3), __v4di
);
355 static __inline__ __m256i __DEFAULT_FN_ATTRS256
356 _mm256_cvtepi16_epi32(__m128i __V
)
358 return (__m256i
)__builtin_convertvector((__v8hi
)__V
, __v8si
);
361 static __inline__ __m256i __DEFAULT_FN_ATTRS256
362 _mm256_cvtepi16_epi64(__m128i __V
)
364 return (__m256i
)__builtin_convertvector(__builtin_shufflevector((__v8hi
)__V
, (__v8hi
)__V
, 0, 1, 2, 3), __v4di
);
367 static __inline__ __m256i __DEFAULT_FN_ATTRS256
368 _mm256_cvtepi32_epi64(__m128i __V
)
370 return (__m256i
)__builtin_convertvector((__v4si
)__V
, __v4di
);
373 static __inline__ __m256i __DEFAULT_FN_ATTRS256
374 _mm256_cvtepu8_epi16(__m128i __V
)
376 return (__m256i
)__builtin_convertvector((__v16qu
)__V
, __v16hi
);
379 static __inline__ __m256i __DEFAULT_FN_ATTRS256
380 _mm256_cvtepu8_epi32(__m128i __V
)
382 return (__m256i
)__builtin_convertvector(__builtin_shufflevector((__v16qu
)__V
, (__v16qu
)__V
, 0, 1, 2, 3, 4, 5, 6, 7), __v8si
);
385 static __inline__ __m256i __DEFAULT_FN_ATTRS256
386 _mm256_cvtepu8_epi64(__m128i __V
)
388 return (__m256i
)__builtin_convertvector(__builtin_shufflevector((__v16qu
)__V
, (__v16qu
)__V
, 0, 1, 2, 3), __v4di
);
391 static __inline__ __m256i __DEFAULT_FN_ATTRS256
392 _mm256_cvtepu16_epi32(__m128i __V
)
394 return (__m256i
)__builtin_convertvector((__v8hu
)__V
, __v8si
);
397 static __inline__ __m256i __DEFAULT_FN_ATTRS256
398 _mm256_cvtepu16_epi64(__m128i __V
)
400 return (__m256i
)__builtin_convertvector(__builtin_shufflevector((__v8hu
)__V
, (__v8hu
)__V
, 0, 1, 2, 3), __v4di
);
403 static __inline__ __m256i __DEFAULT_FN_ATTRS256
404 _mm256_cvtepu32_epi64(__m128i __V
)
406 return (__m256i
)__builtin_convertvector((__v4su
)__V
, __v4di
);
409 static __inline__ __m256i __DEFAULT_FN_ATTRS256
410 _mm256_mul_epi32(__m256i __a
, __m256i __b
)
412 return (__m256i
)__builtin_ia32_pmuldq256((__v8si
)__a
, (__v8si
)__b
);
415 static __inline__ __m256i __DEFAULT_FN_ATTRS256
416 _mm256_mulhrs_epi16(__m256i __a
, __m256i __b
)
418 return (__m256i
)__builtin_ia32_pmulhrsw256((__v16hi
)__a
, (__v16hi
)__b
);
421 static __inline__ __m256i __DEFAULT_FN_ATTRS256
422 _mm256_mulhi_epu16(__m256i __a
, __m256i __b
)
424 return (__m256i
)__builtin_ia32_pmulhuw256((__v16hi
)__a
, (__v16hi
)__b
);
427 static __inline__ __m256i __DEFAULT_FN_ATTRS256
428 _mm256_mulhi_epi16(__m256i __a
, __m256i __b
)
430 return (__m256i
)__builtin_ia32_pmulhw256((__v16hi
)__a
, (__v16hi
)__b
);
433 static __inline__ __m256i __DEFAULT_FN_ATTRS256
434 _mm256_mullo_epi16(__m256i __a
, __m256i __b
)
436 return (__m256i
)((__v16hu
)__a
* (__v16hu
)__b
);
439 static __inline__ __m256i __DEFAULT_FN_ATTRS256
440 _mm256_mullo_epi32 (__m256i __a
, __m256i __b
)
442 return (__m256i
)((__v8su
)__a
* (__v8su
)__b
);
445 static __inline__ __m256i __DEFAULT_FN_ATTRS256
446 _mm256_mul_epu32(__m256i __a
, __m256i __b
)
448 return __builtin_ia32_pmuludq256((__v8si
)__a
, (__v8si
)__b
);
451 static __inline__ __m256i __DEFAULT_FN_ATTRS256
452 _mm256_or_si256(__m256i __a
, __m256i __b
)
454 return (__m256i
)((__v4du
)__a
| (__v4du
)__b
);
457 static __inline__ __m256i __DEFAULT_FN_ATTRS256
458 _mm256_sad_epu8(__m256i __a
, __m256i __b
)
460 return __builtin_ia32_psadbw256((__v32qi
)__a
, (__v32qi
)__b
);
463 static __inline__ __m256i __DEFAULT_FN_ATTRS256
464 _mm256_shuffle_epi8(__m256i __a
, __m256i __b
)
466 return (__m256i
)__builtin_ia32_pshufb256((__v32qi
)__a
, (__v32qi
)__b
);
469 #define _mm256_shuffle_epi32(a, imm) \
470 ((__m256i)__builtin_ia32_pshufd256((__v8si)(__m256i)(a), (int)(imm)))
472 #define _mm256_shufflehi_epi16(a, imm) \
473 ((__m256i)__builtin_ia32_pshufhw256((__v16hi)(__m256i)(a), (int)(imm)))
475 #define _mm256_shufflelo_epi16(a, imm) \
476 ((__m256i)__builtin_ia32_pshuflw256((__v16hi)(__m256i)(a), (int)(imm)))
478 static __inline__ __m256i __DEFAULT_FN_ATTRS256
479 _mm256_sign_epi8(__m256i __a
, __m256i __b
)
481 return (__m256i
)__builtin_ia32_psignb256((__v32qi
)__a
, (__v32qi
)__b
);
484 static __inline__ __m256i __DEFAULT_FN_ATTRS256
485 _mm256_sign_epi16(__m256i __a
, __m256i __b
)
487 return (__m256i
)__builtin_ia32_psignw256((__v16hi
)__a
, (__v16hi
)__b
);
490 static __inline__ __m256i __DEFAULT_FN_ATTRS256
491 _mm256_sign_epi32(__m256i __a
, __m256i __b
)
493 return (__m256i
)__builtin_ia32_psignd256((__v8si
)__a
, (__v8si
)__b
);
496 #define _mm256_slli_si256(a, imm) \
497 ((__m256i)__builtin_ia32_pslldqi256_byteshift((__v4di)(__m256i)(a), (int)(imm)))
499 #define _mm256_bslli_epi128(a, imm) \
500 ((__m256i)__builtin_ia32_pslldqi256_byteshift((__v4di)(__m256i)(a), (int)(imm)))
502 static __inline__ __m256i __DEFAULT_FN_ATTRS256
503 _mm256_slli_epi16(__m256i __a
, int __count
)
505 return (__m256i
)__builtin_ia32_psllwi256((__v16hi
)__a
, __count
);
508 static __inline__ __m256i __DEFAULT_FN_ATTRS256
509 _mm256_sll_epi16(__m256i __a
, __m128i __count
)
511 return (__m256i
)__builtin_ia32_psllw256((__v16hi
)__a
, (__v8hi
)__count
);
514 static __inline__ __m256i __DEFAULT_FN_ATTRS256
515 _mm256_slli_epi32(__m256i __a
, int __count
)
517 return (__m256i
)__builtin_ia32_pslldi256((__v8si
)__a
, __count
);
520 static __inline__ __m256i __DEFAULT_FN_ATTRS256
521 _mm256_sll_epi32(__m256i __a
, __m128i __count
)
523 return (__m256i
)__builtin_ia32_pslld256((__v8si
)__a
, (__v4si
)__count
);
526 static __inline__ __m256i __DEFAULT_FN_ATTRS256
527 _mm256_slli_epi64(__m256i __a
, int __count
)
529 return __builtin_ia32_psllqi256((__v4di
)__a
, __count
);
532 static __inline__ __m256i __DEFAULT_FN_ATTRS256
533 _mm256_sll_epi64(__m256i __a
, __m128i __count
)
535 return __builtin_ia32_psllq256((__v4di
)__a
, __count
);
538 static __inline__ __m256i __DEFAULT_FN_ATTRS256
539 _mm256_srai_epi16(__m256i __a
, int __count
)
541 return (__m256i
)__builtin_ia32_psrawi256((__v16hi
)__a
, __count
);
544 static __inline__ __m256i __DEFAULT_FN_ATTRS256
545 _mm256_sra_epi16(__m256i __a
, __m128i __count
)
547 return (__m256i
)__builtin_ia32_psraw256((__v16hi
)__a
, (__v8hi
)__count
);
550 static __inline__ __m256i __DEFAULT_FN_ATTRS256
551 _mm256_srai_epi32(__m256i __a
, int __count
)
553 return (__m256i
)__builtin_ia32_psradi256((__v8si
)__a
, __count
);
556 static __inline__ __m256i __DEFAULT_FN_ATTRS256
557 _mm256_sra_epi32(__m256i __a
, __m128i __count
)
559 return (__m256i
)__builtin_ia32_psrad256((__v8si
)__a
, (__v4si
)__count
);
562 #define _mm256_srli_si256(a, imm) \
563 ((__m256i)__builtin_ia32_psrldqi256_byteshift((__m256i)(a), (int)(imm)))
565 #define _mm256_bsrli_epi128(a, imm) \
566 ((__m256i)__builtin_ia32_psrldqi256_byteshift((__m256i)(a), (int)(imm)))
568 static __inline__ __m256i __DEFAULT_FN_ATTRS256
569 _mm256_srli_epi16(__m256i __a
, int __count
)
571 return (__m256i
)__builtin_ia32_psrlwi256((__v16hi
)__a
, __count
);
574 static __inline__ __m256i __DEFAULT_FN_ATTRS256
575 _mm256_srl_epi16(__m256i __a
, __m128i __count
)
577 return (__m256i
)__builtin_ia32_psrlw256((__v16hi
)__a
, (__v8hi
)__count
);
580 static __inline__ __m256i __DEFAULT_FN_ATTRS256
581 _mm256_srli_epi32(__m256i __a
, int __count
)
583 return (__m256i
)__builtin_ia32_psrldi256((__v8si
)__a
, __count
);
586 static __inline__ __m256i __DEFAULT_FN_ATTRS256
587 _mm256_srl_epi32(__m256i __a
, __m128i __count
)
589 return (__m256i
)__builtin_ia32_psrld256((__v8si
)__a
, (__v4si
)__count
);
592 static __inline__ __m256i __DEFAULT_FN_ATTRS256
593 _mm256_srli_epi64(__m256i __a
, int __count
)
595 return __builtin_ia32_psrlqi256((__v4di
)__a
, __count
);
598 static __inline__ __m256i __DEFAULT_FN_ATTRS256
599 _mm256_srl_epi64(__m256i __a
, __m128i __count
)
601 return __builtin_ia32_psrlq256((__v4di
)__a
, __count
);
604 static __inline__ __m256i __DEFAULT_FN_ATTRS256
605 _mm256_sub_epi8(__m256i __a
, __m256i __b
)
607 return (__m256i
)((__v32qu
)__a
- (__v32qu
)__b
);
610 static __inline__ __m256i __DEFAULT_FN_ATTRS256
611 _mm256_sub_epi16(__m256i __a
, __m256i __b
)
613 return (__m256i
)((__v16hu
)__a
- (__v16hu
)__b
);
616 static __inline__ __m256i __DEFAULT_FN_ATTRS256
617 _mm256_sub_epi32(__m256i __a
, __m256i __b
)
619 return (__m256i
)((__v8su
)__a
- (__v8su
)__b
);
622 static __inline__ __m256i __DEFAULT_FN_ATTRS256
623 _mm256_sub_epi64(__m256i __a
, __m256i __b
)
625 return (__m256i
)((__v4du
)__a
- (__v4du
)__b
);
628 static __inline__ __m256i __DEFAULT_FN_ATTRS256
629 _mm256_subs_epi8(__m256i __a
, __m256i __b
)
631 return (__m256i
)__builtin_elementwise_sub_sat((__v32qs
)__a
, (__v32qs
)__b
);
634 static __inline__ __m256i __DEFAULT_FN_ATTRS256
635 _mm256_subs_epi16(__m256i __a
, __m256i __b
)
637 return (__m256i
)__builtin_elementwise_sub_sat((__v16hi
)__a
, (__v16hi
)__b
);
640 static __inline__ __m256i __DEFAULT_FN_ATTRS256
641 _mm256_subs_epu8(__m256i __a
, __m256i __b
)
643 return (__m256i
)__builtin_elementwise_sub_sat((__v32qu
)__a
, (__v32qu
)__b
);
646 static __inline__ __m256i __DEFAULT_FN_ATTRS256
647 _mm256_subs_epu16(__m256i __a
, __m256i __b
)
649 return (__m256i
)__builtin_elementwise_sub_sat((__v16hu
)__a
, (__v16hu
)__b
);
652 static __inline__ __m256i __DEFAULT_FN_ATTRS256
653 _mm256_unpackhi_epi8(__m256i __a
, __m256i __b
)
655 return (__m256i
)__builtin_shufflevector((__v32qi
)__a
, (__v32qi
)__b
, 8, 32+8, 9, 32+9, 10, 32+10, 11, 32+11, 12, 32+12, 13, 32+13, 14, 32+14, 15, 32+15, 24, 32+24, 25, 32+25, 26, 32+26, 27, 32+27, 28, 32+28, 29, 32+29, 30, 32+30, 31, 32+31);
658 static __inline__ __m256i __DEFAULT_FN_ATTRS256
659 _mm256_unpackhi_epi16(__m256i __a
, __m256i __b
)
661 return (__m256i
)__builtin_shufflevector((__v16hi
)__a
, (__v16hi
)__b
, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15);
664 static __inline__ __m256i __DEFAULT_FN_ATTRS256
665 _mm256_unpackhi_epi32(__m256i __a
, __m256i __b
)
667 return (__m256i
)__builtin_shufflevector((__v8si
)__a
, (__v8si
)__b
, 2, 8+2, 3, 8+3, 6, 8+6, 7, 8+7);
670 static __inline__ __m256i __DEFAULT_FN_ATTRS256
671 _mm256_unpackhi_epi64(__m256i __a
, __m256i __b
)
673 return (__m256i
)__builtin_shufflevector((__v4di
)__a
, (__v4di
)__b
, 1, 4+1, 3, 4+3);
676 static __inline__ __m256i __DEFAULT_FN_ATTRS256
677 _mm256_unpacklo_epi8(__m256i __a
, __m256i __b
)
679 return (__m256i
)__builtin_shufflevector((__v32qi
)__a
, (__v32qi
)__b
, 0, 32+0, 1, 32+1, 2, 32+2, 3, 32+3, 4, 32+4, 5, 32+5, 6, 32+6, 7, 32+7, 16, 32+16, 17, 32+17, 18, 32+18, 19, 32+19, 20, 32+20, 21, 32+21, 22, 32+22, 23, 32+23);
682 static __inline__ __m256i __DEFAULT_FN_ATTRS256
683 _mm256_unpacklo_epi16(__m256i __a
, __m256i __b
)
685 return (__m256i
)__builtin_shufflevector((__v16hi
)__a
, (__v16hi
)__b
, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11);
688 static __inline__ __m256i __DEFAULT_FN_ATTRS256
689 _mm256_unpacklo_epi32(__m256i __a
, __m256i __b
)
691 return (__m256i
)__builtin_shufflevector((__v8si
)__a
, (__v8si
)__b
, 0, 8+0, 1, 8+1, 4, 8+4, 5, 8+5);
694 static __inline__ __m256i __DEFAULT_FN_ATTRS256
695 _mm256_unpacklo_epi64(__m256i __a
, __m256i __b
)
697 return (__m256i
)__builtin_shufflevector((__v4di
)__a
, (__v4di
)__b
, 0, 4+0, 2, 4+2);
700 static __inline__ __m256i __DEFAULT_FN_ATTRS256
701 _mm256_xor_si256(__m256i __a
, __m256i __b
)
703 return (__m256i
)((__v4du
)__a
^ (__v4du
)__b
);
706 static __inline__ __m256i __DEFAULT_FN_ATTRS256
707 _mm256_stream_load_si256(__m256i
const *__V
)
709 typedef __v4di __v4di_aligned
__attribute__((aligned(32)));
710 return (__m256i
)__builtin_nontemporal_load((const __v4di_aligned
*)__V
);
713 static __inline__ __m128 __DEFAULT_FN_ATTRS128
714 _mm_broadcastss_ps(__m128 __X
)
716 return (__m128
)__builtin_shufflevector((__v4sf
)__X
, (__v4sf
)__X
, 0, 0, 0, 0);
719 static __inline__ __m128d __DEFAULT_FN_ATTRS128
720 _mm_broadcastsd_pd(__m128d __a
)
722 return __builtin_shufflevector((__v2df
)__a
, (__v2df
)__a
, 0, 0);
725 static __inline__ __m256 __DEFAULT_FN_ATTRS256
726 _mm256_broadcastss_ps(__m128 __X
)
728 return (__m256
)__builtin_shufflevector((__v4sf
)__X
, (__v4sf
)__X
, 0, 0, 0, 0, 0, 0, 0, 0);
731 static __inline__ __m256d __DEFAULT_FN_ATTRS256
732 _mm256_broadcastsd_pd(__m128d __X
)
734 return (__m256d
)__builtin_shufflevector((__v2df
)__X
, (__v2df
)__X
, 0, 0, 0, 0);
737 static __inline__ __m256i __DEFAULT_FN_ATTRS256
738 _mm256_broadcastsi128_si256(__m128i __X
)
740 return (__m256i
)__builtin_shufflevector((__v2di
)__X
, (__v2di
)__X
, 0, 1, 0, 1);
743 #define _mm_broadcastsi128_si256(X) _mm256_broadcastsi128_si256(X)
745 #define _mm_blend_epi32(V1, V2, M) \
746 ((__m128i)__builtin_ia32_pblendd128((__v4si)(__m128i)(V1), \
747 (__v4si)(__m128i)(V2), (int)(M)))
749 #define _mm256_blend_epi32(V1, V2, M) \
750 ((__m256i)__builtin_ia32_pblendd256((__v8si)(__m256i)(V1), \
751 (__v8si)(__m256i)(V2), (int)(M)))
753 static __inline__ __m256i __DEFAULT_FN_ATTRS256
754 _mm256_broadcastb_epi8(__m128i __X
)
756 return (__m256i
)__builtin_shufflevector((__v16qi
)__X
, (__v16qi
)__X
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
759 static __inline__ __m256i __DEFAULT_FN_ATTRS256
760 _mm256_broadcastw_epi16(__m128i __X
)
762 return (__m256i
)__builtin_shufflevector((__v8hi
)__X
, (__v8hi
)__X
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
765 static __inline__ __m256i __DEFAULT_FN_ATTRS256
766 _mm256_broadcastd_epi32(__m128i __X
)
768 return (__m256i
)__builtin_shufflevector((__v4si
)__X
, (__v4si
)__X
, 0, 0, 0, 0, 0, 0, 0, 0);
771 static __inline__ __m256i __DEFAULT_FN_ATTRS256
772 _mm256_broadcastq_epi64(__m128i __X
)
774 return (__m256i
)__builtin_shufflevector((__v2di
)__X
, (__v2di
)__X
, 0, 0, 0, 0);
777 static __inline__ __m128i __DEFAULT_FN_ATTRS128
778 _mm_broadcastb_epi8(__m128i __X
)
780 return (__m128i
)__builtin_shufflevector((__v16qi
)__X
, (__v16qi
)__X
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
783 static __inline__ __m128i __DEFAULT_FN_ATTRS128
784 _mm_broadcastw_epi16(__m128i __X
)
786 return (__m128i
)__builtin_shufflevector((__v8hi
)__X
, (__v8hi
)__X
, 0, 0, 0, 0, 0, 0, 0, 0);
790 static __inline__ __m128i __DEFAULT_FN_ATTRS128
791 _mm_broadcastd_epi32(__m128i __X
)
793 return (__m128i
)__builtin_shufflevector((__v4si
)__X
, (__v4si
)__X
, 0, 0, 0, 0);
796 static __inline__ __m128i __DEFAULT_FN_ATTRS128
797 _mm_broadcastq_epi64(__m128i __X
)
799 return (__m128i
)__builtin_shufflevector((__v2di
)__X
, (__v2di
)__X
, 0, 0);
802 static __inline__ __m256i __DEFAULT_FN_ATTRS256
803 _mm256_permutevar8x32_epi32(__m256i __a
, __m256i __b
)
805 return (__m256i
)__builtin_ia32_permvarsi256((__v8si
)__a
, (__v8si
)__b
);
808 #define _mm256_permute4x64_pd(V, M) \
809 ((__m256d)__builtin_ia32_permdf256((__v4df)(__m256d)(V), (int)(M)))
811 static __inline__ __m256 __DEFAULT_FN_ATTRS256
812 _mm256_permutevar8x32_ps(__m256 __a
, __m256i __b
)
814 return (__m256
)__builtin_ia32_permvarsf256((__v8sf
)__a
, (__v8si
)__b
);
817 #define _mm256_permute4x64_epi64(V, M) \
818 ((__m256i)__builtin_ia32_permdi256((__v4di)(__m256i)(V), (int)(M)))
820 #define _mm256_permute2x128_si256(V1, V2, M) \
821 ((__m256i)__builtin_ia32_permti256((__m256i)(V1), (__m256i)(V2), (int)(M)))
823 #define _mm256_extracti128_si256(V, M) \
824 ((__m128i)__builtin_ia32_extract128i256((__v4di)(__m256i)(V), (int)(M)))
826 #define _mm256_inserti128_si256(V1, V2, M) \
827 ((__m256i)__builtin_ia32_insert128i256((__v4di)(__m256i)(V1), \
828 (__v2di)(__m128i)(V2), (int)(M)))
830 static __inline__ __m256i __DEFAULT_FN_ATTRS256
831 _mm256_maskload_epi32(int const *__X
, __m256i __M
)
833 return (__m256i
)__builtin_ia32_maskloadd256((const __v8si
*)__X
, (__v8si
)__M
);
836 static __inline__ __m256i __DEFAULT_FN_ATTRS256
837 _mm256_maskload_epi64(long long const *__X
, __m256i __M
)
839 return (__m256i
)__builtin_ia32_maskloadq256((const __v4di
*)__X
, (__v4di
)__M
);
842 static __inline__ __m128i __DEFAULT_FN_ATTRS128
843 _mm_maskload_epi32(int const *__X
, __m128i __M
)
845 return (__m128i
)__builtin_ia32_maskloadd((const __v4si
*)__X
, (__v4si
)__M
);
848 static __inline__ __m128i __DEFAULT_FN_ATTRS128
849 _mm_maskload_epi64(long long const *__X
, __m128i __M
)
851 return (__m128i
)__builtin_ia32_maskloadq((const __v2di
*)__X
, (__v2di
)__M
);
854 static __inline__
void __DEFAULT_FN_ATTRS256
855 _mm256_maskstore_epi32(int *__X
, __m256i __M
, __m256i __Y
)
857 __builtin_ia32_maskstored256((__v8si
*)__X
, (__v8si
)__M
, (__v8si
)__Y
);
860 static __inline__
void __DEFAULT_FN_ATTRS256
861 _mm256_maskstore_epi64(long long *__X
, __m256i __M
, __m256i __Y
)
863 __builtin_ia32_maskstoreq256((__v4di
*)__X
, (__v4di
)__M
, (__v4di
)__Y
);
866 static __inline__
void __DEFAULT_FN_ATTRS128
867 _mm_maskstore_epi32(int *__X
, __m128i __M
, __m128i __Y
)
869 __builtin_ia32_maskstored((__v4si
*)__X
, (__v4si
)__M
, (__v4si
)__Y
);
872 static __inline__
void __DEFAULT_FN_ATTRS128
873 _mm_maskstore_epi64(long long *__X
, __m128i __M
, __m128i __Y
)
875 __builtin_ia32_maskstoreq(( __v2di
*)__X
, (__v2di
)__M
, (__v2di
)__Y
);
878 static __inline__ __m256i __DEFAULT_FN_ATTRS256
879 _mm256_sllv_epi32(__m256i __X
, __m256i __Y
)
881 return (__m256i
)__builtin_ia32_psllv8si((__v8si
)__X
, (__v8si
)__Y
);
884 static __inline__ __m128i __DEFAULT_FN_ATTRS128
885 _mm_sllv_epi32(__m128i __X
, __m128i __Y
)
887 return (__m128i
)__builtin_ia32_psllv4si((__v4si
)__X
, (__v4si
)__Y
);
890 static __inline__ __m256i __DEFAULT_FN_ATTRS256
891 _mm256_sllv_epi64(__m256i __X
, __m256i __Y
)
893 return (__m256i
)__builtin_ia32_psllv4di((__v4di
)__X
, (__v4di
)__Y
);
896 static __inline__ __m128i __DEFAULT_FN_ATTRS128
897 _mm_sllv_epi64(__m128i __X
, __m128i __Y
)
899 return (__m128i
)__builtin_ia32_psllv2di((__v2di
)__X
, (__v2di
)__Y
);
902 static __inline__ __m256i __DEFAULT_FN_ATTRS256
903 _mm256_srav_epi32(__m256i __X
, __m256i __Y
)
905 return (__m256i
)__builtin_ia32_psrav8si((__v8si
)__X
, (__v8si
)__Y
);
908 static __inline__ __m128i __DEFAULT_FN_ATTRS128
909 _mm_srav_epi32(__m128i __X
, __m128i __Y
)
911 return (__m128i
)__builtin_ia32_psrav4si((__v4si
)__X
, (__v4si
)__Y
);
914 static __inline__ __m256i __DEFAULT_FN_ATTRS256
915 _mm256_srlv_epi32(__m256i __X
, __m256i __Y
)
917 return (__m256i
)__builtin_ia32_psrlv8si((__v8si
)__X
, (__v8si
)__Y
);
920 static __inline__ __m128i __DEFAULT_FN_ATTRS128
921 _mm_srlv_epi32(__m128i __X
, __m128i __Y
)
923 return (__m128i
)__builtin_ia32_psrlv4si((__v4si
)__X
, (__v4si
)__Y
);
926 static __inline__ __m256i __DEFAULT_FN_ATTRS256
927 _mm256_srlv_epi64(__m256i __X
, __m256i __Y
)
929 return (__m256i
)__builtin_ia32_psrlv4di((__v4di
)__X
, (__v4di
)__Y
);
932 static __inline__ __m128i __DEFAULT_FN_ATTRS128
933 _mm_srlv_epi64(__m128i __X
, __m128i __Y
)
935 return (__m128i
)__builtin_ia32_psrlv2di((__v2di
)__X
, (__v2di
)__Y
);
938 #define _mm_mask_i32gather_pd(a, m, i, mask, s) \
939 ((__m128d)__builtin_ia32_gatherd_pd((__v2df)(__m128i)(a), \
940 (double const *)(m), \
941 (__v4si)(__m128i)(i), \
942 (__v2df)(__m128d)(mask), (s)))
944 #define _mm256_mask_i32gather_pd(a, m, i, mask, s) \
945 ((__m256d)__builtin_ia32_gatherd_pd256((__v4df)(__m256d)(a), \
946 (double const *)(m), \
947 (__v4si)(__m128i)(i), \
948 (__v4df)(__m256d)(mask), (s)))
950 #define _mm_mask_i64gather_pd(a, m, i, mask, s) \
951 ((__m128d)__builtin_ia32_gatherq_pd((__v2df)(__m128d)(a), \
952 (double const *)(m), \
953 (__v2di)(__m128i)(i), \
954 (__v2df)(__m128d)(mask), (s)))
956 #define _mm256_mask_i64gather_pd(a, m, i, mask, s) \
957 ((__m256d)__builtin_ia32_gatherq_pd256((__v4df)(__m256d)(a), \
958 (double const *)(m), \
959 (__v4di)(__m256i)(i), \
960 (__v4df)(__m256d)(mask), (s)))
962 #define _mm_mask_i32gather_ps(a, m, i, mask, s) \
963 ((__m128)__builtin_ia32_gatherd_ps((__v4sf)(__m128)(a), \
964 (float const *)(m), \
965 (__v4si)(__m128i)(i), \
966 (__v4sf)(__m128)(mask), (s)))
968 #define _mm256_mask_i32gather_ps(a, m, i, mask, s) \
969 ((__m256)__builtin_ia32_gatherd_ps256((__v8sf)(__m256)(a), \
970 (float const *)(m), \
971 (__v8si)(__m256i)(i), \
972 (__v8sf)(__m256)(mask), (s)))
974 #define _mm_mask_i64gather_ps(a, m, i, mask, s) \
975 ((__m128)__builtin_ia32_gatherq_ps((__v4sf)(__m128)(a), \
976 (float const *)(m), \
977 (__v2di)(__m128i)(i), \
978 (__v4sf)(__m128)(mask), (s)))
980 #define _mm256_mask_i64gather_ps(a, m, i, mask, s) \
981 ((__m128)__builtin_ia32_gatherq_ps256((__v4sf)(__m128)(a), \
982 (float const *)(m), \
983 (__v4di)(__m256i)(i), \
984 (__v4sf)(__m128)(mask), (s)))
986 #define _mm_mask_i32gather_epi32(a, m, i, mask, s) \
987 ((__m128i)__builtin_ia32_gatherd_d((__v4si)(__m128i)(a), \
989 (__v4si)(__m128i)(i), \
990 (__v4si)(__m128i)(mask), (s)))
992 #define _mm256_mask_i32gather_epi32(a, m, i, mask, s) \
993 ((__m256i)__builtin_ia32_gatherd_d256((__v8si)(__m256i)(a), \
995 (__v8si)(__m256i)(i), \
996 (__v8si)(__m256i)(mask), (s)))
998 #define _mm_mask_i64gather_epi32(a, m, i, mask, s) \
999 ((__m128i)__builtin_ia32_gatherq_d((__v4si)(__m128i)(a), \
1001 (__v2di)(__m128i)(i), \
1002 (__v4si)(__m128i)(mask), (s)))
1004 #define _mm256_mask_i64gather_epi32(a, m, i, mask, s) \
1005 ((__m128i)__builtin_ia32_gatherq_d256((__v4si)(__m128i)(a), \
1007 (__v4di)(__m256i)(i), \
1008 (__v4si)(__m128i)(mask), (s)))
1010 #define _mm_mask_i32gather_epi64(a, m, i, mask, s) \
1011 ((__m128i)__builtin_ia32_gatherd_q((__v2di)(__m128i)(a), \
1012 (long long const *)(m), \
1013 (__v4si)(__m128i)(i), \
1014 (__v2di)(__m128i)(mask), (s)))
1016 #define _mm256_mask_i32gather_epi64(a, m, i, mask, s) \
1017 ((__m256i)__builtin_ia32_gatherd_q256((__v4di)(__m256i)(a), \
1018 (long long const *)(m), \
1019 (__v4si)(__m128i)(i), \
1020 (__v4di)(__m256i)(mask), (s)))
1022 #define _mm_mask_i64gather_epi64(a, m, i, mask, s) \
1023 ((__m128i)__builtin_ia32_gatherq_q((__v2di)(__m128i)(a), \
1024 (long long const *)(m), \
1025 (__v2di)(__m128i)(i), \
1026 (__v2di)(__m128i)(mask), (s)))
1028 #define _mm256_mask_i64gather_epi64(a, m, i, mask, s) \
1029 ((__m256i)__builtin_ia32_gatherq_q256((__v4di)(__m256i)(a), \
1030 (long long const *)(m), \
1031 (__v4di)(__m256i)(i), \
1032 (__v4di)(__m256i)(mask), (s)))
1034 #define _mm_i32gather_pd(m, i, s) \
1035 ((__m128d)__builtin_ia32_gatherd_pd((__v2df)_mm_undefined_pd(), \
1036 (double const *)(m), \
1037 (__v4si)(__m128i)(i), \
1038 (__v2df)_mm_cmpeq_pd(_mm_setzero_pd(), \
1039 _mm_setzero_pd()), \
1042 #define _mm256_i32gather_pd(m, i, s) \
1043 ((__m256d)__builtin_ia32_gatherd_pd256((__v4df)_mm256_undefined_pd(), \
1044 (double const *)(m), \
1045 (__v4si)(__m128i)(i), \
1046 (__v4df)_mm256_cmp_pd(_mm256_setzero_pd(), \
1047 _mm256_setzero_pd(), \
1051 #define _mm_i64gather_pd(m, i, s) \
1052 ((__m128d)__builtin_ia32_gatherq_pd((__v2df)_mm_undefined_pd(), \
1053 (double const *)(m), \
1054 (__v2di)(__m128i)(i), \
1055 (__v2df)_mm_cmpeq_pd(_mm_setzero_pd(), \
1056 _mm_setzero_pd()), \
1059 #define _mm256_i64gather_pd(m, i, s) \
1060 ((__m256d)__builtin_ia32_gatherq_pd256((__v4df)_mm256_undefined_pd(), \
1061 (double const *)(m), \
1062 (__v4di)(__m256i)(i), \
1063 (__v4df)_mm256_cmp_pd(_mm256_setzero_pd(), \
1064 _mm256_setzero_pd(), \
1068 #define _mm_i32gather_ps(m, i, s) \
1069 ((__m128)__builtin_ia32_gatherd_ps((__v4sf)_mm_undefined_ps(), \
1070 (float const *)(m), \
1071 (__v4si)(__m128i)(i), \
1072 (__v4sf)_mm_cmpeq_ps(_mm_setzero_ps(), \
1073 _mm_setzero_ps()), \
1076 #define _mm256_i32gather_ps(m, i, s) \
1077 ((__m256)__builtin_ia32_gatherd_ps256((__v8sf)_mm256_undefined_ps(), \
1078 (float const *)(m), \
1079 (__v8si)(__m256i)(i), \
1080 (__v8sf)_mm256_cmp_ps(_mm256_setzero_ps(), \
1081 _mm256_setzero_ps(), \
1085 #define _mm_i64gather_ps(m, i, s) \
1086 ((__m128)__builtin_ia32_gatherq_ps((__v4sf)_mm_undefined_ps(), \
1087 (float const *)(m), \
1088 (__v2di)(__m128i)(i), \
1089 (__v4sf)_mm_cmpeq_ps(_mm_setzero_ps(), \
1090 _mm_setzero_ps()), \
1093 #define _mm256_i64gather_ps(m, i, s) \
1094 ((__m128)__builtin_ia32_gatherq_ps256((__v4sf)_mm_undefined_ps(), \
1095 (float const *)(m), \
1096 (__v4di)(__m256i)(i), \
1097 (__v4sf)_mm_cmpeq_ps(_mm_setzero_ps(), \
1098 _mm_setzero_ps()), \
1101 #define _mm_i32gather_epi32(m, i, s) \
1102 ((__m128i)__builtin_ia32_gatherd_d((__v4si)_mm_undefined_si128(), \
1103 (int const *)(m), (__v4si)(__m128i)(i), \
1104 (__v4si)_mm_set1_epi32(-1), (s)))
1106 #define _mm256_i32gather_epi32(m, i, s) \
1107 ((__m256i)__builtin_ia32_gatherd_d256((__v8si)_mm256_undefined_si256(), \
1108 (int const *)(m), (__v8si)(__m256i)(i), \
1109 (__v8si)_mm256_set1_epi32(-1), (s)))
1111 #define _mm_i64gather_epi32(m, i, s) \
1112 ((__m128i)__builtin_ia32_gatherq_d((__v4si)_mm_undefined_si128(), \
1113 (int const *)(m), (__v2di)(__m128i)(i), \
1114 (__v4si)_mm_set1_epi32(-1), (s)))
1116 #define _mm256_i64gather_epi32(m, i, s) \
1117 ((__m128i)__builtin_ia32_gatherq_d256((__v4si)_mm_undefined_si128(), \
1118 (int const *)(m), (__v4di)(__m256i)(i), \
1119 (__v4si)_mm_set1_epi32(-1), (s)))
1121 #define _mm_i32gather_epi64(m, i, s) \
1122 ((__m128i)__builtin_ia32_gatherd_q((__v2di)_mm_undefined_si128(), \
1123 (long long const *)(m), \
1124 (__v4si)(__m128i)(i), \
1125 (__v2di)_mm_set1_epi64x(-1), (s)))
1127 #define _mm256_i32gather_epi64(m, i, s) \
1128 ((__m256i)__builtin_ia32_gatherd_q256((__v4di)_mm256_undefined_si256(), \
1129 (long long const *)(m), \
1130 (__v4si)(__m128i)(i), \
1131 (__v4di)_mm256_set1_epi64x(-1), (s)))
1133 #define _mm_i64gather_epi64(m, i, s) \
1134 ((__m128i)__builtin_ia32_gatherq_q((__v2di)_mm_undefined_si128(), \
1135 (long long const *)(m), \
1136 (__v2di)(__m128i)(i), \
1137 (__v2di)_mm_set1_epi64x(-1), (s)))
1139 #define _mm256_i64gather_epi64(m, i, s) \
1140 ((__m256i)__builtin_ia32_gatherq_q256((__v4di)_mm256_undefined_si256(), \
1141 (long long const *)(m), \
1142 (__v4di)(__m256i)(i), \
1143 (__v4di)_mm256_set1_epi64x(-1), (s)))
1145 #undef __DEFAULT_FN_ATTRS256
1146 #undef __DEFAULT_FN_ATTRS128
1148 #endif /* __AVX2INTRIN_H */