libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr90018.c
blob08ca326f7ebfab1a42813bc121f1e5a46394e983
1 /* { dg-require-effective-target vect_double } */
3 #include "tree-vect.h"
5 void __attribute__((noinline,noclone))
6 foo (double *a4, int n)
8 for (int i = 0; i < n; ++i)
10 /* We may not apply interleaving to the group (a), (b) because of (c).
11 Instead group (d) and (b). */
12 double tem1 = a4[i*4] + a4[i*4+n*4] /* (a) */;
13 double tem2 = a4[i*4+2*n*4+1];
14 a4[i*4+n*4+1] = tem1; /* (c) */
15 a4[i*4+1] = tem2;
16 double tem3 = a4[i*4] - tem2;
17 double tem4 = tem3 + a4[i*4+n*4] /* (d) */;
18 a4[i*4+n*4+1] = tem4 + a4[i*4+n*4+1] /* (b) */;
21 int main(int argc, char **argv)
23 int n = 11;
24 double a4[4 * n * 3];
25 double a42[4 * n * 3];
26 check_vect ();
27 for (int i = 0; i < 4 * n * 3; ++i)
29 a4[i] = a42[i] = i;
30 __asm__ volatile ("": : : "memory");
32 foo (a4, n);
33 for (int i = 0; i < n; ++i)
35 double tem1 = a42[i*4] + a42[i*4+n*4];
36 double tem2 = a42[i*4+2*n*4+1];
37 a42[i*4+n*4+1] = tem1;
38 a42[i*4+1] = tem2;
39 double tem3 = a42[i*4] - tem2;
40 double tem4 = tem3 + a42[i*4+n*4];
41 a42[i*4+n*4+1] = tem4 + a42[i*4+n*4+1];
42 __asm__ volatile ("": : : "memory");
44 #pragma GCC novector
45 for (int i = 0; i < 4 * n * 3; ++i)
46 if (a4[i] != a42[i])
47 __builtin_abort ();
48 return 0;
51 /* For v2df we try to use SLP and fail miserably. */
52 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_sizes_32B_16B } } } */