xref: /freebsd/contrib/llvm-project/clang/lib/Headers/avx512ifmaintrin.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
1 /*===------------- avx512ifmaintrin.h - IFMA intrinsics ------------------===
2  *
3  *
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
7  *
8  *===-----------------------------------------------------------------------===
9  */
10 #ifndef __IMMINTRIN_H
11 #error "Never use <avx512ifmaintrin.h> directly; include <immintrin.h> instead."
12 #endif
13 
14 #ifndef __IFMAINTRIN_H
15 #define __IFMAINTRIN_H
16 
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS                                                     \
19   __attribute__((__always_inline__, __nodebug__,                               \
20                  __target__("avx512ifma,evex512"), __min_vector_width__(512)))
21 
22 static __inline__ __m512i __DEFAULT_FN_ATTRS
23 _mm512_madd52hi_epu64 (__m512i __X, __m512i __Y, __m512i __Z)
24 {
25   return (__m512i)__builtin_ia32_vpmadd52huq512((__v8di) __X, (__v8di) __Y,
26                                                 (__v8di) __Z);
27 }
28 
29 static __inline__ __m512i __DEFAULT_FN_ATTRS
30 _mm512_mask_madd52hi_epu64 (__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y)
31 {
32   return (__m512i)__builtin_ia32_selectq_512(__M,
33                                    (__v8di)_mm512_madd52hi_epu64(__W, __X, __Y),
34                                    (__v8di)__W);
35 }
36 
37 static __inline__ __m512i __DEFAULT_FN_ATTRS
38 _mm512_maskz_madd52hi_epu64 (__mmask8 __M, __m512i __X, __m512i __Y, __m512i __Z)
39 {
40   return (__m512i)__builtin_ia32_selectq_512(__M,
41                                    (__v8di)_mm512_madd52hi_epu64(__X, __Y, __Z),
42                                    (__v8di)_mm512_setzero_si512());
43 }
44 
45 static __inline__ __m512i __DEFAULT_FN_ATTRS
46 _mm512_madd52lo_epu64 (__m512i __X, __m512i __Y, __m512i __Z)
47 {
48   return (__m512i)__builtin_ia32_vpmadd52luq512((__v8di) __X, (__v8di) __Y,
49                                                 (__v8di) __Z);
50 }
51 
52 static __inline__ __m512i __DEFAULT_FN_ATTRS
53 _mm512_mask_madd52lo_epu64 (__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y)
54 {
55   return (__m512i)__builtin_ia32_selectq_512(__M,
56                                    (__v8di)_mm512_madd52lo_epu64(__W, __X, __Y),
57                                    (__v8di)__W);
58 }
59 
60 static __inline__ __m512i __DEFAULT_FN_ATTRS
61 _mm512_maskz_madd52lo_epu64 (__mmask8 __M, __m512i __X, __m512i __Y, __m512i __Z)
62 {
63   return (__m512i)__builtin_ia32_selectq_512(__M,
64                                    (__v8di)_mm512_madd52lo_epu64(__X, __Y, __Z),
65                                    (__v8di)_mm512_setzero_si512());
66 }
67 
68 #undef __DEFAULT_FN_ATTRS
69 
70 #endif
71