11 "Never use <avx10_2bf16intrin.h> directly; include <immintrin.h> instead."
16#ifndef __AVX10_2BF16INTRIN_H
17#define __AVX10_2BF16INTRIN_H
19typedef __bf16 __m128bh_u
__attribute__((__vector_size__(16), __aligned__(1)));
20typedef __bf16 __m256bh_u
__attribute__((__vector_size__(32), __aligned__(1)));
23#define __DEFAULT_FN_ATTRS256 \
24 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"), \
25 __min_vector_width__(256)))
26#define __DEFAULT_FN_ATTRS128 \
27 __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"), \
28 __min_vector_width__(128)))
43_mm256_castpbf16_ps(__m256bh
__a) {
48_mm256_castpbf16_pd(__m256bh
__a) {
57_mm_castpbf16_si128(__m128bh
__a) {
62_mm256_castpbf16_si256(__m256bh
__a) {
79_mm256_cvtsbh_bf16(__m256bh
__a) {
88_mm256_castpd_pbh(__m256d
__a) {
93_mm_castsi128_pbh(__m128i
__a) {
98_mm256_castsi256_pbh(__m256i
__a) {
103_mm256_castpbf16256_pbh128(__m256bh
__a) {
104 return __builtin_shufflevector(
__a,
__a, 0, 1, 2, 3, 4, 5, 6, 7);
108_mm256_castpbf16128_pbh256(__m128bh
__a) {
109 return __builtin_shufflevector(
__a,
__a, 0, 1, 2, 3, 4, 5, 6, 7, -1, -1, -1,
114_mm256_zextpbf16128_pbh256(__m128bh
__a) {
115 return __builtin_shufflevector(
__a, (__v8bf)_mm_setzero_pbh(), 0, 1, 2, 3, 4,
116 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
120 return (__m256bh)__builtin_ia32_undef256();
124_mm_load_sbh(
void const *__dp) {
125 __m128bh src = (__v8bf)_mm_setzero_pbh();
126 return (__m128bh)__builtin_ia32_loadsbf16128_mask((
const __v8bf *)__dp, src,
131_mm_mask_load_sbh(__m128bh __W,
__mmask8 __U,
const void *__A) {
132 __m128bh src = (__v8bf)__builtin_shufflevector(
133 (__v8bf)__W, (__v8bf)_mm_setzero_pbh(), 0, 8, 8, 8, 8, 8, 8, 8);
135 return (__m128bh)__builtin_ia32_loadsbf16128_mask((
const __v8bf *)__A, src,
140_mm_maskz_load_sbh(
__mmask8 __U,
const void *__A) {
141 return (__m128bh)__builtin_ia32_loadsbf16128_mask(
142 (
const __v8bf *)__A, (__v8bf)_mm_setzero_pbh(), __U & 1);
146_mm256_load_pbh(
void const *
__p) {
147 return *(
const __m256bh *)
__p;
151 return *(
const __m128bh *)
__p;
155_mm256_loadu_pbh(
void const *
__p) {
159 return ((
const struct __loadu_pbh *)
__p)->__v;
163_mm_loadu_pbh(
void const *
__p) {
167 return ((
const struct __loadu_pbh *)
__p)->__v;
172 struct __mm_store_sbh_struct {
175 ((
struct __mm_store_sbh_struct *)__dp)->__u =
__a[0];
181 __builtin_ia32_storesbf16128_mask((__v8bf *)__W, __A, __U & 1);
186 *(__m256bh *)
__P = __A;
191 *(__m128bh *)
__P = __A;
196 struct __storeu_pbh {
199 ((
struct __storeu_pbh *)
__P)->__v = __A;
204 struct __storeu_pbh {
207 ((
struct __storeu_pbh *)
__P)->__v = __A;
217_mm_mask_move_sbh(__m128bh __W,
__mmask8 __U, __m128bh __A, __m128bh __B) {
218 return __builtin_ia32_selectsbf_128(__U, _mm_move_sbh(__A, __B), __W);
222_mm_maskz_move_sbh(
__mmask8 __U, __m128bh __A, __m128bh __B) {
223 return __builtin_ia32_selectsbf_128(__U, _mm_move_sbh(__A, __B),
228 return (__m128bh)__builtin_ia32_undef128();
232 return (__v8bf)__builtin_shufflevector(
233 (__v8bf){bf, bf, bf, bf, bf, bf, bf, bf}, (__v8bf)_mm_setzero_pbh(), 0, 8,
238 return (__m128bh)(__v8bf){bf, bf, bf, bf, bf, bf, bf, bf};
242 return (__m256bh)(__v16bf){bf, bf, bf, bf, bf, bf, bf, bf,
243 bf, bf, bf, bf, bf, bf, bf, bf};
247_mm_set_pbh(__bf16 bf1, __bf16 bf2, __bf16 bf3, __bf16 bf4, __bf16 bf5,
248 __bf16 bf6, __bf16 bf7, __bf16 bf8) {
249 return (__m128bh)(__v8bf){bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8};
253 __bf16 bf1, __bf16 bf2, __bf16 bf3, __bf16 bf4, __bf16 bf5, __bf16 bf6,
254 __bf16 bf7, __bf16 bf8, __bf16 bf9, __bf16 bf10, __bf16 bf11, __bf16 bf12,
255 __bf16 bf13, __bf16 bf14, __bf16 bf15, __bf16 bf16) {
256 return (__m256bh)(__v16bf){bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
257 bf9, bf10, bf11, bf12, bf13, bf14, bf15, bf16};
260#define _mm_setr_pbh(bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8) \
261 _mm_set_pbh((bf8), (bf7), (bf6), (bf5), (bf4), (bf3), (bf2), (bf1))
263#define _mm256_setr_pbh(bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8, bf9, bf10, \
264 bf11, bf12, bf13, bf14, bf15, bf16) \
265 _mm256_set_pbh((bf16), (bf15), (bf14), (bf13), (bf12), (bf11), (bf10), \
266 (bf9), (bf8), (bf7), (bf6), (bf5), (bf4), (bf3), (bf2), \
279_mm_mask_blend_pbh(
__mmask8 __U, __m128bh __A, __m128bh __W) {
280 return (__m128bh)__builtin_ia32_selectpbf_128((
__mmask8)__U, (__v8bf)__W,
285_mm256_mask_blend_pbh(
__mmask16 __U, __m256bh __A, __m256bh __W) {
286 return (__m256bh)__builtin_ia32_selectpbf_256((
__mmask16)__U, (__v16bf)__W,
291_mm_permutex2var_pbh(__m128bh __A, __m128i __I, __m128bh __B) {
292 return (__m128bh)__builtin_ia32_vpermi2varhi128((__v8hi)__A, (__v8hi)__I,
297_mm256_permutex2var_pbh(__m256bh __A, __m256i __I, __m256bh __B) {
298 return (__m256bh)__builtin_ia32_vpermi2varhi256((__v16hi)__A, (__v16hi)__I,
303_mm_permutexvar_pbh(__m128i __A, __m128bh __B) {
304 return (__m128bh)__builtin_ia32_permvarhi128((__v8hi)__B, (__v8hi)__A);
308_mm256_permutexvar_pbh(__m256i __A, __m256bh __B) {
309 return (__m256bh)__builtin_ia32_permvarhi256((__v16hi)__B, (__v16hi)__A);
313_mm256_addne_pbh(__m256bh __A, __m256bh __B) {
314 return (__m256bh)((__v16bf)__A + (__v16bf)__B);
318_mm256_mask_addne_pbh(__m256bh __W,
__mmask16 __U, __m256bh __A, __m256bh __B) {
319 return (__m256bh)__builtin_ia32_selectpbf_256(
320 (
__mmask16)__U, (__v16bf)_mm256_addne_pbh(__A, __B), (__v16bf)__W);
324_mm256_maskz_addne_pbh(
__mmask16 __U, __m256bh __A, __m256bh __B) {
325 return (__m256bh)__builtin_ia32_selectpbf_256(
326 (
__mmask16)__U, (__v16bf)_mm256_addne_pbh(__A, __B),
327 (__v16bf)_mm256_setzero_pbh());
332 return (__m128bh)((__v8bf)__A + (__v8bf)__B);
336_mm_mask_addne_pbh(__m128bh __W,
__mmask8 __U, __m128bh __A, __m128bh __B) {
337 return (__m128bh)__builtin_ia32_selectpbf_128(
338 (
__mmask8)__U, (__v8bf)_mm_addne_pbh(__A, __B), (__v8bf)__W);
342_mm_maskz_addne_pbh(
__mmask8 __U, __m128bh __A, __m128bh __B) {
343 return (__m128bh)__builtin_ia32_selectpbf_128((
__mmask8)__U,
344 (__v8bf)_mm_addne_pbh(__A, __B),
345 (__v8bf)_mm_setzero_pbh());
349_mm256_subne_pbh(__m256bh __A, __m256bh __B) {
350 return (__m256bh)((__v16bf)__A - (__v16bf)__B);
354_mm256_mask_subne_pbh(__m256bh __W,
__mmask16 __U, __m256bh __A, __m256bh __B) {
355 return (__m256bh)__builtin_ia32_selectpbf_256(
356 (
__mmask16)__U, (__v16bf)_mm256_subne_pbh(__A, __B), (__v16bf)__W);
360_mm256_maskz_subne_pbh(
__mmask16 __U, __m256bh __A, __m256bh __B) {
361 return (__m256bh)__builtin_ia32_selectpbf_256(
362 (
__mmask16)__U, (__v16bf)_mm256_subne_pbh(__A, __B),
363 (__v16bf)_mm256_setzero_pbh());
368 return (__m128bh)((__v8bf)__A - (__v8bf)__B);
372_mm_mask_subne_pbh(__m128bh __W,
__mmask8 __U, __m128bh __A, __m128bh __B) {
373 return (__m128bh)__builtin_ia32_selectpbf_128(
374 (
__mmask8)__U, (__v8bf)_mm_subne_pbh(__A, __B), (__v8bf)__W);
378_mm_maskz_subne_pbh(
__mmask8 __U, __m128bh __A, __m128bh __B) {
379 return (__m128bh)__builtin_ia32_selectpbf_128((
__mmask8)__U,
380 (__v8bf)_mm_subne_pbh(__A, __B),
381 (__v8bf)_mm_setzero_pbh());
385_mm256_mulne_pbh(__m256bh __A, __m256bh __B) {
386 return (__m256bh)((__v16bf)__A * (__v16bf)__B);
390_mm256_mask_mulne_pbh(__m256bh __W,
__mmask16 __U, __m256bh __A, __m256bh __B) {
391 return (__m256bh)__builtin_ia32_selectpbf_256(
392 (
__mmask16)__U, (__v16bf)_mm256_mulne_pbh(__A, __B), (__v16bf)__W);
396_mm256_maskz_mulne_pbh(
__mmask16 __U, __m256bh __A, __m256bh __B) {
397 return (__m256bh)__builtin_ia32_selectpbf_256(
398 (
__mmask16)__U, (__v16bf)_mm256_mulne_pbh(__A, __B),
399 (__v16bf)_mm256_setzero_pbh());
404 return (__m128bh)((__v8bf)__A * (__v8bf)__B);
408_mm_mask_mulne_pbh(__m128bh __W,
__mmask8 __U, __m128bh __A, __m128bh __B) {
409 return (__m128bh)__builtin_ia32_selectpbf_128(
410 (
__mmask8)__U, (__v8bf)_mm_mulne_pbh(__A, __B), (__v8bf)__W);
414_mm_maskz_mulne_pbh(
__mmask8 __U, __m128bh __A, __m128bh __B) {
415 return (__m128bh)__builtin_ia32_selectpbf_128((
__mmask8)__U,
416 (__v8bf)_mm_mulne_pbh(__A, __B),
417 (__v8bf)_mm_setzero_pbh());
421_mm256_divne_pbh(__m256bh __A, __m256bh __B) {
422 return (__m256bh)((__v16bf)__A / (__v16bf)__B);
426_mm256_mask_divne_pbh(__m256bh __W,
__mmask16 __U, __m256bh __A, __m256bh __B) {
427 return (__m256bh)__builtin_ia32_selectpbf_256(
428 (
__mmask16)__U, (__v16bf)_mm256_divne_pbh(__A, __B), (__v16bf)__W);
432_mm256_maskz_divne_pbh(
__mmask16 __U, __m256bh __A, __m256bh __B) {
433 return (__m256bh)__builtin_ia32_selectpbf_256(
434 (
__mmask16)__U, (__v16bf)_mm256_divne_pbh(__A, __B),
435 (__v16bf)_mm256_setzero_pbh());
440 return (__m128bh)((__v8bf)__A / (__v8bf)__B);
444_mm_mask_divne_pbh(__m128bh __W,
__mmask8 __U, __m128bh __A, __m128bh __B) {
445 return (__m128bh)__builtin_ia32_selectpbf_128(
446 (
__mmask8)__U, (__v8bf)_mm_divne_pbh(__A, __B), (__v8bf)__W);
450_mm_maskz_divne_pbh(
__mmask8 __U, __m128bh __A, __m128bh __B) {
451 return (__m128bh)__builtin_ia32_selectpbf_128((
__mmask8)__U,
452 (__v8bf)_mm_divne_pbh(__A, __B),
453 (__v8bf)_mm_setzero_pbh());
458 return (__m256bh)__builtin_ia32_vmaxpbf16256((__v16bf)__A, (__v16bf)__B);
462_mm256_mask_max_pbh(__m256bh __W,
__mmask16 __U, __m256bh __A, __m256bh __B) {
463 return (__m256bh)__builtin_ia32_selectpbf_256(
464 (
__mmask16)__U, (__v16bf)_mm256_max_pbh(__A, __B), (__v16bf)__W);
468_mm256_maskz_max_pbh(
__mmask16 __U, __m256bh __A, __m256bh __B) {
469 return (__m256bh)__builtin_ia32_selectpbf_256(
470 (
__mmask16)__U, (__v16bf)_mm256_max_pbh(__A, __B),
471 (__v16bf)_mm256_setzero_pbh());
476 return (__m128bh)__builtin_ia32_vmaxpbf16128((__v8bf)__A, (__v8bf)__B);
480_mm_mask_max_pbh(__m128bh __W,
__mmask8 __U, __m128bh __A, __m128bh __B) {
481 return (__m128bh)__builtin_ia32_selectpbf_128(
482 (
__mmask8)__U, (__v8bf)_mm_max_pbh(__A, __B), (__v8bf)__W);
486_mm_maskz_max_pbh(
__mmask8 __U, __m128bh __A, __m128bh __B) {
487 return (__m128bh)__builtin_ia32_selectpbf_128(
488 (
__mmask8)__U, (__v8bf)_mm_max_pbh(__A, __B), (__v8bf)_mm_setzero_pbh());
493 return (__m256bh)__builtin_ia32_vminpbf16256((__v16bf)__A, (__v16bf)__B);
497_mm256_mask_min_pbh(__m256bh __W,
__mmask16 __U, __m256bh __A, __m256bh __B) {
498 return (__m256bh)__builtin_ia32_selectpbf_256(
499 (
__mmask16)__U, (__v16bf)_mm256_min_pbh(__A, __B), (__v16bf)__W);
503_mm256_maskz_min_pbh(
__mmask16 __U, __m256bh __A, __m256bh __B) {
504 return (__m256bh)__builtin_ia32_selectpbf_256(
505 (
__mmask16)__U, (__v16bf)_mm256_min_pbh(__A, __B),
506 (__v16bf)_mm256_setzero_pbh());
511 return (__m128bh)__builtin_ia32_vminpbf16128((__v8bf)__A, (__v8bf)__B);
515_mm_mask_min_pbh(__m128bh __W,
__mmask8 __U, __m128bh __A, __m128bh __B) {
516 return (__m128bh)__builtin_ia32_selectpbf_128(
517 (
__mmask8)__U, (__v8bf)_mm_min_pbh(__A, __B), (__v8bf)__W);
521_mm_maskz_min_pbh(
__mmask8 __U, __m128bh __A, __m128bh __B) {
522 return (__m128bh)__builtin_ia32_selectpbf_128(
523 (
__mmask8)__U, (__v8bf)_mm_min_pbh(__A, __B), (__v8bf)_mm_setzero_pbh());
528 return __builtin_ia32_vcomsbf16eq((__v8bf)A, (__v8bf)B);
533 return __builtin_ia32_vcomsbf16lt((__v8bf)A, (__v8bf)B);
538 return __builtin_ia32_vcomsbf16le((__v8bf)A, (__v8bf)B);
543 return __builtin_ia32_vcomsbf16gt((__v8bf)A, (__v8bf)B);
548 return __builtin_ia32_vcomsbf16ge((__v8bf)A, (__v8bf)B);
553 return __builtin_ia32_vcomsbf16neq((__v8bf)A, (__v8bf)B);
556#define _mm256_cmp_pbh_mask(__A, __B, __P) \
557 ((__mmask16)__builtin_ia32_vcmppbf16256_mask((__v16bf)(__m256bh)(__A), \
558 (__v16bf)(__m256bh)(__B), \
559 (int)(__P), (__mmask16) - 1))
561#define _mm256_mask_cmp_pbh_mask(__U, __A, __B, __P) \
562 ((__mmask16)__builtin_ia32_vcmppbf16256_mask((__v16bf)(__m256bh)(__A), \
563 (__v16bf)(__m256bh)(__B), \
564 (int)(__P), (__mmask16)(__U)))
566#define _mm_cmp_pbh_mask(__A, __B, __P) \
567 ((__mmask8)__builtin_ia32_vcmppbf16128_mask((__v8bf)(__m128bh)(__A), \
568 (__v8bf)(__m128bh)(__B), \
569 (int)(__P), (__mmask8) - 1))
571#define _mm_mask_cmp_pbh_mask(__U, __A, __B, __P) \
572 ((__mmask8)__builtin_ia32_vcmppbf16128_mask((__v8bf)(__m128bh)(__A), \
573 (__v8bf)(__m128bh)(__B), \
574 (int)(__P), (__mmask8)(__U)))
576#define _mm256_mask_fpclass_pbh_mask(__U, __A, imm) \
577 ((__mmask16)__builtin_ia32_vfpclasspbf16256_mask( \
578 (__v16bf)(__m256bh)(__A), (int)(imm), (__mmask16)(__U)))
580#define _mm256_fpclass_pbh_mask(__A, imm) \
581 ((__mmask16)__builtin_ia32_vfpclasspbf16256_mask( \
582 (__v16bf)(__m256bh)(__A), (int)(imm), (__mmask16) - 1))
584#define _mm_mask_fpclass_pbh_mask(__U, __A, imm) \
585 ((__mmask8)__builtin_ia32_vfpclasspbf16128_mask( \
586 (__v8bf)(__m128bh)(__A), (int)(imm), (__mmask8)(__U)))
588#define _mm_fpclass_pbh_mask(__A, imm) \
589 ((__mmask8)__builtin_ia32_vfpclasspbf16128_mask((__v8bf)(__m128bh)(__A), \
590 (int)(imm), (__mmask8) - 1))
593_mm256_scalef_pbh(__m256bh __A, __m256bh __B) {
594 return (__m256bh)__builtin_ia32_vscalefpbf16256_mask(
595 (__v16bf)__A, (__v16bf)__B, (__v16bf)_mm256_undefined_pbh(),
600 __m256bh __W,
__mmask16 __U, __m256bh __A, __m256bh __B) {
601 return (__m256bh)__builtin_ia32_vscalefpbf16256_mask(
602 (__v16bf)__A, (__v16bf)__B, (__v16bf)__W, (
__mmask16)__U);
606_mm256_maskz_scalef_pbh(
__mmask16 __U, __m256bh __A, __m256bh __B) {
607 return (__m256bh)__builtin_ia32_vscalefpbf16256_mask(
608 (__v16bf)__A, (__v16bf)__B, (__v16bf)_mm256_setzero_pbh(),
614 return (__m128bh)__builtin_ia32_vscalefpbf16128_mask(
615 (__v8bf)__A, (__v8bf)__B, (__v8bf)_mm_undefined_pbh(), (
__mmask8)-1);
619_mm_mask_scalef_pbh(__m128bh __W,
__mmask8 __U, __m128bh __A, __m128bh __B) {
620 return (__m128bh)__builtin_ia32_vscalefpbf16128_mask(
621 (__v8bf)__A, (__v8bf)__B, (__v8bf)__W, (
__mmask8)__U);
625_mm_maskz_scalef_pbh(
__mmask8 __U, __m128bh __A, __m128bh __B) {
626 return (__m128bh)__builtin_ia32_vscalefpbf16128_mask(
627 (__v8bf)__A, (__v8bf)__B, (__v8bf)_mm_setzero_pbh(), (
__mmask8)__U);
631 return (__m256bh)__builtin_ia32_vrcppbf16256_mask(
632 (__v16bf)__A, (__v16bf)_mm256_undefined_pbh(), (
__mmask16)-1);
636_mm256_mask_rcp_pbh(__m256bh __W,
__mmask16 __U, __m256bh __A) {
637 return (__m256bh)__builtin_ia32_vrcppbf16256_mask((__v16bf)__A, (__v16bf)__W,
642_mm256_maskz_rcp_pbh(
__mmask16 __U, __m256bh __A) {
643 return (__m256bh)__builtin_ia32_vrcppbf16256_mask(
644 (__v16bf)__A, (__v16bf)_mm256_setzero_pbh(), (
__mmask16)__U);
648 return (__m128bh)__builtin_ia32_vrcppbf16128_mask(
649 (__v8bf)__A, (__v8bf)_mm_undefined_pbh(), (
__mmask8)-1);
653_mm_mask_rcp_pbh(__m128bh __W,
__mmask8 __U, __m128bh __A) {
654 return (__m128bh)__builtin_ia32_vrcppbf16128_mask((__v8bf)__A, (__v8bf)__W,
659_mm_maskz_rcp_pbh(
__mmask8 __U, __m128bh __A) {
660 return (__m128bh)__builtin_ia32_vrcppbf16128_mask(
661 (__v8bf)__A, (__v8bf)_mm_setzero_pbh(), (
__mmask8)__U);
665_mm256_getexp_pbh(__m256bh __A) {
666 return (__m256bh)__builtin_ia32_vgetexppbf16256_mask(
667 (__v16bf)__A, (__v16bf)_mm256_undefined_pbh(), (
__mmask16)-1);
671_mm256_mask_getexp_pbh(__m256bh __W,
__mmask16 __U, __m256bh __A) {
672 return (__m256bh)__builtin_ia32_vgetexppbf16256_mask(
673 (__v16bf)__A, (__v16bf)__W, (
__mmask16)__U);
677_mm256_maskz_getexp_pbh(
__mmask16 __U, __m256bh __A) {
678 return (__m256bh)__builtin_ia32_vgetexppbf16256_mask(
679 (__v16bf)__A, (__v16bf)_mm256_setzero_pbh(), (
__mmask16)__U);
683 return (__m128bh)__builtin_ia32_vgetexppbf16128_mask(
684 (__v8bf)__A, (__v8bf)_mm_undefined_pbh(), (
__mmask8)-1);
688_mm_mask_getexp_pbh(__m128bh __W,
__mmask8 __U, __m128bh __A) {
689 return (__m128bh)__builtin_ia32_vgetexppbf16128_mask((__v8bf)__A, (__v8bf)__W,
694_mm_maskz_getexp_pbh(
__mmask8 __U, __m128bh __A) {
695 return (__m128bh)__builtin_ia32_vgetexppbf16128_mask(
696 (__v8bf)__A, (__v8bf)_mm_setzero_pbh(), (
__mmask8)__U);
700_mm256_rsqrt_pbh(__m256bh __A) {
701 return (__m256bh)__builtin_ia32_vrsqrtpbf16256_mask(
702 (__v16bf)__A, (__v16bf)_mm256_undefined_pbh(), (
__mmask16)-1);
706_mm256_mask_rsqrt_pbh(__m256bh __W,
__mmask16 __U, __m256bh __A) {
707 return (__m256bh)__builtin_ia32_vrsqrtpbf16256_mask(
708 (__v16bf)__A, (__v16bf)__W, (
__mmask16)__U);
712_mm256_maskz_rsqrt_pbh(
__mmask16 __U, __m256bh __A) {
713 return (__m256bh)__builtin_ia32_vrsqrtpbf16256_mask(
714 (__v16bf)__A, (__v16bf)_mm256_setzero_pbh(), (
__mmask16)__U);
718 return (__m128bh)__builtin_ia32_vrsqrtpbf16128_mask(
719 (__v8bf)__A, (__v8bf)_mm_undefined_pbh(), (
__mmask8)-1);
723_mm_mask_rsqrt_pbh(__m128bh __W,
__mmask8 __U, __m128bh __A) {
724 return (__m128bh)__builtin_ia32_vrsqrtpbf16128_mask((__v8bf)__A, (__v8bf)__W,
729_mm_maskz_rsqrt_pbh(
__mmask8 __U, __m128bh __A) {
730 return (__m128bh)__builtin_ia32_vrsqrtpbf16128_mask(
731 (__v8bf)__A, (__v8bf)_mm_setzero_pbh(), (
__mmask8)__U);
734#define _mm256_reducene_pbh(__A, imm) \
735 ((__m256bh)__builtin_ia32_vreducenepbf16256_mask( \
736 (__v16bf)(__m256bh)(__A), (int)(imm), (__v16bf)_mm256_undefined_pbh(), \
739#define _mm256_mask_reducene_pbh(__W, __U, __A, imm) \
740 ((__m256bh)__builtin_ia32_vreducenepbf16256_mask( \
741 (__v16bf)(__m256bh)(__A), (int)(imm), (__v16bf)(__m256bh)(__W), \
744#define _mm256_maskz_reducene_pbh(__U, __A, imm) \
745 ((__m256bh)__builtin_ia32_vreducenepbf16256_mask( \
746 (__v16bf)(__m256bh)(__A), (int)(imm), (__v16bf)_mm256_setzero_pbh(), \
749#define _mm_reducene_pbh(__A, imm) \
750 ((__m128bh)__builtin_ia32_vreducenepbf16128_mask( \
751 (__v8bf)(__m128bh)(__A), (int)(imm), (__v8bf)_mm_undefined_pbh(), \
754#define _mm_mask_reducene_pbh(__W, __U, __A, imm) \
755 ((__m128bh)__builtin_ia32_vreducenepbf16128_mask( \
756 (__v8bf)(__m128bh)(__A), (int)(imm), (__v8bf)(__m128bh)(__W), \
759#define _mm_maskz_reducene_pbh(__U, __A, imm) \
760 ((__m128bh)__builtin_ia32_vreducenepbf16128_mask( \
761 (__v8bf)(__m128bh)(__A), (int)(imm), (__v8bf)_mm_setzero_pbh(), \
764#define _mm256_roundscalene_pbh(__A, imm) \
765 ((__m256bh)__builtin_ia32_vrndscalenepbf16_256_mask( \
766 (__v16bf)(__m256bh)(__A), (int)(imm), (__v16bf)_mm256_setzero_pbh(), \
769#define _mm256_mask_roundscalene_pbh(__W, __U, __A, imm) \
770 ((__m256bh)__builtin_ia32_vrndscalenepbf16_256_mask( \
771 (__v16bf)(__m256bh)(__A), (int)(imm), (__v16bf)(__m256bh)(__W), \
774#define _mm256_maskz_roundscalene_pbh(__U, __A, imm) \
775 ((__m256bh)__builtin_ia32_vrndscalenepbf16_256_mask( \
776 (__v16bf)(__m256bh)(__A), (int)(imm), (__v16bf)_mm256_setzero_pbh(), \
779#define _mm_roundscalene_pbh(__A, imm) \
780 ((__m128bh)__builtin_ia32_vrndscalenepbf16_128_mask( \
781 (__v8bf)(__m128bh)(__A), (int)(imm), (__v8bf)_mm_setzero_pbh(), \
784#define _mm_mask_roundscalene_pbh(__W, __U, __A, imm) \
785 ((__m128bh)__builtin_ia32_vrndscalenepbf16_128_mask( \
786 (__v8bf)(__m128bh)(__A), (int)(imm), (__v8bf)(__m128bh)(__W), \
789#define _mm_maskz_roundscalene_pbh(__U, __A, imm) \
790 ((__m128bh)__builtin_ia32_vrndscalenepbf16_128_mask( \
791 (__v8bf)(__m128bh)(__A), (int)(imm), (__v8bf)_mm_setzero_pbh(), \
794#define _mm256_getmant_pbh(__A, __B, __C) \
795 ((__m256bh)__builtin_ia32_vgetmantpbf16256_mask( \
796 (__v16bf)(__m256bh)(__A), (int)(((__C) << 2) | (__B)), \
797 (__v16bf)_mm256_undefined_pbh(), (__mmask16) - 1))
799#define _mm256_mask_getmant_pbh(__W, __U, __A, __B, __C) \
800 ((__m256bh)__builtin_ia32_vgetmantpbf16256_mask( \
801 (__v16bf)(__m256bh)(__A), (int)(((__C) << 2) | (__B)), \
802 (__v16bf)(__m256bh)(__W), (__mmask16)(__U)))
804#define _mm256_maskz_getmant_pbh(__U, __A, __B, __C) \
805 ((__m256bh)__builtin_ia32_vgetmantpbf16256_mask( \
806 (__v16bf)(__m256bh)(__A), (int)(((__C) << 2) | (__B)), \
807 (__v16bf)_mm256_setzero_pbh(), (__mmask16)(__U)))
809#define _mm_getmant_pbh(__A, __B, __C) \
810 ((__m128bh)__builtin_ia32_vgetmantpbf16128_mask( \
811 (__v8bf)(__m128bh)(__A), (int)(((__C) << 2) | (__B)), \
812 (__v8bf)_mm_undefined_pbh(), (__mmask8) - 1))
814#define _mm_mask_getmant_pbh(__W, __U, __A, __B, __C) \
815 ((__m128bh)__builtin_ia32_vgetmantpbf16128_mask( \
816 (__v8bf)(__m128bh)(__A), (int)(((__C) << 2) | (__B)), \
817 (__v8bf)(__m128bh)(__W), (__mmask8)(__U)))
819#define _mm_maskz_getmant_pbh(__U, __A, __B, __C) \
820 ((__m128bh)__builtin_ia32_vgetmantpbf16128_mask( \
821 (__v8bf)(__m128bh)(__A), (int)(((__C) << 2) | (__B)), \
822 (__v8bf)_mm_setzero_pbh(), (__mmask8)(__U)))
825 return (__m256bh)__builtin_ia32_vsqrtnepbf16256((__v16bf)__A);
829_mm256_mask_sqrt_pbh(__m256bh __W,
__mmask16 __U, __m256bh __A) {
830 return (__m256bh)__builtin_ia32_selectpbf_256(
831 (
__mmask16)__U, (__v16bf)_mm256_sqrt_pbh(__A), (__v16bf)__W);
835_mm256_maskz_sqrt_pbh(
__mmask16 __U, __m256bh __A) {
836 return (__m256bh)__builtin_ia32_selectpbf_256((
__mmask16)__U,
837 (__v16bf)_mm256_sqrt_pbh(__A),
838 (__v16bf)_mm256_setzero_pbh());
842 return (__m128bh)__builtin_ia32_vsqrtnepbf16((__v8bf)__A);
846_mm_mask_sqrt_pbh(__m128bh __W,
__mmask8 __U, __m128bh __A) {
847 return (__m128bh)__builtin_ia32_selectpbf_128(
848 (
__mmask8)__U, (__v8bf)_mm_sqrt_pbh(__A), (__v8bf)__W);
852_mm_maskz_sqrt_pbh(
__mmask8 __U, __m128bh __A) {
853 return (__m128bh)__builtin_ia32_selectpbf_128(
854 (
__mmask8)__U, (__v8bf)_mm_sqrt_pbh(__A), (__v8bf)_mm_setzero_pbh());
858_mm256_fmaddne_pbh(__m256bh __A, __m256bh __B, __m256bh __C) {
859 return (__m256bh)__builtin_ia32_vfmaddnepbh256((__v16bf)__A, (__v16bf)__B,
864 __m256bh __A,
__mmask16 __U, __m256bh __B, __m256bh __C) {
865 return (__m256bh)__builtin_ia32_selectpbf_256(
867 _mm256_fmaddne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
872 __m256bh __A, __m256bh __B, __m256bh __C,
__mmask16 __U) {
873 return (__m256bh)__builtin_ia32_selectpbf_256(
875 _mm256_fmaddne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
880 __mmask16 __U, __m256bh __A, __m256bh __B, __m256bh __C) {
881 return (__m256bh)__builtin_ia32_selectpbf_256(
883 _mm256_fmaddne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
884 (__v16bf)_mm256_setzero_pbh());
888_mm256_fmsubne_pbh(__m256bh __A, __m256bh __B, __m256bh __C) {
889 return (__m256bh)__builtin_ia32_vfmaddnepbh256((__v16bf)__A, (__v16bf)__B,
894 __m256bh __A,
__mmask16 __U, __m256bh __B, __m256bh __C) {
895 return (__m256bh)__builtin_ia32_selectpbf_256(
897 _mm256_fmsubne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
902 __m256bh __A, __m256bh __B, __m256bh __C,
__mmask16 __U) {
903 return (__m256bh)__builtin_ia32_selectpbf_256(
905 _mm256_fmsubne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
910 __mmask16 __U, __m256bh __A, __m256bh __B, __m256bh __C) {
911 return (__m256bh)__builtin_ia32_selectpbf_256(
913 _mm256_fmsubne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
914 (__v16bf)_mm256_setzero_pbh());
918_mm256_fnmaddne_pbh(__m256bh __A, __m256bh __B, __m256bh __C) {
919 return (__m256bh)__builtin_ia32_vfmaddnepbh256((__v16bf)__A, -(__v16bf)__B,
924 __m256bh __A,
__mmask16 __U, __m256bh __B, __m256bh __C) {
925 return (__m256bh)__builtin_ia32_selectpbf_256(
927 _mm256_fnmaddne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
932 __m256bh __A, __m256bh __B, __m256bh __C,
__mmask16 __U) {
933 return (__m256bh)__builtin_ia32_selectpbf_256(
935 _mm256_fnmaddne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
940 __mmask16 __U, __m256bh __A, __m256bh __B, __m256bh __C) {
941 return (__m256bh)__builtin_ia32_selectpbf_256(
943 _mm256_fnmaddne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
944 (__v16bf)_mm256_setzero_pbh());
948_mm256_fnmsubne_pbh(__m256bh __A, __m256bh __B, __m256bh __C) {
949 return (__m256bh)__builtin_ia32_vfmaddnepbh256((__v16bf)__A, -(__v16bf)__B,
954 __m256bh __A,
__mmask16 __U, __m256bh __B, __m256bh __C) {
955 return (__m256bh)__builtin_ia32_selectpbf_256(
957 _mm256_fnmsubne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
962 __m256bh __A, __m256bh __B, __m256bh __C,
__mmask16 __U) {
963 return (__m256bh)__builtin_ia32_selectpbf_256(
965 _mm256_fnmsubne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
970 __mmask16 __U, __m256bh __A, __m256bh __B, __m256bh __C) {
971 return (__m256bh)__builtin_ia32_selectpbf_256(
973 _mm256_fnmsubne_pbh((__v16bf)__A, (__v16bf)__B, (__v16bf)__C),
974 (__v16bf)_mm256_setzero_pbh());
980 return (__m128bh)__builtin_ia32_vfmaddnepbh128((__v8bf)__A, (__v8bf)__B,
985_mm_mask_fmaddne_pbh(__m128bh __A,
__mmask8 __U, __m128bh __B, __m128bh __C) {
986 return (__m128bh)__builtin_ia32_selectpbf_128(
987 (
__mmask8)__U, _mm_fmaddne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
992_mm_mask3_fmaddne_pbh(__m128bh __A, __m128bh __B, __m128bh __C,
__mmask8 __U) {
993 return (__m128bh)__builtin_ia32_selectpbf_128(
994 (
__mmask8)__U, _mm_fmaddne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
999_mm_maskz_fmaddne_pbh(
__mmask8 __U, __m128bh __A, __m128bh __B, __m128bh __C) {
1000 return (__m128bh)__builtin_ia32_selectpbf_128(
1001 (
__mmask8)__U, _mm_fmaddne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
1002 (__v8bf)_mm_setzero_pbh());
1008 return (__m128bh)__builtin_ia32_vfmaddnepbh128((__v8bf)__A, (__v8bf)__B,
1013_mm_mask_fmsubne_pbh(__m128bh __A,
__mmask8 __U, __m128bh __B, __m128bh __C) {
1014 return (__m128bh)__builtin_ia32_selectpbf_128(
1015 (
__mmask8)__U, _mm_fmsubne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
1020_mm_mask3_fmsubne_pbh(__m128bh __A, __m128bh __B, __m128bh __C,
__mmask8 __U) {
1021 return (__m128bh)__builtin_ia32_selectpbf_128(
1022 (
__mmask8)__U, _mm_fmsubne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
1027_mm_maskz_fmsubne_pbh(
__mmask8 __U, __m128bh __A, __m128bh __B, __m128bh __C) {
1028 return (__m128bh)__builtin_ia32_selectpbf_128(
1029 (
__mmask8)__U, _mm_fmsubne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
1030 (__v8bf)_mm_setzero_pbh());
1034_mm_fnmaddne_pbh(__m128bh __A, __m128bh __B, __m128bh __C) {
1035 return (__m128bh)__builtin_ia32_vfmaddnepbh128((__v8bf)__A, -(__v8bf)__B,
1040_mm_mask_fnmaddne_pbh(__m128bh __A,
__mmask8 __U, __m128bh __B, __m128bh __C) {
1041 return (__m128bh)__builtin_ia32_selectpbf_128(
1042 (
__mmask8)__U, _mm_fnmaddne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
1047_mm_mask3_fnmaddne_pbh(__m128bh __A, __m128bh __B, __m128bh __C,
__mmask8 __U) {
1048 return (__m128bh)__builtin_ia32_selectpbf_128(
1049 (
__mmask8)__U, _mm_fnmaddne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
1054_mm_maskz_fnmaddne_pbh(
__mmask8 __U, __m128bh __A, __m128bh __B, __m128bh __C) {
1055 return (__m128bh)__builtin_ia32_selectpbf_128(
1056 (
__mmask8)__U, _mm_fnmaddne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
1057 (__v8bf)_mm_setzero_pbh());
1061_mm_fnmsubne_pbh(__m128bh __A, __m128bh __B, __m128bh __C) {
1062 return (__m128bh)__builtin_ia32_vfmaddnepbh128((__v8bf)__A, -(__v8bf)__B,
1067_mm_mask_fnmsubne_pbh(__m128bh __A,
__mmask8 __U, __m128bh __B, __m128bh __C) {
1068 return (__m128bh)__builtin_ia32_selectpbf_128(
1069 (
__mmask8)__U, _mm_fnmsubne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
1074_mm_mask3_fnmsubne_pbh(__m128bh __A, __m128bh __B, __m128bh __C,
__mmask8 __U) {
1075 return (__m128bh)__builtin_ia32_selectpbf_128(
1076 (
__mmask8)__U, _mm_fnmsubne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
1081_mm_maskz_fnmsubne_pbh(
__mmask8 __U, __m128bh __A, __m128bh __B, __m128bh __C) {
1082 return (__m128bh)__builtin_ia32_selectpbf_128(
1083 (
__mmask8)__U, _mm_fnmsubne_pbh((__v8bf)__A, (__v8bf)__B, (__v8bf)__C),
1084 (__v8bf)_mm_setzero_pbh());
1087#undef __DEFAULT_FN_ATTRS128
1088#undef __DEFAULT_FN_ATTRS256
_Float16 __2f16 __attribute__((ext_vector_type(2)))
Zeroes the upper 128 bits (bits 255:128) of all YMM registers.
static __inline__ vector float vector float __b
static __inline__ uint32_t volatile uint32_t * __p
#define __DEFAULT_FN_ATTRS128
#define __DEFAULT_FN_ATTRS256
static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_and_epi32(__m256i __a, __m256i __b)
static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_and_epi32(__m128i __a, __m128i __b)
static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_setzero_ps(void)
Constructs a 256-bit floating-point vector of [8 x float] with all vector elements initialized to zer...
static __inline __m256i __DEFAULT_FN_ATTRS _mm256_set1_epi32(int __i)
Constructs a 256-bit integer vector of [8 x i32], with each of the 32-bit integral vector elements se...
static __inline__ void int __a
static __inline__ __m128i __DEFAULT_FN_ATTRS_CONSTEXPR _mm_set1_epi32(int __i)
Initializes all values in a 128-bit vector of [4 x i32] with the specified 32-bit value.
struct __storeu_i16 *__P __v
__inline unsigned int unsigned int unsigned int * __P
static __inline__ __m128 __DEFAULT_FN_ATTRS_CONSTEXPR _mm_setzero_ps(void)
Constructs a 128-bit floating-point vector of [4 x float] initialized to zero.