Fix gcc.dg/vect/bb-slp-77.c for x86
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / fma-compile.c
blob0445f7bc0ad59640d6831ba38022364642ac98f8
1 /* Test that the compiler properly generates floating point multiply
2 and add instructions FMA systems. */
4 /* { dg-do compile } */
5 /* { dg-options "-O2 -mfma" } */
7 #include <x86intrin.h>
9 __m128d
10 check_mm_fmadd_pd (__m128d a, __m128d b, __m128d c)
12 return _mm_fmadd_pd (a, b, c);
15 __m256d
16 check_mm256_fmadd_pd (__m256d a, __m256d b, __m256d c)
18 return _mm256_fmadd_pd (a, b, c);
21 __m128
22 check_mm_fmadd_ps (__m128 a, __m128 b, __m128 c)
24 return _mm_fmadd_ps (a, b, c);
27 __m256
28 check_mm256_fmadd_ps (__m256 a, __m256 b, __m256 c)
30 return _mm256_fmadd_ps (a, b, c);
33 __m128d
34 check_mm_fmadd_sd (__m128d a, __m128d b, __m128d c)
36 return _mm_fmadd_sd (a, b, c);
39 __m128
40 check_mm_fmadd_ss (__m128 a, __m128 b, __m128 c)
42 return _mm_fmadd_ss (a, b, c);
45 __m128d
46 check_mm_fmsub_pd (__m128d a, __m128d b, __m128d c)
48 return _mm_fmsub_pd (a, b, c);
51 __m256d
52 check_mm256_fmsub_pd (__m256d a, __m256d b, __m256d c)
54 return _mm256_fmsub_pd (a, b, c);
57 __m128
58 check_mm_fmsub_ps (__m128 a, __m128 b, __m128 c)
60 return _mm_fmsub_ps (a, b, c);
63 __m256
64 check_mm256_fmsub_ps (__m256 a, __m256 b, __m256 c)
66 return _mm256_fmsub_ps (a, b, c);
69 __m128d
70 check_mm_fmsub_sd (__m128d a, __m128d b, __m128d c)
72 return _mm_fmsub_sd (a, b, c);
75 __m128
76 check_mm_fmsub_ss (__m128 a, __m128 b, __m128 c)
78 return _mm_fmsub_ss (a, b, c);
81 __m128d
82 check_mm_fnmadd_pd (__m128d a, __m128d b, __m128d c)
84 return _mm_fnmadd_pd (a, b, c);
87 __m256d
88 check_mm256_fnmadd_pd (__m256d a, __m256d b, __m256d c)
90 return _mm256_fnmadd_pd (a, b, c);
93 __m128
94 check_mm_fnmadd_ps (__m128 a, __m128 b, __m128 c)
96 return _mm_fnmadd_ps (a, b, c);
99 __m256
100 check_mm256_fnmadd_ps (__m256 a, __m256 b, __m256 c)
102 return _mm256_fnmadd_ps (a, b, c);
105 __m128d
106 check_mm_fnmadd_sd (__m128d a, __m128d b, __m128d c)
108 return _mm_fnmadd_sd (a, b, c);
111 __m128
112 check_mm_fnmadd_ss (__m128 a, __m128 b, __m128 c)
114 return _mm_fnmadd_ss (a, b, c);
117 __m128d
118 check_mm_fnmsub_pd (__m128d a, __m128d b, __m128d c)
120 return _mm_fnmsub_pd (a, b, c);
123 __m256d
124 check_mm256_fnmsub_pd (__m256d a, __m256d b, __m256d c)
126 return _mm256_fnmsub_pd (a, b, c);
129 __m128
130 check_mm_fnmsub_ps (__m128 a, __m128 b, __m128 c)
132 return _mm_fnmsub_ps (a, b, c);
135 __m256
136 check_mm256_fnmsub_ps (__m256 a, __m256 b, __m256 c)
138 return _mm256_fnmsub_ps (a, b, c);
141 __m128d
142 check_mm_fnmsub_sd (__m128d a, __m128d b, __m128d c)
144 return _mm_fnmsub_sd (a, b, c);
147 __m128
148 check_mm_fnmsub_ss (__m128 a, __m128 b, __m128 c)
150 return _mm_fnmsub_ss (a, b, c);
153 __m128d
154 check_mm_fmaddsub_pd (__m128d a, __m128d b, __m128d c)
156 return _mm_fmaddsub_pd (a, b, c);
159 __m256d
160 check_mm256_fmaddsub_pd (__m256d a, __m256d b, __m256d c)
162 return _mm256_fmaddsub_pd (a, b, c);
165 __m128
166 check_mm_fmaddsub_ps (__m128 a, __m128 b, __m128 c)
168 return _mm_fmaddsub_ps (a, b, c);
171 __m256
172 check_mm256_fmaddsub_ps (__m256 a, __m256 b, __m256 c)
174 return _mm256_fmaddsub_ps (a, b, c);
177 __m128d
178 check_mm_fmsubadd_pd (__m128d a, __m128d b, __m128d c)
180 return _mm_fmsubadd_pd (a, b, c);
183 __m256d
184 check_mm256_fmsubadd_pd (__m256d a, __m256d b, __m256d c)
186 return _mm256_fmsubadd_pd (a, b, c);
189 __m128
190 check_mm_fmsubadd_ps (__m128 a, __m128 b, __m128 c)
192 return _mm_fmsubadd_ps (a, b, c);
195 __m256
196 check_mm256_fmsubadd_ps (__m256 a, __m256 b, __m256 c)
198 return _mm256_fmsubadd_ps (a, b, c);
202 /* { dg-final { scan-assembler-times "vfmadd\[^s\]..ps" 2 } } */
203 /* { dg-final { scan-assembler-times "vfmsub\[^s\]..ps" 2 } } */
204 /* { dg-final { scan-assembler-times "vfnmadd...ps" 2 } } */
205 /* { dg-final { scan-assembler-times "vfnmsub...ps" 2 } } */
206 /* { dg-final { scan-assembler-times "vfmaddsub...ps" 2 } } */
207 /* { dg-final { scan-assembler-times "vfmsubadd...ps" 2 } } */
208 /* { dg-final { scan-assembler-times "vfmadd\[^s\]..pd" 2 } } */
209 /* { dg-final { scan-assembler-times "vfmsub\[^s\]..pd" 2 } } */
210 /* { dg-final { scan-assembler-times "vfnmadd...pd" 2 } } */
211 /* { dg-final { scan-assembler-times "vfnmsub...pd" 2 } } */
212 /* { dg-final { scan-assembler-times "vfmaddsub...pd" 2 } } */
213 /* { dg-final { scan-assembler-times "vfmsubadd...pd" 2 } } */
214 /* { dg-final { scan-assembler-times "vfmadd\[^s\]..ss" 1 } } */
215 /* { dg-final { scan-assembler-times "vfmsub\[^s\]..ss" 1 } } */
216 /* { dg-final { scan-assembler-times "vfnmadd...ss" 1 } } */
217 /* { dg-final { scan-assembler-times "vfnmsub...ss" 1 } } */
218 /* { dg-final { scan-assembler-times "vfmadd\[^s\]..sd" 1 } } */
219 /* { dg-final { scan-assembler-times "vfmsub\[^s\]..sd" 1 } } */
220 /* { dg-final { scan-assembler-times "vfnmadd...sd" 1 } } */
221 /* { dg-final { scan-assembler-times "vfnmsub...sd" 1 } } */