Debian Codegraph @

gcc/testsuite/gcc.target/i386/vect-fmaddsubXXXps.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target fma } */
3 /* { dg-options "-O3 -mfma -save-temps" } */
4
5 #include "fma-check.h"
6
7 void __attribute__((noipa))
8 check_fmaddsub (float * __restrict a, float *b, float *c, int n)
9 {
10 for (int i = 0; i < n; ++i)
11 {
12 a[2*i + 0] = b[2*i + 0] * c[2*i + 0] - a[2*i + 0];
13 a[2*i + 1] = b[2*i + 1] * c[2*i + 1] + a[2*i + 1];
14 }
15 }
16
17 static void
18 fma_test (void)
19 {
20 float a[4], b[4], c[4];
21 for (int i = 0; i < 4; ++i)
22 {
23 a[i] = i;
24 b[i] = 3*i;
25 c[i] = 7*i;
26 }
27 check_fmaddsub (a, b, c, 2);
28 const float d[4] = { 0., 22., 82., 192. };
29 for (int i = 0; i < 4; ++i)
30 if (a[i] != d[i])
31 __builtin_abort ();
32 }
33
34 /* { dg-final { scan-assembler "fmaddsub...ps" } } */