* x86-tune-sched.c (ix86_adjust_cost): Fix Zen support.
[official-gcc.git] / gcc / config / i386 / fmaintrin.h
blob2b1531e433b4224e371f375a3cd81df1f3180d3b
1 /* Copyright (C) 2011-2017 Free Software Foundation, Inc.
3 This file is part of GCC.
5 GCC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
10 GCC is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
24 #ifndef _IMMINTRIN_H_INCLUDED
25 # error "Never use <fmaintrin.h> directly; include <immintrin.h> instead."
26 #endif
28 #ifndef _FMAINTRIN_H_INCLUDED
29 #define _FMAINTRIN_H_INCLUDED
31 #ifndef __FMA__
32 #pragma GCC push_options
33 #pragma GCC target("fma")
34 #define __DISABLE_FMA__
35 #endif /* __FMA__ */
37 extern __inline __m128d
38 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
39 _mm_fmadd_pd (__m128d __A, __m128d __B, __m128d __C)
41 return (__m128d)__builtin_ia32_vfmaddpd ((__v2df)__A, (__v2df)__B,
42 (__v2df)__C);
45 extern __inline __m256d
46 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
47 _mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C)
49 return (__m256d)__builtin_ia32_vfmaddpd256 ((__v4df)__A, (__v4df)__B,
50 (__v4df)__C);
53 extern __inline __m128
54 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
55 _mm_fmadd_ps (__m128 __A, __m128 __B, __m128 __C)
57 return (__m128)__builtin_ia32_vfmaddps ((__v4sf)__A, (__v4sf)__B,
58 (__v4sf)__C);
61 extern __inline __m256
62 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
63 _mm256_fmadd_ps (__m256 __A, __m256 __B, __m256 __C)
65 return (__m256)__builtin_ia32_vfmaddps256 ((__v8sf)__A, (__v8sf)__B,
66 (__v8sf)__C);
69 extern __inline __m128d
70 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
71 _mm_fmadd_sd (__m128d __A, __m128d __B, __m128d __C)
73 return (__m128d) __builtin_ia32_vfmaddsd3 ((__v2df)__A, (__v2df)__B,
74 (__v2df)__C);
77 extern __inline __m128
78 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
79 _mm_fmadd_ss (__m128 __A, __m128 __B, __m128 __C)
81 return (__m128) __builtin_ia32_vfmaddss3 ((__v4sf)__A, (__v4sf)__B,
82 (__v4sf)__C);
85 extern __inline __m128d
86 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
87 _mm_fmsub_pd (__m128d __A, __m128d __B, __m128d __C)
89 return (__m128d)__builtin_ia32_vfmaddpd ((__v2df)__A, (__v2df)__B,
90 -(__v2df)__C);
93 extern __inline __m256d
94 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
95 _mm256_fmsub_pd (__m256d __A, __m256d __B, __m256d __C)
97 return (__m256d)__builtin_ia32_vfmaddpd256 ((__v4df)__A, (__v4df)__B,
98 -(__v4df)__C);
101 extern __inline __m128
102 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
103 _mm_fmsub_ps (__m128 __A, __m128 __B, __m128 __C)
105 return (__m128)__builtin_ia32_vfmaddps ((__v4sf)__A, (__v4sf)__B,
106 -(__v4sf)__C);
109 extern __inline __m256
110 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
111 _mm256_fmsub_ps (__m256 __A, __m256 __B, __m256 __C)
113 return (__m256)__builtin_ia32_vfmaddps256 ((__v8sf)__A, (__v8sf)__B,
114 -(__v8sf)__C);
117 extern __inline __m128d
118 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
119 _mm_fmsub_sd (__m128d __A, __m128d __B, __m128d __C)
121 return (__m128d)__builtin_ia32_vfmaddsd3 ((__v2df)__A, (__v2df)__B,
122 -(__v2df)__C);
125 extern __inline __m128
126 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
127 _mm_fmsub_ss (__m128 __A, __m128 __B, __m128 __C)
129 return (__m128)__builtin_ia32_vfmaddss3 ((__v4sf)__A, (__v4sf)__B,
130 -(__v4sf)__C);
133 extern __inline __m128d
134 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
135 _mm_fnmadd_pd (__m128d __A, __m128d __B, __m128d __C)
137 return (__m128d)__builtin_ia32_vfmaddpd (-(__v2df)__A, (__v2df)__B,
138 (__v2df)__C);
141 extern __inline __m256d
142 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
143 _mm256_fnmadd_pd (__m256d __A, __m256d __B, __m256d __C)
145 return (__m256d)__builtin_ia32_vfmaddpd256 (-(__v4df)__A, (__v4df)__B,
146 (__v4df)__C);
149 extern __inline __m128
150 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
151 _mm_fnmadd_ps (__m128 __A, __m128 __B, __m128 __C)
153 return (__m128)__builtin_ia32_vfmaddps (-(__v4sf)__A, (__v4sf)__B,
154 (__v4sf)__C);
157 extern __inline __m256
158 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
159 _mm256_fnmadd_ps (__m256 __A, __m256 __B, __m256 __C)
161 return (__m256)__builtin_ia32_vfmaddps256 (-(__v8sf)__A, (__v8sf)__B,
162 (__v8sf)__C);
165 extern __inline __m128d
166 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
167 _mm_fnmadd_sd (__m128d __A, __m128d __B, __m128d __C)
169 return (__m128d)__builtin_ia32_vfmaddsd3 ((__v2df)__A, -(__v2df)__B,
170 (__v2df)__C);
173 extern __inline __m128
174 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
175 _mm_fnmadd_ss (__m128 __A, __m128 __B, __m128 __C)
177 return (__m128)__builtin_ia32_vfmaddss3 ((__v4sf)__A, -(__v4sf)__B,
178 (__v4sf)__C);
181 extern __inline __m128d
182 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
183 _mm_fnmsub_pd (__m128d __A, __m128d __B, __m128d __C)
185 return (__m128d)__builtin_ia32_vfmaddpd (-(__v2df)__A, (__v2df)__B,
186 -(__v2df)__C);
189 extern __inline __m256d
190 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
191 _mm256_fnmsub_pd (__m256d __A, __m256d __B, __m256d __C)
193 return (__m256d)__builtin_ia32_vfmaddpd256 (-(__v4df)__A, (__v4df)__B,
194 -(__v4df)__C);
197 extern __inline __m128
198 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
199 _mm_fnmsub_ps (__m128 __A, __m128 __B, __m128 __C)
201 return (__m128)__builtin_ia32_vfmaddps (-(__v4sf)__A, (__v4sf)__B,
202 -(__v4sf)__C);
205 extern __inline __m256
206 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
207 _mm256_fnmsub_ps (__m256 __A, __m256 __B, __m256 __C)
209 return (__m256)__builtin_ia32_vfmaddps256 (-(__v8sf)__A, (__v8sf)__B,
210 -(__v8sf)__C);
213 extern __inline __m128d
214 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
215 _mm_fnmsub_sd (__m128d __A, __m128d __B, __m128d __C)
217 return (__m128d)__builtin_ia32_vfmaddsd3 ((__v2df)__A, -(__v2df)__B,
218 -(__v2df)__C);
221 extern __inline __m128
222 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
223 _mm_fnmsub_ss (__m128 __A, __m128 __B, __m128 __C)
225 return (__m128)__builtin_ia32_vfmaddss3 ((__v4sf)__A, -(__v4sf)__B,
226 -(__v4sf)__C);
229 extern __inline __m128d
230 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
231 _mm_fmaddsub_pd (__m128d __A, __m128d __B, __m128d __C)
233 return (__m128d)__builtin_ia32_vfmaddsubpd ((__v2df)__A, (__v2df)__B,
234 (__v2df)__C);
237 extern __inline __m256d
238 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
239 _mm256_fmaddsub_pd (__m256d __A, __m256d __B, __m256d __C)
241 return (__m256d)__builtin_ia32_vfmaddsubpd256 ((__v4df)__A,
242 (__v4df)__B,
243 (__v4df)__C);
246 extern __inline __m128
247 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
248 _mm_fmaddsub_ps (__m128 __A, __m128 __B, __m128 __C)
250 return (__m128)__builtin_ia32_vfmaddsubps ((__v4sf)__A, (__v4sf)__B,
251 (__v4sf)__C);
254 extern __inline __m256
255 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
256 _mm256_fmaddsub_ps (__m256 __A, __m256 __B, __m256 __C)
258 return (__m256)__builtin_ia32_vfmaddsubps256 ((__v8sf)__A,
259 (__v8sf)__B,
260 (__v8sf)__C);
263 extern __inline __m128d
264 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
265 _mm_fmsubadd_pd (__m128d __A, __m128d __B, __m128d __C)
267 return (__m128d)__builtin_ia32_vfmaddsubpd ((__v2df)__A, (__v2df)__B,
268 -(__v2df)__C);
271 extern __inline __m256d
272 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
273 _mm256_fmsubadd_pd (__m256d __A, __m256d __B, __m256d __C)
275 return (__m256d)__builtin_ia32_vfmaddsubpd256 ((__v4df)__A,
276 (__v4df)__B,
277 -(__v4df)__C);
280 extern __inline __m128
281 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
282 _mm_fmsubadd_ps (__m128 __A, __m128 __B, __m128 __C)
284 return (__m128)__builtin_ia32_vfmaddsubps ((__v4sf)__A, (__v4sf)__B,
285 -(__v4sf)__C);
288 extern __inline __m256
289 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
290 _mm256_fmsubadd_ps (__m256 __A, __m256 __B, __m256 __C)
292 return (__m256)__builtin_ia32_vfmaddsubps256 ((__v8sf)__A,
293 (__v8sf)__B,
294 -(__v8sf)__C);
297 #ifdef __DISABLE_FMA__
298 #undef __DISABLE_FMA__
299 #pragma GCC pop_options
300 #endif /* __DISABLE_FMA__ */
302 #endif