1 /*===----------------- avxifmaintrin.h - IFMA 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 <avxifmaintrin.h> directly; include <immintrin.h> instead."
14 #ifndef __AVXIFMAINTRIN_H
15 #define __AVXIFMAINTRIN_H
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS128 \
19 __attribute__((__always_inline__, __nodebug__, __target__("avxifma"), \
20 __min_vector_width__(128)))
21 #define __DEFAULT_FN_ATTRS256 \
22 __attribute__((__always_inline__, __nodebug__, __target__("avxifma"), \
23 __min_vector_width__(256)))
27 /// Multiply packed unsigned 52-bit integers in each 64-bit element of \a __Y
28 /// and \a __Z to form a 104-bit intermediate result. Add the high 52-bit
29 /// unsigned integer from the intermediate result with the corresponding
30 /// unsigned 64-bit integer in \a __X, and store the results in \a dst.
32 /// \headerfile <immintrin.h>
36 /// _mm_madd52hi_avx_epu64 (__m128i __X, __m128i __Y, __m128i __Z)
39 /// This intrinsic corresponds to the \c VPMADD52HUQ instruction.
42 /// return __m128i dst.
44 /// A 128-bit vector of [2 x i64]
46 /// A 128-bit vector of [2 x i64]
48 /// A 128-bit vector of [2 x i64]
53 /// tmp[127:0] := ZeroExtend64(__Y[i+51:i]) * ZeroExtend64(__Z[i+51:i])
54 /// dst[i+63:i] := __X[i+63:i] + ZeroExtend64(tmp[103:52])
58 static __inline__ __m128i __DEFAULT_FN_ATTRS128
59 _mm_madd52hi_avx_epu64(__m128i __X
, __m128i __Y
, __m128i __Z
) {
60 return (__m128i
)__builtin_ia32_vpmadd52huq128((__v2di
)__X
, (__v2di
)__Y
,
64 /// Multiply packed unsigned 52-bit integers in each 64-bit element of \a __Y
65 /// and \a __Z to form a 104-bit intermediate result. Add the high 52-bit
66 /// unsigned integer from the intermediate result with the corresponding
67 /// unsigned 64-bit integer in \a __X, and store the results in \a dst.
69 /// \headerfile <immintrin.h>
73 /// _mm256_madd52hi_avx_epu64 (__m256i __X, __m256i __Y, __m256i __Z)
76 /// This intrinsic corresponds to the \c VPMADD52HUQ instruction.
79 /// return __m256i dst.
81 /// A 256-bit vector of [4 x i64]
83 /// A 256-bit vector of [4 x i64]
85 /// A 256-bit vector of [4 x i64]
90 /// tmp[127:0] := ZeroExtend64(__Y[i+51:i]) * ZeroExtend64(__Z[i+51:i])
91 /// dst[i+63:i] := __X[i+63:i] + ZeroExtend64(tmp[103:52])
95 static __inline__ __m256i __DEFAULT_FN_ATTRS256
96 _mm256_madd52hi_avx_epu64(__m256i __X
, __m256i __Y
, __m256i __Z
) {
97 return (__m256i
)__builtin_ia32_vpmadd52huq256((__v4di
)__X
, (__v4di
)__Y
,
101 /// Multiply packed unsigned 52-bit integers in each 64-bit element of \a __Y
102 /// and \a __Z to form a 104-bit intermediate result. Add the low 52-bit
103 /// unsigned integer from the intermediate result with the corresponding
104 /// unsigned 64-bit integer in \a __X, and store the results in \a dst.
106 /// \headerfile <immintrin.h>
110 /// _mm_madd52lo_avx_epu64 (__m128i __X, __m128i __Y, __m128i __Z)
113 /// This intrinsic corresponds to the \c VPMADD52LUQ instruction.
116 /// return __m128i dst.
118 /// A 128-bit vector of [2 x i64]
120 /// A 128-bit vector of [2 x i64]
122 /// A 128-bit vector of [2 x i64]
124 /// \code{.operation}
127 /// tmp[127:0] := ZeroExtend64(__Y[i+51:i]) * ZeroExtend64(__Z[i+51:i])
128 /// dst[i+63:i] := __X[i+63:i] + ZeroExtend64(tmp[51:0])
130 /// dst[MAX:128] := 0
132 static __inline__ __m128i __DEFAULT_FN_ATTRS128
133 _mm_madd52lo_avx_epu64(__m128i __X
, __m128i __Y
, __m128i __Z
) {
134 return (__m128i
)__builtin_ia32_vpmadd52luq128((__v2di
)__X
, (__v2di
)__Y
,
138 /// Multiply packed unsigned 52-bit integers in each 64-bit element of \a __Y
139 /// and \a __Z to form a 104-bit intermediate result. Add the low 52-bit
140 /// unsigned integer from the intermediate result with the corresponding
141 /// unsigned 64-bit integer in \a __X, and store the results in \a dst.
143 /// \headerfile <immintrin.h>
147 /// _mm256_madd52lo_avx_epu64 (__m256i __X, __m256i __Y, __m256i __Z)
150 /// This intrinsic corresponds to the \c VPMADD52LUQ instruction.
153 /// return __m256i dst.
155 /// A 256-bit vector of [4 x i64]
157 /// A 256-bit vector of [4 x i64]
159 /// A 256-bit vector of [4 x i64]
161 /// \code{.operation}
164 /// tmp[127:0] := ZeroExtend64(__Y[i+51:i]) * ZeroExtend64(__Z[i+51:i])
165 /// dst[i+63:i] := __X[i+63:i] + ZeroExtend64(tmp[51:0])
167 /// dst[MAX:256] := 0
169 static __inline__ __m256i __DEFAULT_FN_ATTRS256
170 _mm256_madd52lo_avx_epu64(__m256i __X
, __m256i __Y
, __m256i __Z
) {
171 return (__m256i
)__builtin_ia32_vpmadd52luq256((__v4di
)__X
, (__v4di
)__Y
,
174 #undef __DEFAULT_FN_ATTRS128
175 #undef __DEFAULT_FN_ATTRS256
177 #endif // __AVXIFMAINTRIN_H