1 /* { dg-require-effective-target vect_simd_clones } */
2 /* { dg-additional-options "-fopenmp-simd" } */
3 /* { dg-additional-options "-mavx" { target avx_runtime } } */
4 
5 #include "tree-vect.h"
6 
7 #ifndef N
8 #define N 1024
9 #endif
10 
11 int array[N] __attribute__((aligned (32)));
12 
13 #pragma omp declare simd simdlen(4) notinbranch aligned(a:16) uniform(a) linear(b)
14 #pragma omp declare simd simdlen(4) notinbranch aligned(a:32) uniform(a) linear(b)
15 #pragma omp declare simd simdlen(8) notinbranch aligned(a:16) uniform(a) linear(b)
16 #pragma omp declare simd simdlen(8) notinbranch aligned(a:32) uniform(a) linear(b)
17 __attribute__((noinline)) void
foo(int * a,int b,int c)18 foo (int *a, int b, int c)
19 {
20   a[b] = c;
21 }
22 
23 __attribute__((noinline, noclone)) void
bar()24 bar ()
25 {
26   int i;
27 #pragma omp simd
28   for (i = 0; i < N; ++i)
29     foo (array, i, i * array[i]);
30 }
31 
32 __attribute__((noinline, noclone)) void
baz()33 baz ()
34 {
35   int i;
36   for (i = 0; i < N; i++)
37     array[i] = 5 * (i & 7);
38 }
39 
40 int
main()41 main ()
42 {
43   int i;
44   check_vect ();
45   baz ();
46   bar ();
47   for (i = 0; i < N; i++)
48     if (array[i] != 5 * (i & 7) * i)
49       abort ();
50   return 0;
51 }
52 
53