ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
avx512bf16intrin.h
Go to the documentation of this file.
1 /*===------------ avx512bf16intrin.h - AVX512_BF16 intrinsics --------------===
2  *
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
6  *
7  *===-----------------------------------------------------------------------===
8  */
9 #ifndef __IMMINTRIN_H
10 #error "Never use <avx512bf16intrin.h> directly; include <immintrin.h> instead."
11 #endif
12 
13 #ifndef __AVX512BF16INTRIN_H
14 #define __AVX512BF16INTRIN_H
15 
16 typedef short __m512bh __attribute__((__vector_size__(64), __aligned__(64)));
17 typedef short __m256bh __attribute__((__vector_size__(32), __aligned__(32)));
18 typedef unsigned short __bfloat16;
19 
20 #define __DEFAULT_FN_ATTRS512 \
21  __attribute__((__always_inline__, __nodebug__, __target__("avx512bf16"), \
22  __min_vector_width__(512)))
23 #define __DEFAULT_FN_ATTRS \
24  __attribute__((__always_inline__, __nodebug__, __target__("avx512bf16")))
25 
36 static __inline__ float __DEFAULT_FN_ATTRS _mm_cvtsbh_ss(__bfloat16 __A) {
37  return __builtin_ia32_cvtsbf162ss_32(__A);
38 }
39 
52 static __inline__ __m512bh __DEFAULT_FN_ATTRS512
53 _mm512_cvtne2ps_pbh(__m512 __A, __m512 __B) {
54  return (__m512bh)__builtin_ia32_cvtne2ps2bf16_512((__v16sf) __A,
55  (__v16sf) __B);
56 }
57 
75 static __inline__ __m512bh __DEFAULT_FN_ATTRS512
76 _mm512_mask_cvtne2ps_pbh(__m512bh __W, __mmask32 __U, __m512 __A, __m512 __B) {
77  return (__m512bh)__builtin_ia32_selectw_512((__mmask32)__U,
78  (__v32hi)_mm512_cvtne2ps_pbh(__A, __B),
79  (__v32hi)__W);
80 }
81 
97 static __inline__ __m512bh __DEFAULT_FN_ATTRS512
98 _mm512_maskz_cvtne2ps_pbh(__mmask32 __U, __m512 __A, __m512 __B) {
99  return (__m512bh)__builtin_ia32_selectw_512((__mmask32)__U,
100  (__v32hi)_mm512_cvtne2ps_pbh(__A, __B),
101  (__v32hi)_mm512_setzero_si512());
102 }
103 
113 static __inline__ __m256bh __DEFAULT_FN_ATTRS512
114 _mm512_cvtneps_pbh(__m512 __A) {
115  return (__m256bh)__builtin_ia32_cvtneps2bf16_512_mask((__v16sf)__A,
116  (__v16hi)_mm256_undefined_si256(),
117  (__mmask16)-1);
118 }
119 
134 static __inline__ __m256bh __DEFAULT_FN_ATTRS512
135 _mm512_mask_cvtneps_pbh(__m256bh __W, __mmask16 __U, __m512 __A) {
136  return (__m256bh)__builtin_ia32_cvtneps2bf16_512_mask((__v16sf)__A,
137  (__v16hi)__W,
138  (__mmask16)__U);
139 }
140 
153 static __inline__ __m256bh __DEFAULT_FN_ATTRS512
155  return (__m256bh)__builtin_ia32_cvtneps2bf16_512_mask((__v16sf)__A,
156  (__v16hi)_mm256_setzero_si256(),
157  (__mmask16)__U);
158 }
159 
174 static __inline__ __m512 __DEFAULT_FN_ATTRS512
175 _mm512_dpbf16_ps(__m512 __D, __m512bh __A, __m512bh __B) {
176  return (__m512)__builtin_ia32_dpbf16ps_512((__v16sf) __D,
177  (__v16si) __A,
178  (__v16si) __B);
179 }
180 
198 static __inline__ __m512 __DEFAULT_FN_ATTRS512
199 _mm512_mask_dpbf16_ps(__m512 __D, __mmask16 __U, __m512bh __A, __m512bh __B) {
200  return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
201  (__v16sf)_mm512_dpbf16_ps(__D, __A, __B),
202  (__v16sf)__D);
203 }
204 
222 static __inline__ __m512 __DEFAULT_FN_ATTRS512
223 _mm512_maskz_dpbf16_ps(__mmask16 __U, __m512 __D, __m512bh __A, __m512bh __B) {
224  return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
225  (__v16sf)_mm512_dpbf16_ps(__D, __A, __B),
226  (__v16sf)_mm512_setzero_si512());
227 }
228 
236 static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_cvtpbh_ps(__m256bh __A) {
237  return _mm512_castsi512_ps((__m512i)_mm512_slli_epi32(
238  (__m512i)_mm512_cvtepi16_epi32((__m256i)__A), 16));
239 }
240 
251 static __inline__ __m512 __DEFAULT_FN_ATTRS512
252 _mm512_maskz_cvtpbh_ps(__mmask16 __U, __m256bh __A) {
253  return _mm512_castsi512_ps((__m512i)_mm512_slli_epi32(
254  (__m512i)_mm512_maskz_cvtepi16_epi32((__mmask16)__U, (__m256i)__A), 16));
255 }
256 
269 static __inline__ __m512 __DEFAULT_FN_ATTRS512
270 _mm512_mask_cvtpbh_ps(__m512 __S, __mmask16 __U, __m256bh __A) {
272  (__m512i)__S, (__mmask16)__U,
273  (__m512i)_mm512_cvtepi16_epi32((__m256i)__A), 16));
274 }
275 
276 #undef __DEFAULT_FN_ATTRS
277 #undef __DEFAULT_FN_ATTRS512
278 
279 #endif
static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_dpbf16_ps(__m512 __D, __m512bh __A, __m512bh __B)
Dot Product of BF16 Pairs Accumulated into Packed Single Precision.
static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_maskz_dpbf16_ps(__mmask16 __U, __m512 __D, __m512bh __A, __m512bh __B)
Dot Product of BF16 Pairs Accumulated into Packed Single Precision.
static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_mask_dpbf16_ps(__m512 __D, __mmask16 __U, __m512bh __A, __m512bh __B)
Dot Product of BF16 Pairs Accumulated into Packed Single Precision.
static __inline__ __m256bh __DEFAULT_FN_ATTRS512 _mm512_mask_cvtneps_pbh(__m256bh __W, __mmask16 __U, __m512 __A)
Convert Packed Single Data to Packed BF16 Data.
#define __DEFAULT_FN_ATTRS512
static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_cvtpbh_ps(__m256bh __A)
Convert Packed BF16 Data to Packed float Data.
#define __DEFAULT_FN_ATTRS
static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_mask_cvtpbh_ps(__m512 __S, __mmask16 __U, __m256bh __A)
Convert Packed BF16 Data to Packed float Data using merging mask.
static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_maskz_cvtne2ps_pbh(__mmask32 __U, __m512 __A, __m512 __B)
Convert Two Packed Single Data to One Packed BF16 Data.
static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_cvtne2ps_pbh(__m512 __A, __m512 __B)
Convert Two Packed Single Data to One Packed BF16 Data.
static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_maskz_cvtpbh_ps(__mmask16 __U, __m256bh __A)
Convert Packed BF16 Data to Packed float Data using zeroing mask.
static __inline__ __m256bh __DEFAULT_FN_ATTRS512 _mm512_maskz_cvtneps_pbh(__mmask16 __U, __m512 __A)
Convert Packed Single Data to Packed BF16 Data.
unsigned short __bfloat16
static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_mask_cvtne2ps_pbh(__m512bh __W, __mmask32 __U, __m512 __A, __m512 __B)
Convert Two Packed Single Data to One Packed BF16 Data.
static __inline__ __m256bh __DEFAULT_FN_ATTRS512 _mm512_cvtneps_pbh(__m512 __A)
Convert Packed Single Data to Packed BF16 Data.
static __inline__ float __DEFAULT_FN_ATTRS _mm_cvtsbh_ss(__bfloat16 __A)
Convert One BF16 Data to One Single Float Data.
short __m512bh __attribute__((__vector_size__(64), __aligned__(64)))
unsigned int __mmask32
static __inline__ __m512i __DEFAULT_FN_ATTRS512 _mm512_maskz_cvtepi16_epi32(__mmask16 __U, __m256i __A)
static __inline __m512 __DEFAULT_FN_ATTRS512 _mm512_castsi512_ps(__m512i __A)
static __inline__ __m512i __DEFAULT_FN_ATTRS512 _mm512_mask_slli_epi32(__m512i __W, __mmask16 __U, __m512i __A, unsigned int __B)
unsigned short __mmask16
Definition: avx512fintrin.h:38
static __inline__ __m512i __DEFAULT_FN_ATTRS512 _mm512_slli_epi32(__m512i __A, unsigned int __B)
static __inline__ __m512i __DEFAULT_FN_ATTRS512 _mm512_cvtepi16_epi32(__m256i __A)
static __inline __m512i __DEFAULT_FN_ATTRS512 _mm512_setzero_si512(void)
static __inline__ __m256i __DEFAULT_FN_ATTRS _mm256_undefined_si256(void)
Create a 256-bit integer vector with undefined values.
Definition: avxintrin.h:3594
static __inline __m256i __DEFAULT_FN_ATTRS _mm256_setzero_si256(void)
Constructs a 256-bit integer vector initialized to zero.
Definition: avxintrin.h:4281
static __inline__ unsigned int unsigned char __D
Definition: ia32intrin.h:283