Merge from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-simd-clone-3.c
blob857c6f783e3cdf4968eb364904ce83f7fad88541
1 /* { dg-require-effective-target vect_simd_clones } */
2 /* { dg-additional-options "-fopenmp-simd" } */
3 /* { dg-additional-options "-mavx" { target avx_runtime } } */
5 #include "tree-vect.h"
7 #ifndef N
8 #define N 1024
9 #endif
11 int d[N], e[N];
13 #pragma omp declare simd simdlen(4) notinbranch uniform(b) linear(c:3)
14 __attribute__((noinline)) int
15 foo (int a, int b, int c)
17 if (a < 30)
18 return 5;
19 return a + b + c;
22 __attribute__((noinline, noclone)) void
23 bar ()
25 int i;
26 #pragma omp simd
27 for (i = 0; i < N; ++i)
29 d[i] = foo (i, 123, i * 3);
30 e[i] = e[i] + i;
34 int
35 main ()
37 int i;
38 check_vect ();
39 bar ();
40 for (i = 0; i < N; i++)
41 if (d[i] != (i < 30 ? 5 : i * 4 + 123) || e[i] != i)
42 abort ();
43 return 0;
46 /* { dg-final { cleanup-tree-dump "vect" } } */