cfgexpand: Expand comment on when non-var clobbers can show up
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-simd-18.c
blobe454abe88009a7572cfad1397bbd5770c7086a6b
1 /* { dg-additional-options "-fopenmp-simd -fno-tree-vectorize" } */
2 /* { dg-additional-options "-mavx" { target avx_runtime } } */
3 /* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { target i?86-*-* x86_64-*-* } } } */
5 #include "tree-vect.h"
7 __attribute__((noipa)) int
8 foo (int s, int *p)
10 int r = 0, l = 0, i;
11 #pragma omp simd reduction (+:r) linear(l)
12 for (i = 0; i < 10000; i += s)
14 p[l++] = i;
15 r += i * 3;
17 return r;
20 int p[10000 / 78 + 1];
22 int
23 main ()
25 int i, r;
26 check_vect ();
27 r = foo (78, p);
28 #pragma GCC novector
29 for (i = 0; i < 10000 / 78; i++)
30 if (p[i] != 78 * i)
31 abort ();
32 if (r != (10000 / 78) * (10000 / 78 + 1) / 2 * 78 * 3)
33 abort ();
34 r = foo (87, p);
35 #pragma GCC novector
36 for (i = 0; i < 10000 / 87; i++)
37 if (p[i] != 87 * i)
38 abort ();
39 if (r != (10000 / 87) * (10000 / 87 + 1) / 2 * 87 * 3)
40 abort ();
41 return 0;