[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / lib / Headers / fma4intrin.h
blob694801b3e8dd4bc0b8639ca0a75c13be19523f71
1 /*===---- fma4intrin.h - FMA4 intrinsics -----------------------------------===
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 *===-----------------------------------------------------------------------===
8 */
10 #ifndef __X86INTRIN_H
11 #error "Never use <fma4intrin.h> directly; include <x86intrin.h> instead."
12 #endif
14 #ifndef __FMA4INTRIN_H
15 #define __FMA4INTRIN_H
17 #include <pmmintrin.h>
19 /* Define the default attributes for the functions in this file. */
20 #define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("fma4"), __min_vector_width__(128)))
21 #define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("fma4"), __min_vector_width__(256)))
23 static __inline__ __m128 __DEFAULT_FN_ATTRS128
24 _mm_macc_ps(__m128 __A, __m128 __B, __m128 __C)
26 return (__m128)__builtin_ia32_vfmaddps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
29 static __inline__ __m128d __DEFAULT_FN_ATTRS128
30 _mm_macc_pd(__m128d __A, __m128d __B, __m128d __C)
32 return (__m128d)__builtin_ia32_vfmaddpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
35 static __inline__ __m128 __DEFAULT_FN_ATTRS128
36 _mm_macc_ss(__m128 __A, __m128 __B, __m128 __C)
38 return (__m128)__builtin_ia32_vfmaddss((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
41 static __inline__ __m128d __DEFAULT_FN_ATTRS128
42 _mm_macc_sd(__m128d __A, __m128d __B, __m128d __C)
44 return (__m128d)__builtin_ia32_vfmaddsd((__v2df)__A, (__v2df)__B, (__v2df)__C);
47 static __inline__ __m128 __DEFAULT_FN_ATTRS128
48 _mm_msub_ps(__m128 __A, __m128 __B, __m128 __C)
50 return (__m128)__builtin_ia32_vfmaddps((__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
53 static __inline__ __m128d __DEFAULT_FN_ATTRS128
54 _mm_msub_pd(__m128d __A, __m128d __B, __m128d __C)
56 return (__m128d)__builtin_ia32_vfmaddpd((__v2df)__A, (__v2df)__B, -(__v2df)__C);
59 static __inline__ __m128 __DEFAULT_FN_ATTRS128
60 _mm_msub_ss(__m128 __A, __m128 __B, __m128 __C)
62 return (__m128)__builtin_ia32_vfmaddss((__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
65 static __inline__ __m128d __DEFAULT_FN_ATTRS128
66 _mm_msub_sd(__m128d __A, __m128d __B, __m128d __C)
68 return (__m128d)__builtin_ia32_vfmaddsd((__v2df)__A, (__v2df)__B, -(__v2df)__C);
71 static __inline__ __m128 __DEFAULT_FN_ATTRS128
72 _mm_nmacc_ps(__m128 __A, __m128 __B, __m128 __C)
74 return (__m128)__builtin_ia32_vfmaddps(-(__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
77 static __inline__ __m128d __DEFAULT_FN_ATTRS128
78 _mm_nmacc_pd(__m128d __A, __m128d __B, __m128d __C)
80 return (__m128d)__builtin_ia32_vfmaddpd(-(__v2df)__A, (__v2df)__B, (__v2df)__C);
83 static __inline__ __m128 __DEFAULT_FN_ATTRS128
84 _mm_nmacc_ss(__m128 __A, __m128 __B, __m128 __C)
86 return (__m128)__builtin_ia32_vfmaddss(-(__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
89 static __inline__ __m128d __DEFAULT_FN_ATTRS128
90 _mm_nmacc_sd(__m128d __A, __m128d __B, __m128d __C)
92 return (__m128d)__builtin_ia32_vfmaddsd(-(__v2df)__A, (__v2df)__B, (__v2df)__C);
95 static __inline__ __m128 __DEFAULT_FN_ATTRS128
96 _mm_nmsub_ps(__m128 __A, __m128 __B, __m128 __C)
98 return (__m128)__builtin_ia32_vfmaddps(-(__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
101 static __inline__ __m128d __DEFAULT_FN_ATTRS128
102 _mm_nmsub_pd(__m128d __A, __m128d __B, __m128d __C)
104 return (__m128d)__builtin_ia32_vfmaddpd(-(__v2df)__A, (__v2df)__B, -(__v2df)__C);
107 static __inline__ __m128 __DEFAULT_FN_ATTRS128
108 _mm_nmsub_ss(__m128 __A, __m128 __B, __m128 __C)
110 return (__m128)__builtin_ia32_vfmaddss(-(__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
113 static __inline__ __m128d __DEFAULT_FN_ATTRS128
114 _mm_nmsub_sd(__m128d __A, __m128d __B, __m128d __C)
116 return (__m128d)__builtin_ia32_vfmaddsd(-(__v2df)__A, (__v2df)__B, -(__v2df)__C);
119 static __inline__ __m128 __DEFAULT_FN_ATTRS128
120 _mm_maddsub_ps(__m128 __A, __m128 __B, __m128 __C)
122 return (__m128)__builtin_ia32_vfmaddsubps((__v4sf)__A, (__v4sf)__B, (__v4sf)__C);
125 static __inline__ __m128d __DEFAULT_FN_ATTRS128
126 _mm_maddsub_pd(__m128d __A, __m128d __B, __m128d __C)
128 return (__m128d)__builtin_ia32_vfmaddsubpd((__v2df)__A, (__v2df)__B, (__v2df)__C);
131 static __inline__ __m128 __DEFAULT_FN_ATTRS128
132 _mm_msubadd_ps(__m128 __A, __m128 __B, __m128 __C)
134 return (__m128)__builtin_ia32_vfmaddsubps((__v4sf)__A, (__v4sf)__B, -(__v4sf)__C);
137 static __inline__ __m128d __DEFAULT_FN_ATTRS128
138 _mm_msubadd_pd(__m128d __A, __m128d __B, __m128d __C)
140 return (__m128d)__builtin_ia32_vfmaddsubpd((__v2df)__A, (__v2df)__B, -(__v2df)__C);
143 static __inline__ __m256 __DEFAULT_FN_ATTRS256
144 _mm256_macc_ps(__m256 __A, __m256 __B, __m256 __C)
146 return (__m256)__builtin_ia32_vfmaddps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
149 static __inline__ __m256d __DEFAULT_FN_ATTRS256
150 _mm256_macc_pd(__m256d __A, __m256d __B, __m256d __C)
152 return (__m256d)__builtin_ia32_vfmaddpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
155 static __inline__ __m256 __DEFAULT_FN_ATTRS256
156 _mm256_msub_ps(__m256 __A, __m256 __B, __m256 __C)
158 return (__m256)__builtin_ia32_vfmaddps256((__v8sf)__A, (__v8sf)__B, -(__v8sf)__C);
161 static __inline__ __m256d __DEFAULT_FN_ATTRS256
162 _mm256_msub_pd(__m256d __A, __m256d __B, __m256d __C)
164 return (__m256d)__builtin_ia32_vfmaddpd256((__v4df)__A, (__v4df)__B, -(__v4df)__C);
167 static __inline__ __m256 __DEFAULT_FN_ATTRS256
168 _mm256_nmacc_ps(__m256 __A, __m256 __B, __m256 __C)
170 return (__m256)__builtin_ia32_vfmaddps256(-(__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
173 static __inline__ __m256d __DEFAULT_FN_ATTRS256
174 _mm256_nmacc_pd(__m256d __A, __m256d __B, __m256d __C)
176 return (__m256d)__builtin_ia32_vfmaddpd256(-(__v4df)__A, (__v4df)__B, (__v4df)__C);
179 static __inline__ __m256 __DEFAULT_FN_ATTRS256
180 _mm256_nmsub_ps(__m256 __A, __m256 __B, __m256 __C)
182 return (__m256)__builtin_ia32_vfmaddps256(-(__v8sf)__A, (__v8sf)__B, -(__v8sf)__C);
185 static __inline__ __m256d __DEFAULT_FN_ATTRS256
186 _mm256_nmsub_pd(__m256d __A, __m256d __B, __m256d __C)
188 return (__m256d)__builtin_ia32_vfmaddpd256(-(__v4df)__A, (__v4df)__B, -(__v4df)__C);
191 static __inline__ __m256 __DEFAULT_FN_ATTRS256
192 _mm256_maddsub_ps(__m256 __A, __m256 __B, __m256 __C)
194 return (__m256)__builtin_ia32_vfmaddsubps256((__v8sf)__A, (__v8sf)__B, (__v8sf)__C);
197 static __inline__ __m256d __DEFAULT_FN_ATTRS256
198 _mm256_maddsub_pd(__m256d __A, __m256d __B, __m256d __C)
200 return (__m256d)__builtin_ia32_vfmaddsubpd256((__v4df)__A, (__v4df)__B, (__v4df)__C);
203 static __inline__ __m256 __DEFAULT_FN_ATTRS256
204 _mm256_msubadd_ps(__m256 __A, __m256 __B, __m256 __C)
206 return (__m256)__builtin_ia32_vfmaddsubps256((__v8sf)__A, (__v8sf)__B, -(__v8sf)__C);
209 static __inline__ __m256d __DEFAULT_FN_ATTRS256
210 _mm256_msubadd_pd(__m256d __A, __m256d __B, __m256d __C)
212 return (__m256d)__builtin_ia32_vfmaddsubpd256((__v4df)__A, (__v4df)__B, -(__v4df)__C);
215 #undef __DEFAULT_FN_ATTRS128
216 #undef __DEFAULT_FN_ATTRS256
218 #endif /* __FMA4INTRIN_H */