]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Headers/fmaintrin.h
Integrate tools/regression/acltools into tests/sys/acl
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / Headers / fmaintrin.h
1 /*===---- 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 __IMMINTRIN_H
25 #error "Never use <fmaintrin.h> directly; include <immintrin.h> instead."
26 #endif
27
28 #ifndef __FMAINTRIN_H
29 #define __FMAINTRIN_H
30
31 #ifndef __FMA__
32 # error "FMA instruction set is not enabled"
33 #else
34
35 /* Define the default attributes for the functions in this file. */
36 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
37
38 static __inline__ __m128 __DEFAULT_FN_ATTRS
39 _mm_fmadd_ps(__m128 __A, __m128 __B, __m128 __C)
40 {
41   return (__m128)__builtin_ia32_vfmaddps(__A, __B, __C);
42 }
43
44 static __inline__ __m128d __DEFAULT_FN_ATTRS
45 _mm_fmadd_pd(__m128d __A, __m128d __B, __m128d __C)
46 {
47   return (__m128d)__builtin_ia32_vfmaddpd(__A, __B, __C);
48 }
49
50 static __inline__ __m128 __DEFAULT_FN_ATTRS
51 _mm_fmadd_ss(__m128 __A, __m128 __B, __m128 __C)
52 {
53   return (__m128)__builtin_ia32_vfmaddss(__A, __B, __C);
54 }
55
56 static __inline__ __m128d __DEFAULT_FN_ATTRS
57 _mm_fmadd_sd(__m128d __A, __m128d __B, __m128d __C)
58 {
59   return (__m128d)__builtin_ia32_vfmaddsd(__A, __B, __C);
60 }
61
62 static __inline__ __m128 __DEFAULT_FN_ATTRS
63 _mm_fmsub_ps(__m128 __A, __m128 __B, __m128 __C)
64 {
65   return (__m128)__builtin_ia32_vfmsubps(__A, __B, __C);
66 }
67
68 static __inline__ __m128d __DEFAULT_FN_ATTRS
69 _mm_fmsub_pd(__m128d __A, __m128d __B, __m128d __C)
70 {
71   return (__m128d)__builtin_ia32_vfmsubpd(__A, __B, __C);
72 }
73
74 static __inline__ __m128 __DEFAULT_FN_ATTRS
75 _mm_fmsub_ss(__m128 __A, __m128 __B, __m128 __C)
76 {
77   return (__m128)__builtin_ia32_vfmsubss(__A, __B, __C);
78 }
79
80 static __inline__ __m128d __DEFAULT_FN_ATTRS
81 _mm_fmsub_sd(__m128d __A, __m128d __B, __m128d __C)
82 {
83   return (__m128d)__builtin_ia32_vfmsubsd(__A, __B, __C);
84 }
85
86 static __inline__ __m128 __DEFAULT_FN_ATTRS
87 _mm_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C)
88 {
89   return (__m128)__builtin_ia32_vfnmaddps(__A, __B, __C);
90 }
91
92 static __inline__ __m128d __DEFAULT_FN_ATTRS
93 _mm_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C)
94 {
95   return (__m128d)__builtin_ia32_vfnmaddpd(__A, __B, __C);
96 }
97
98 static __inline__ __m128 __DEFAULT_FN_ATTRS
99 _mm_fnmadd_ss(__m128 __A, __m128 __B, __m128 __C)
100 {
101   return (__m128)__builtin_ia32_vfnmaddss(__A, __B, __C);
102 }
103
104 static __inline__ __m128d __DEFAULT_FN_ATTRS
105 _mm_fnmadd_sd(__m128d __A, __m128d __B, __m128d __C)
106 {
107   return (__m128d)__builtin_ia32_vfnmaddsd(__A, __B, __C);
108 }
109
110 static __inline__ __m128 __DEFAULT_FN_ATTRS
111 _mm_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C)
112 {
113   return (__m128)__builtin_ia32_vfnmsubps(__A, __B, __C);
114 }
115
116 static __inline__ __m128d __DEFAULT_FN_ATTRS
117 _mm_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C)
118 {
119   return (__m128d)__builtin_ia32_vfnmsubpd(__A, __B, __C);
120 }
121
122 static __inline__ __m128 __DEFAULT_FN_ATTRS
123 _mm_fnmsub_ss(__m128 __A, __m128 __B, __m128 __C)
124 {
125   return (__m128)__builtin_ia32_vfnmsubss(__A, __B, __C);
126 }
127
128 static __inline__ __m128d __DEFAULT_FN_ATTRS
129 _mm_fnmsub_sd(__m128d __A, __m128d __B, __m128d __C)
130 {
131   return (__m128d)__builtin_ia32_vfnmsubsd(__A, __B, __C);
132 }
133
134 static __inline__ __m128 __DEFAULT_FN_ATTRS
135 _mm_fmaddsub_ps(__m128 __A, __m128 __B, __m128 __C)
136 {
137   return (__m128)__builtin_ia32_vfmaddsubps(__A, __B, __C);
138 }
139
140 static __inline__ __m128d __DEFAULT_FN_ATTRS
141 _mm_fmaddsub_pd(__m128d __A, __m128d __B, __m128d __C)
142 {
143   return (__m128d)__builtin_ia32_vfmaddsubpd(__A, __B, __C);
144 }
145
146 static __inline__ __m128 __DEFAULT_FN_ATTRS
147 _mm_fmsubadd_ps(__m128 __A, __m128 __B, __m128 __C)
148 {
149   return (__m128)__builtin_ia32_vfmsubaddps(__A, __B, __C);
150 }
151
152 static __inline__ __m128d __DEFAULT_FN_ATTRS
153 _mm_fmsubadd_pd(__m128d __A, __m128d __B, __m128d __C)
154 {
155   return (__m128d)__builtin_ia32_vfmsubaddpd(__A, __B, __C);
156 }
157
158 static __inline__ __m256 __DEFAULT_FN_ATTRS
159 _mm256_fmadd_ps(__m256 __A, __m256 __B, __m256 __C)
160 {
161   return (__m256)__builtin_ia32_vfmaddps256(__A, __B, __C);
162 }
163
164 static __inline__ __m256d __DEFAULT_FN_ATTRS
165 _mm256_fmadd_pd(__m256d __A, __m256d __B, __m256d __C)
166 {
167   return (__m256d)__builtin_ia32_vfmaddpd256(__A, __B, __C);
168 }
169
170 static __inline__ __m256 __DEFAULT_FN_ATTRS
171 _mm256_fmsub_ps(__m256 __A, __m256 __B, __m256 __C)
172 {
173   return (__m256)__builtin_ia32_vfmsubps256(__A, __B, __C);
174 }
175
176 static __inline__ __m256d __DEFAULT_FN_ATTRS
177 _mm256_fmsub_pd(__m256d __A, __m256d __B, __m256d __C)
178 {
179   return (__m256d)__builtin_ia32_vfmsubpd256(__A, __B, __C);
180 }
181
182 static __inline__ __m256 __DEFAULT_FN_ATTRS
183 _mm256_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C)
184 {
185   return (__m256)__builtin_ia32_vfnmaddps256(__A, __B, __C);
186 }
187
188 static __inline__ __m256d __DEFAULT_FN_ATTRS
189 _mm256_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C)
190 {
191   return (__m256d)__builtin_ia32_vfnmaddpd256(__A, __B, __C);
192 }
193
194 static __inline__ __m256 __DEFAULT_FN_ATTRS
195 _mm256_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C)
196 {
197   return (__m256)__builtin_ia32_vfnmsubps256(__A, __B, __C);
198 }
199
200 static __inline__ __m256d __DEFAULT_FN_ATTRS
201 _mm256_fnmsub_pd(__m256d __A, __m256d __B, __m256d __C)
202 {
203   return (__m256d)__builtin_ia32_vfnmsubpd256(__A, __B, __C);
204 }
205
206 static __inline__ __m256 __DEFAULT_FN_ATTRS
207 _mm256_fmaddsub_ps(__m256 __A, __m256 __B, __m256 __C)
208 {
209   return (__m256)__builtin_ia32_vfmaddsubps256(__A, __B, __C);
210 }
211
212 static __inline__ __m256d __DEFAULT_FN_ATTRS
213 _mm256_fmaddsub_pd(__m256d __A, __m256d __B, __m256d __C)
214 {
215   return (__m256d)__builtin_ia32_vfmaddsubpd256(__A, __B, __C);
216 }
217
218 static __inline__ __m256 __DEFAULT_FN_ATTRS
219 _mm256_fmsubadd_ps(__m256 __A, __m256 __B, __m256 __C)
220 {
221   return (__m256)__builtin_ia32_vfmsubaddps256(__A, __B, __C);
222 }
223
224 static __inline__ __m256d __DEFAULT_FN_ATTRS
225 _mm256_fmsubadd_pd(__m256d __A, __m256d __B, __m256d __C)
226 {
227   return (__m256d)__builtin_ia32_vfmsubaddpd256(__A, __B, __C);
228 }
229
230 #undef __DEFAULT_FN_ATTRS
231
232 #endif /* __FMA__ */
233
234 #endif /* __FMAINTRIN_H */