1 /*===---- fma4intrin.h - FMA4 intrinsics -----------------------------------===
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:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
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
21 *===-----------------------------------------------------------------------===
25 #error "Never use <fmaintrin.h> directly; include <immintrin.h> instead."
32 # error "FMA instruction set is not enabled"
35 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
36 _mm_fmadd_ps(__m128 __A, __m128 __B, __m128 __C)
38 return (__m128)__builtin_ia32_vfmaddps(__A, __B, __C);
41 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
42 _mm_fmadd_pd(__m128d __A, __m128d __B, __m128d __C)
44 return (__m128d)__builtin_ia32_vfmaddpd(__A, __B, __C);
47 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
48 _mm_fmadd_ss(__m128 __A, __m128 __B, __m128 __C)
50 return (__m128)__builtin_ia32_vfmaddss(__A, __B, __C);
53 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
54 _mm_fmadd_sd(__m128d __A, __m128d __B, __m128d __C)
56 return (__m128d)__builtin_ia32_vfmaddsd(__A, __B, __C);
59 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
60 _mm_fmsub_ps(__m128 __A, __m128 __B, __m128 __C)
62 return (__m128)__builtin_ia32_vfmsubps(__A, __B, __C);
65 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
66 _mm_fmsub_pd(__m128d __A, __m128d __B, __m128d __C)
68 return (__m128d)__builtin_ia32_vfmsubpd(__A, __B, __C);
71 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
72 _mm_fmsub_ss(__m128 __A, __m128 __B, __m128 __C)
74 return (__m128)__builtin_ia32_vfmsubss(__A, __B, __C);
77 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
78 _mm_fmsub_sd(__m128d __A, __m128d __B, __m128d __C)
80 return (__m128d)__builtin_ia32_vfmsubsd(__A, __B, __C);
83 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
84 _mm_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C)
86 return (__m128)__builtin_ia32_vfnmaddps(__A, __B, __C);
89 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
90 _mm_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C)
92 return (__m128d)__builtin_ia32_vfnmaddpd(__A, __B, __C);
95 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
96 _mm_fnmadd_ss(__m128 __A, __m128 __B, __m128 __C)
98 return (__m128)__builtin_ia32_vfnmaddss(__A, __B, __C);
101 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
102 _mm_fnmadd_sd(__m128d __A, __m128d __B, __m128d __C)
104 return (__m128d)__builtin_ia32_vfnmaddsd(__A, __B, __C);
107 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
108 _mm_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C)
110 return (__m128)__builtin_ia32_vfnmsubps(__A, __B, __C);
113 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
114 _mm_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C)
116 return (__m128d)__builtin_ia32_vfnmsubpd(__A, __B, __C);
119 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
120 _mm_fnmsub_ss(__m128 __A, __m128 __B, __m128 __C)
122 return (__m128)__builtin_ia32_vfnmsubss(__A, __B, __C);
125 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
126 _mm_fnmsub_sd(__m128d __A, __m128d __B, __m128d __C)
128 return (__m128d)__builtin_ia32_vfnmsubsd(__A, __B, __C);
131 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
132 _mm_fmaddsub_ps(__m128 __A, __m128 __B, __m128 __C)
134 return (__m128)__builtin_ia32_vfmaddsubps(__A, __B, __C);
137 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
138 _mm_fmaddsub_pd(__m128d __A, __m128d __B, __m128d __C)
140 return (__m128d)__builtin_ia32_vfmaddsubpd(__A, __B, __C);
143 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__))
144 _mm_fmsubadd_ps(__m128 __A, __m128 __B, __m128 __C)
146 return (__m128)__builtin_ia32_vfmsubaddps(__A, __B, __C);
149 static __inline__ __m128d __attribute__((__always_inline__, __nodebug__))
150 _mm_fmsubadd_pd(__m128d __A, __m128d __B, __m128d __C)
152 return (__m128d)__builtin_ia32_vfmsubaddpd(__A, __B, __C);
155 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
156 _mm256_fmadd_ps(__m256 __A, __m256 __B, __m256 __C)
158 return (__m256)__builtin_ia32_vfmaddps256(__A, __B, __C);
161 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
162 _mm256_fmadd_pd(__m256d __A, __m256d __B, __m256d __C)
164 return (__m256d)__builtin_ia32_vfmaddpd256(__A, __B, __C);
167 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
168 _mm256_fmsub_ps(__m256 __A, __m256 __B, __m256 __C)
170 return (__m256)__builtin_ia32_vfmsubps256(__A, __B, __C);
173 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
174 _mm256_fmsub_pd(__m256d __A, __m256d __B, __m256d __C)
176 return (__m256d)__builtin_ia32_vfmsubpd256(__A, __B, __C);
179 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
180 _mm256_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C)
182 return (__m256)__builtin_ia32_vfnmaddps256(__A, __B, __C);
185 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
186 _mm256_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C)
188 return (__m256d)__builtin_ia32_vfnmaddpd256(__A, __B, __C);
191 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
192 _mm256_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C)
194 return (__m256)__builtin_ia32_vfnmsubps256(__A, __B, __C);
197 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
198 _mm256_fnmsub_pd(__m256d __A, __m256d __B, __m256d __C)
200 return (__m256d)__builtin_ia32_vfnmsubpd256(__A, __B, __C);
203 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
204 _mm256_fmaddsub_ps(__m256 __A, __m256 __B, __m256 __C)
206 return (__m256)__builtin_ia32_vfmaddsubps256(__A, __B, __C);
209 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
210 _mm256_fmaddsub_pd(__m256d __A, __m256d __B, __m256d __C)
212 return (__m256d)__builtin_ia32_vfmaddsubpd256(__A, __B, __C);
215 static __inline__ __m256 __attribute__((__always_inline__, __nodebug__))
216 _mm256_fmsubadd_ps(__m256 __A, __m256 __B, __m256 __C)
218 return (__m256)__builtin_ia32_vfmsubaddps256(__A, __B, __C);
221 static __inline__ __m256d __attribute__((__always_inline__, __nodebug__))
222 _mm256_fmsubadd_pd(__m256d __A, __m256d __B, __m256d __C)
224 return (__m256d)__builtin_ia32_vfmsubaddpd256(__A, __B, __C);
229 #endif /* __FMAINTRIN_H */