]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/i386/fmaintrin.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / i386 / fmaintrin.h
CommitLineData
99dee823 1/* Copyright (C) 2011-2021 Free Software Foundation, Inc.
2ddd46d6
IT
2
3 This file is part of GCC.
4
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.
9
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.
14
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.
18
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/>. */
23
24#ifndef _IMMINTRIN_H_INCLUDED
25# error "Never use <fmaintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef _FMAINTRIN_H_INCLUDED
29#define _FMAINTRIN_H_INCLUDED
30
31#ifndef __FMA__
97db2bf7
ST
32#pragma GCC push_options
33#pragma GCC target("fma")
34#define __DISABLE_FMA__
35#endif /* __FMA__ */
2ddd46d6
IT
36
37extern __inline __m128d
38__attribute__((__gnu_inline__, __always_inline__, __artificial__))
39_mm_fmadd_pd (__m128d __A, __m128d __B, __m128d __C)
40{
41 return (__m128d)__builtin_ia32_vfmaddpd ((__v2df)__A, (__v2df)__B,
42 (__v2df)__C);
43}
44
45extern __inline __m256d
46__attribute__((__gnu_inline__, __always_inline__, __artificial__))
47_mm256_fmadd_pd (__m256d __A, __m256d __B, __m256d __C)
48{
49 return (__m256d)__builtin_ia32_vfmaddpd256 ((__v4df)__A, (__v4df)__B,
50 (__v4df)__C);
51}
52
53extern __inline __m128
54__attribute__((__gnu_inline__, __always_inline__, __artificial__))
55_mm_fmadd_ps (__m128 __A, __m128 __B, __m128 __C)
56{
57 return (__m128)__builtin_ia32_vfmaddps ((__v4sf)__A, (__v4sf)__B,
58 (__v4sf)__C);
59}
60
61extern __inline __m256
62__attribute__((__gnu_inline__, __always_inline__, __artificial__))
63_mm256_fmadd_ps (__m256 __A, __m256 __B, __m256 __C)
64{
65 return (__m256)__builtin_ia32_vfmaddps256 ((__v8sf)__A, (__v8sf)__B,
66 (__v8sf)__C);
67}
68
69extern __inline __m128d
70__attribute__((__gnu_inline__, __always_inline__, __artificial__))
71_mm_fmadd_sd (__m128d __A, __m128d __B, __m128d __C)
72{
73 return (__m128d) __builtin_ia32_vfmaddsd3 ((__v2df)__A, (__v2df)__B,
74 (__v2df)__C);
75}
76
77extern __inline __m128
78__attribute__((__gnu_inline__, __always_inline__, __artificial__))
79_mm_fmadd_ss (__m128 __A, __m128 __B, __m128 __C)
80{
81 return (__m128) __builtin_ia32_vfmaddss3 ((__v4sf)__A, (__v4sf)__B,
82 (__v4sf)__C);
83}
84
85extern __inline __m128d
86__attribute__((__gnu_inline__, __always_inline__, __artificial__))
87_mm_fmsub_pd (__m128d __A, __m128d __B, __m128d __C)
88{
fe7f972d
L
89 return (__m128d)__builtin_ia32_vfmsubpd ((__v2df)__A, (__v2df)__B,
90 (__v2df)__C);
2ddd46d6
IT
91}
92
93extern __inline __m256d
94__attribute__((__gnu_inline__, __always_inline__, __artificial__))
95_mm256_fmsub_pd (__m256d __A, __m256d __B, __m256d __C)
96{
fe7f972d
L
97 return (__m256d)__builtin_ia32_vfmsubpd256 ((__v4df)__A, (__v4df)__B,
98 (__v4df)__C);
2ddd46d6
IT
99}
100
101extern __inline __m128
102__attribute__((__gnu_inline__, __always_inline__, __artificial__))
103_mm_fmsub_ps (__m128 __A, __m128 __B, __m128 __C)
104{
fe7f972d
L
105 return (__m128)__builtin_ia32_vfmsubps ((__v4sf)__A, (__v4sf)__B,
106 (__v4sf)__C);
2ddd46d6
IT
107}
108
109extern __inline __m256
110__attribute__((__gnu_inline__, __always_inline__, __artificial__))
111_mm256_fmsub_ps (__m256 __A, __m256 __B, __m256 __C)
112{
fe7f972d
L
113 return (__m256)__builtin_ia32_vfmsubps256 ((__v8sf)__A, (__v8sf)__B,
114 (__v8sf)__C);
2ddd46d6
IT
115}
116
117extern __inline __m128d
118__attribute__((__gnu_inline__, __always_inline__, __artificial__))
119_mm_fmsub_sd (__m128d __A, __m128d __B, __m128d __C)
120{
fe7f972d
L
121 return (__m128d)__builtin_ia32_vfmsubsd3 ((__v2df)__A, (__v2df)__B,
122 (__v2df)__C);
2ddd46d6
IT
123}
124
125extern __inline __m128
126__attribute__((__gnu_inline__, __always_inline__, __artificial__))
127_mm_fmsub_ss (__m128 __A, __m128 __B, __m128 __C)
128{
fe7f972d
L
129 return (__m128)__builtin_ia32_vfmsubss3 ((__v4sf)__A, (__v4sf)__B,
130 (__v4sf)__C);
2ddd46d6
IT
131}
132
133extern __inline __m128d
134__attribute__((__gnu_inline__, __always_inline__, __artificial__))
135_mm_fnmadd_pd (__m128d __A, __m128d __B, __m128d __C)
136{
5ca94977
L
137 return (__m128d)__builtin_ia32_vfnmaddpd ((__v2df)__A, (__v2df)__B,
138 (__v2df)__C);
2ddd46d6
IT
139}
140
141extern __inline __m256d
142__attribute__((__gnu_inline__, __always_inline__, __artificial__))
143_mm256_fnmadd_pd (__m256d __A, __m256d __B, __m256d __C)
144{
5ca94977
L
145 return (__m256d)__builtin_ia32_vfnmaddpd256 ((__v4df)__A, (__v4df)__B,
146 (__v4df)__C);
2ddd46d6
IT
147}
148
149extern __inline __m128
150__attribute__((__gnu_inline__, __always_inline__, __artificial__))
151_mm_fnmadd_ps (__m128 __A, __m128 __B, __m128 __C)
152{
5ca94977
L
153 return (__m128)__builtin_ia32_vfnmaddps ((__v4sf)__A, (__v4sf)__B,
154 (__v4sf)__C);
2ddd46d6
IT
155}
156
157extern __inline __m256
158__attribute__((__gnu_inline__, __always_inline__, __artificial__))
159_mm256_fnmadd_ps (__m256 __A, __m256 __B, __m256 __C)
160{
5ca94977
L
161 return (__m256)__builtin_ia32_vfnmaddps256 ((__v8sf)__A, (__v8sf)__B,
162 (__v8sf)__C);
2ddd46d6
IT
163}
164
165extern __inline __m128d
166__attribute__((__gnu_inline__, __always_inline__, __artificial__))
167_mm_fnmadd_sd (__m128d __A, __m128d __B, __m128d __C)
168{
5ca94977
L
169 return (__m128d)__builtin_ia32_vfnmaddsd3 ((__v2df)__A, (__v2df)__B,
170 (__v2df)__C);
2ddd46d6
IT
171}
172
173extern __inline __m128
174__attribute__((__gnu_inline__, __always_inline__, __artificial__))
175_mm_fnmadd_ss (__m128 __A, __m128 __B, __m128 __C)
176{
5ca94977
L
177 return (__m128)__builtin_ia32_vfnmaddss3 ((__v4sf)__A, (__v4sf)__B,
178 (__v4sf)__C);
2ddd46d6
IT
179}
180
181extern __inline __m128d
182__attribute__((__gnu_inline__, __always_inline__, __artificial__))
183_mm_fnmsub_pd (__m128d __A, __m128d __B, __m128d __C)
184{
38ef6fb1
L
185 return (__m128d)__builtin_ia32_vfnmsubpd ((__v2df)__A, (__v2df)__B,
186 (__v2df)__C);
2ddd46d6
IT
187}
188
189extern __inline __m256d
190__attribute__((__gnu_inline__, __always_inline__, __artificial__))
191_mm256_fnmsub_pd (__m256d __A, __m256d __B, __m256d __C)
192{
38ef6fb1
L
193 return (__m256d)__builtin_ia32_vfnmsubpd256 ((__v4df)__A, (__v4df)__B,
194 (__v4df)__C);
2ddd46d6
IT
195}
196
197extern __inline __m128
198__attribute__((__gnu_inline__, __always_inline__, __artificial__))
199_mm_fnmsub_ps (__m128 __A, __m128 __B, __m128 __C)
200{
38ef6fb1
L
201 return (__m128)__builtin_ia32_vfnmsubps ((__v4sf)__A, (__v4sf)__B,
202 (__v4sf)__C);
2ddd46d6
IT
203}
204
205extern __inline __m256
206__attribute__((__gnu_inline__, __always_inline__, __artificial__))
207_mm256_fnmsub_ps (__m256 __A, __m256 __B, __m256 __C)
208{
38ef6fb1
L
209 return (__m256)__builtin_ia32_vfnmsubps256 ((__v8sf)__A, (__v8sf)__B,
210 (__v8sf)__C);
2ddd46d6
IT
211}
212
213extern __inline __m128d
214__attribute__((__gnu_inline__, __always_inline__, __artificial__))
215_mm_fnmsub_sd (__m128d __A, __m128d __B, __m128d __C)
216{
38ef6fb1
L
217 return (__m128d)__builtin_ia32_vfnmsubsd3 ((__v2df)__A, (__v2df)__B,
218 (__v2df)__C);
2ddd46d6
IT
219}
220
221extern __inline __m128
222__attribute__((__gnu_inline__, __always_inline__, __artificial__))
223_mm_fnmsub_ss (__m128 __A, __m128 __B, __m128 __C)
224{
38ef6fb1
L
225 return (__m128)__builtin_ia32_vfnmsubss3 ((__v4sf)__A, (__v4sf)__B,
226 (__v4sf)__C);
2ddd46d6
IT
227}
228
229extern __inline __m128d
230__attribute__((__gnu_inline__, __always_inline__, __artificial__))
231_mm_fmaddsub_pd (__m128d __A, __m128d __B, __m128d __C)
232{
233 return (__m128d)__builtin_ia32_vfmaddsubpd ((__v2df)__A, (__v2df)__B,
234 (__v2df)__C);
235}
236
237extern __inline __m256d
238__attribute__((__gnu_inline__, __always_inline__, __artificial__))
239_mm256_fmaddsub_pd (__m256d __A, __m256d __B, __m256d __C)
240{
241 return (__m256d)__builtin_ia32_vfmaddsubpd256 ((__v4df)__A,
242 (__v4df)__B,
243 (__v4df)__C);
244}
245
246extern __inline __m128
247__attribute__((__gnu_inline__, __always_inline__, __artificial__))
248_mm_fmaddsub_ps (__m128 __A, __m128 __B, __m128 __C)
249{
250 return (__m128)__builtin_ia32_vfmaddsubps ((__v4sf)__A, (__v4sf)__B,
251 (__v4sf)__C);
252}
253
254extern __inline __m256
255__attribute__((__gnu_inline__, __always_inline__, __artificial__))
256_mm256_fmaddsub_ps (__m256 __A, __m256 __B, __m256 __C)
257{
258 return (__m256)__builtin_ia32_vfmaddsubps256 ((__v8sf)__A,
259 (__v8sf)__B,
260 (__v8sf)__C);
261}
262
263extern __inline __m128d
264__attribute__((__gnu_inline__, __always_inline__, __artificial__))
265_mm_fmsubadd_pd (__m128d __A, __m128d __B, __m128d __C)
266{
267 return (__m128d)__builtin_ia32_vfmaddsubpd ((__v2df)__A, (__v2df)__B,
268 -(__v2df)__C);
269}
270
271extern __inline __m256d
272__attribute__((__gnu_inline__, __always_inline__, __artificial__))
273_mm256_fmsubadd_pd (__m256d __A, __m256d __B, __m256d __C)
274{
275 return (__m256d)__builtin_ia32_vfmaddsubpd256 ((__v4df)__A,
276 (__v4df)__B,
277 -(__v4df)__C);
278}
279
280extern __inline __m128
281__attribute__((__gnu_inline__, __always_inline__, __artificial__))
282_mm_fmsubadd_ps (__m128 __A, __m128 __B, __m128 __C)
283{
284 return (__m128)__builtin_ia32_vfmaddsubps ((__v4sf)__A, (__v4sf)__B,
285 -(__v4sf)__C);
286}
287
288extern __inline __m256
289__attribute__((__gnu_inline__, __always_inline__, __artificial__))
290_mm256_fmsubadd_ps (__m256 __A, __m256 __B, __m256 __C)
291{
292 return (__m256)__builtin_ia32_vfmaddsubps256 ((__v8sf)__A,
293 (__v8sf)__B,
294 -(__v8sf)__C);
295}
296
97db2bf7
ST
297#ifdef __DISABLE_FMA__
298#undef __DISABLE_FMA__
299#pragma GCC pop_options
300#endif /* __DISABLE_FMA__ */
2ddd46d6
IT
301
302#endif