blob: f1178877b252bab4ea9f4c3a8630591ea6374d9a [file] [log] [blame]
Craig Topperb4ceb6f2011-12-30 09:15:03 +00001/*===---- fma4intrin.h - FMA4 intrinsics -----------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __X86INTRIN_H
25#error "Never use <fma4intrin.h> directly; include <x86intrin.h> instead."
26#endif
27
28#ifndef __FMA4INTRIN_H
29#define __FMA4INTRIN_H
30
Craig Topperb4ceb6f2011-12-30 09:15:03 +000031#include <pmmintrin.h>
32
Eric Christopher4d1851682015-06-17 07:09:20 +000033/* Define the default attributes for the functions in this file. */
Michael Kupersteine45af542015-06-30 13:36:19 +000034#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("fma4")))
Eric Christopher4d1851682015-06-17 07:09:20 +000035
Michael Kupersteine45af542015-06-30 13:36:19 +000036static __inline__ __m128 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +000037_mm_macc_ps(__m128 __A, __m128 __B, __m128 __C)
38{
39 return (__m128)__builtin_ia32_vfmaddps(__A, __B, __C);
40}
41
Michael Kupersteine45af542015-06-30 13:36:19 +000042static __inline__ __m128d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +000043_mm_macc_pd(__m128d __A, __m128d __B, __m128d __C)
44{
45 return (__m128d)__builtin_ia32_vfmaddpd(__A, __B, __C);
46}
47
Michael Kupersteine45af542015-06-30 13:36:19 +000048static __inline__ __m128 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +000049_mm_macc_ss(__m128 __A, __m128 __B, __m128 __C)
50{
51 return (__m128)__builtin_ia32_vfmaddss(__A, __B, __C);
52}
53
Michael Kupersteine45af542015-06-30 13:36:19 +000054static __inline__ __m128d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +000055_mm_macc_sd(__m128d __A, __m128d __B, __m128d __C)
56{
57 return (__m128d)__builtin_ia32_vfmaddsd(__A, __B, __C);
58}
59
Michael Kupersteine45af542015-06-30 13:36:19 +000060static __inline__ __m128 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +000061_mm_msub_ps(__m128 __A, __m128 __B, __m128 __C)
62{
63 return (__m128)__builtin_ia32_vfmsubps(__A, __B, __C);
64}
65
Michael Kupersteine45af542015-06-30 13:36:19 +000066static __inline__ __m128d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +000067_mm_msub_pd(__m128d __A, __m128d __B, __m128d __C)
68{
69 return (__m128d)__builtin_ia32_vfmsubpd(__A, __B, __C);
70}
71
Michael Kupersteine45af542015-06-30 13:36:19 +000072static __inline__ __m128 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +000073_mm_msub_ss(__m128 __A, __m128 __B, __m128 __C)
74{
75 return (__m128)__builtin_ia32_vfmsubss(__A, __B, __C);
76}
77
Michael Kupersteine45af542015-06-30 13:36:19 +000078static __inline__ __m128d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +000079_mm_msub_sd(__m128d __A, __m128d __B, __m128d __C)
80{
81 return (__m128d)__builtin_ia32_vfmsubsd(__A, __B, __C);
82}
83
Michael Kupersteine45af542015-06-30 13:36:19 +000084static __inline__ __m128 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +000085_mm_nmacc_ps(__m128 __A, __m128 __B, __m128 __C)
86{
87 return (__m128)__builtin_ia32_vfnmaddps(__A, __B, __C);
88}
89
Michael Kupersteine45af542015-06-30 13:36:19 +000090static __inline__ __m128d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +000091_mm_nmacc_pd(__m128d __A, __m128d __B, __m128d __C)
92{
93 return (__m128d)__builtin_ia32_vfnmaddpd(__A, __B, __C);
94}
95
Michael Kupersteine45af542015-06-30 13:36:19 +000096static __inline__ __m128 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +000097_mm_nmacc_ss(__m128 __A, __m128 __B, __m128 __C)
98{
99 return (__m128)__builtin_ia32_vfnmaddss(__A, __B, __C);
100}
101
Michael Kupersteine45af542015-06-30 13:36:19 +0000102static __inline__ __m128d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000103_mm_nmacc_sd(__m128d __A, __m128d __B, __m128d __C)
104{
105 return (__m128d)__builtin_ia32_vfnmaddsd(__A, __B, __C);
106}
107
Michael Kupersteine45af542015-06-30 13:36:19 +0000108static __inline__ __m128 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000109_mm_nmsub_ps(__m128 __A, __m128 __B, __m128 __C)
110{
111 return (__m128)__builtin_ia32_vfnmsubps(__A, __B, __C);
112}
113
Michael Kupersteine45af542015-06-30 13:36:19 +0000114static __inline__ __m128d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000115_mm_nmsub_pd(__m128d __A, __m128d __B, __m128d __C)
116{
117 return (__m128d)__builtin_ia32_vfnmsubpd(__A, __B, __C);
118}
119
Michael Kupersteine45af542015-06-30 13:36:19 +0000120static __inline__ __m128 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000121_mm_nmsub_ss(__m128 __A, __m128 __B, __m128 __C)
122{
123 return (__m128)__builtin_ia32_vfnmsubss(__A, __B, __C);
124}
125
Michael Kupersteine45af542015-06-30 13:36:19 +0000126static __inline__ __m128d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000127_mm_nmsub_sd(__m128d __A, __m128d __B, __m128d __C)
128{
129 return (__m128d)__builtin_ia32_vfnmsubsd(__A, __B, __C);
130}
131
Michael Kupersteine45af542015-06-30 13:36:19 +0000132static __inline__ __m128 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000133_mm_maddsub_ps(__m128 __A, __m128 __B, __m128 __C)
134{
135 return (__m128)__builtin_ia32_vfmaddsubps(__A, __B, __C);
136}
137
Michael Kupersteine45af542015-06-30 13:36:19 +0000138static __inline__ __m128d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000139_mm_maddsub_pd(__m128d __A, __m128d __B, __m128d __C)
140{
141 return (__m128d)__builtin_ia32_vfmaddsubpd(__A, __B, __C);
142}
143
Michael Kupersteine45af542015-06-30 13:36:19 +0000144static __inline__ __m128 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000145_mm_msubadd_ps(__m128 __A, __m128 __B, __m128 __C)
146{
147 return (__m128)__builtin_ia32_vfmsubaddps(__A, __B, __C);
148}
149
Michael Kupersteine45af542015-06-30 13:36:19 +0000150static __inline__ __m128d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000151_mm_msubadd_pd(__m128d __A, __m128d __B, __m128d __C)
152{
153 return (__m128d)__builtin_ia32_vfmsubaddpd(__A, __B, __C);
154}
155
Michael Kupersteine45af542015-06-30 13:36:19 +0000156static __inline__ __m256 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000157_mm256_macc_ps(__m256 __A, __m256 __B, __m256 __C)
158{
159 return (__m256)__builtin_ia32_vfmaddps256(__A, __B, __C);
160}
161
Michael Kupersteine45af542015-06-30 13:36:19 +0000162static __inline__ __m256d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000163_mm256_macc_pd(__m256d __A, __m256d __B, __m256d __C)
164{
165 return (__m256d)__builtin_ia32_vfmaddpd256(__A, __B, __C);
166}
167
Michael Kupersteine45af542015-06-30 13:36:19 +0000168static __inline__ __m256 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000169_mm256_msub_ps(__m256 __A, __m256 __B, __m256 __C)
170{
171 return (__m256)__builtin_ia32_vfmsubps256(__A, __B, __C);
172}
173
Michael Kupersteine45af542015-06-30 13:36:19 +0000174static __inline__ __m256d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000175_mm256_msub_pd(__m256d __A, __m256d __B, __m256d __C)
176{
177 return (__m256d)__builtin_ia32_vfmsubpd256(__A, __B, __C);
178}
179
Michael Kupersteine45af542015-06-30 13:36:19 +0000180static __inline__ __m256 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000181_mm256_nmacc_ps(__m256 __A, __m256 __B, __m256 __C)
182{
183 return (__m256)__builtin_ia32_vfnmaddps256(__A, __B, __C);
184}
185
Michael Kupersteine45af542015-06-30 13:36:19 +0000186static __inline__ __m256d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000187_mm256_nmacc_pd(__m256d __A, __m256d __B, __m256d __C)
188{
189 return (__m256d)__builtin_ia32_vfnmaddpd256(__A, __B, __C);
190}
191
Michael Kupersteine45af542015-06-30 13:36:19 +0000192static __inline__ __m256 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000193_mm256_nmsub_ps(__m256 __A, __m256 __B, __m256 __C)
194{
195 return (__m256)__builtin_ia32_vfnmsubps256(__A, __B, __C);
196}
197
Michael Kupersteine45af542015-06-30 13:36:19 +0000198static __inline__ __m256d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000199_mm256_nmsub_pd(__m256d __A, __m256d __B, __m256d __C)
200{
201 return (__m256d)__builtin_ia32_vfnmsubpd256(__A, __B, __C);
202}
203
Michael Kupersteine45af542015-06-30 13:36:19 +0000204static __inline__ __m256 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000205_mm256_maddsub_ps(__m256 __A, __m256 __B, __m256 __C)
206{
207 return (__m256)__builtin_ia32_vfmaddsubps256(__A, __B, __C);
208}
209
Michael Kupersteine45af542015-06-30 13:36:19 +0000210static __inline__ __m256d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000211_mm256_maddsub_pd(__m256d __A, __m256d __B, __m256d __C)
212{
213 return (__m256d)__builtin_ia32_vfmaddsubpd256(__A, __B, __C);
214}
215
Michael Kupersteine45af542015-06-30 13:36:19 +0000216static __inline__ __m256 __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000217_mm256_msubadd_ps(__m256 __A, __m256 __B, __m256 __C)
218{
219 return (__m256)__builtin_ia32_vfmsubaddps256(__A, __B, __C);
220}
221
Michael Kupersteine45af542015-06-30 13:36:19 +0000222static __inline__ __m256d __DEFAULT_FN_ATTRS
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000223_mm256_msubadd_pd(__m256d __A, __m256d __B, __m256d __C)
224{
225 return (__m256d)__builtin_ia32_vfmsubaddpd256(__A, __B, __C);
226}
227
Michael Kupersteine45af542015-06-30 13:36:19 +0000228#undef __DEFAULT_FN_ATTRS
Eric Christopher4d1851682015-06-17 07:09:20 +0000229
Craig Topperb4ceb6f2011-12-30 09:15:03 +0000230#endif /* __FMA4INTRIN_H */