blob: 5889401d105537c9147895b42857f38d1d37abbf [file] [log] [blame]
Michael Zuckerman0190c652016-03-07 09:55:55 +00001/*===------------- avx512ifmavlintrin.h - IFMA intrinsics ------------------===
2 *
3 *
Chandler Carruth4cf57432019-04-08 20:51:30 +00004 * 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
Michael Zuckerman0190c652016-03-07 09:55:55 +00007 *
8 *===-----------------------------------------------------------------------===
9 */
10#ifndef __IMMINTRIN_H
11#error "Never use <avx512ifmavlintrin.h> directly; include <immintrin.h> instead."
12#endif
13
14#ifndef __IFMAVLINTRIN_H
15#define __IFMAVLINTRIN_H
16
17/* Define the default attributes for the functions in this file. */
Craig Topper74c10e32018-07-09 19:00:16 +000018#define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("avx512ifma,avx512vl"), __min_vector_width__(128)))
19#define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("avx512ifma,avx512vl"), __min_vector_width__(256)))
Michael Zuckerman0190c652016-03-07 09:55:55 +000020
21
22
Craig Topper74c10e32018-07-09 19:00:16 +000023static __inline__ __m128i __DEFAULT_FN_ATTRS128
Michael Zuckerman0190c652016-03-07 09:55:55 +000024_mm_madd52hi_epu64 (__m128i __X, __m128i __Y, __m128i __Z)
25{
Craig Topper387b1422018-05-26 18:55:26 +000026 return (__m128i)__builtin_ia32_vpmadd52huq128((__v2di) __X, (__v2di) __Y,
27 (__v2di) __Z);
Michael Zuckerman0190c652016-03-07 09:55:55 +000028}
29
Craig Topper74c10e32018-07-09 19:00:16 +000030static __inline__ __m128i __DEFAULT_FN_ATTRS128
Michael Zuckerman0190c652016-03-07 09:55:55 +000031_mm_mask_madd52hi_epu64 (__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y)
32{
Craig Topper387b1422018-05-26 18:55:26 +000033 return (__m128i)__builtin_ia32_selectq_128(__M,
34 (__v2di)_mm_madd52hi_epu64(__W, __X, __Y),
35 (__v2di)__W);
Michael Zuckerman0190c652016-03-07 09:55:55 +000036}
37
Craig Topper74c10e32018-07-09 19:00:16 +000038static __inline__ __m128i __DEFAULT_FN_ATTRS128
Michael Zuckerman0190c652016-03-07 09:55:55 +000039_mm_maskz_madd52hi_epu64 (__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z)
40{
Craig Topper387b1422018-05-26 18:55:26 +000041 return (__m128i)__builtin_ia32_selectq_128(__M,
42 (__v2di)_mm_madd52hi_epu64(__X, __Y, __Z),
43 (__v2di)_mm_setzero_si128());
Michael Zuckerman0190c652016-03-07 09:55:55 +000044}
45
Craig Topper74c10e32018-07-09 19:00:16 +000046static __inline__ __m256i __DEFAULT_FN_ATTRS256
Michael Zuckerman0190c652016-03-07 09:55:55 +000047_mm256_madd52hi_epu64 (__m256i __X, __m256i __Y, __m256i __Z)
48{
Craig Topper387b1422018-05-26 18:55:26 +000049 return (__m256i)__builtin_ia32_vpmadd52huq256((__v4di)__X, (__v4di)__Y,
50 (__v4di)__Z);
Michael Zuckerman0190c652016-03-07 09:55:55 +000051}
52
Craig Topper74c10e32018-07-09 19:00:16 +000053static __inline__ __m256i __DEFAULT_FN_ATTRS256
Craig Topper387b1422018-05-26 18:55:26 +000054_mm256_mask_madd52hi_epu64 (__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y)
Michael Zuckerman0190c652016-03-07 09:55:55 +000055{
Craig Topper387b1422018-05-26 18:55:26 +000056 return (__m256i)__builtin_ia32_selectq_256(__M,
57 (__v4di)_mm256_madd52hi_epu64(__W, __X, __Y),
58 (__v4di)__W);
Michael Zuckerman0190c652016-03-07 09:55:55 +000059}
60
Craig Topper74c10e32018-07-09 19:00:16 +000061static __inline__ __m256i __DEFAULT_FN_ATTRS256
Michael Zuckerman0190c652016-03-07 09:55:55 +000062_mm256_maskz_madd52hi_epu64 (__mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z)
63{
Craig Topper387b1422018-05-26 18:55:26 +000064 return (__m256i)__builtin_ia32_selectq_256(__M,
65 (__v4di)_mm256_madd52hi_epu64(__X, __Y, __Z),
66 (__v4di)_mm256_setzero_si256());
Michael Zuckerman0190c652016-03-07 09:55:55 +000067}
68
Craig Topper74c10e32018-07-09 19:00:16 +000069static __inline__ __m128i __DEFAULT_FN_ATTRS128
Michael Zuckerman0190c652016-03-07 09:55:55 +000070_mm_madd52lo_epu64 (__m128i __X, __m128i __Y, __m128i __Z)
71{
Craig Topper387b1422018-05-26 18:55:26 +000072 return (__m128i)__builtin_ia32_vpmadd52luq128((__v2di)__X, (__v2di)__Y,
73 (__v2di)__Z);
Michael Zuckerman0190c652016-03-07 09:55:55 +000074}
75
Craig Topper74c10e32018-07-09 19:00:16 +000076static __inline__ __m128i __DEFAULT_FN_ATTRS128
Michael Zuckerman0190c652016-03-07 09:55:55 +000077_mm_mask_madd52lo_epu64 (__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y)
78{
Craig Topper387b1422018-05-26 18:55:26 +000079 return (__m128i)__builtin_ia32_selectq_128(__M,
80 (__v2di)_mm_madd52lo_epu64(__W, __X, __Y),
81 (__v2di)__W);
Michael Zuckerman0190c652016-03-07 09:55:55 +000082}
83
Craig Topper74c10e32018-07-09 19:00:16 +000084static __inline__ __m128i __DEFAULT_FN_ATTRS128
Michael Zuckerman0190c652016-03-07 09:55:55 +000085_mm_maskz_madd52lo_epu64 (__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z)
86{
Craig Topper387b1422018-05-26 18:55:26 +000087 return (__m128i)__builtin_ia32_selectq_128(__M,
88 (__v2di)_mm_madd52lo_epu64(__X, __Y, __Z),
89 (__v2di)_mm_setzero_si128());
Michael Zuckerman0190c652016-03-07 09:55:55 +000090}
91
Craig Topper74c10e32018-07-09 19:00:16 +000092static __inline__ __m256i __DEFAULT_FN_ATTRS256
Michael Zuckerman0190c652016-03-07 09:55:55 +000093_mm256_madd52lo_epu64 (__m256i __X, __m256i __Y, __m256i __Z)
94{
Craig Topper387b1422018-05-26 18:55:26 +000095 return (__m256i)__builtin_ia32_vpmadd52luq256((__v4di)__X, (__v4di)__Y,
96 (__v4di)__Z);
Michael Zuckerman0190c652016-03-07 09:55:55 +000097}
98
Craig Topper74c10e32018-07-09 19:00:16 +000099static __inline__ __m256i __DEFAULT_FN_ATTRS256
Craig Topper387b1422018-05-26 18:55:26 +0000100_mm256_mask_madd52lo_epu64 (__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y)
Michael Zuckerman0190c652016-03-07 09:55:55 +0000101{
Craig Topper387b1422018-05-26 18:55:26 +0000102 return (__m256i)__builtin_ia32_selectq_256(__M,
103 (__v4di)_mm256_madd52lo_epu64(__W, __X, __Y),
104 (__v4di)__W);
Michael Zuckerman0190c652016-03-07 09:55:55 +0000105}
106
Craig Topper74c10e32018-07-09 19:00:16 +0000107static __inline__ __m256i __DEFAULT_FN_ATTRS256
Michael Zuckerman0190c652016-03-07 09:55:55 +0000108_mm256_maskz_madd52lo_epu64 (__mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z)
109{
Craig Topper387b1422018-05-26 18:55:26 +0000110 return (__m256i)__builtin_ia32_selectq_256(__M,
111 (__v4di)_mm256_madd52lo_epu64(__X, __Y, __Z),
112 (__v4di)_mm256_setzero_si256());
Michael Zuckerman0190c652016-03-07 09:55:55 +0000113}
114
115
Craig Topper74c10e32018-07-09 19:00:16 +0000116#undef __DEFAULT_FN_ATTRS128
117#undef __DEFAULT_FN_ATTRS256
Michael Zuckerman0190c652016-03-07 09:55:55 +0000118
119#endif