Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-simd-clone-7.c
bloba0316e9e5813ac4c9076aaf5f762b9cc5dc98b1e
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 a[N];
12 long long int b[N];
13 short c[N];
15 #pragma omp declare simd
16 #pragma omp declare simd uniform(b) linear(c:3)
17 __attribute__((noinline)) short
18 foo (int a, long long int b, int c)
20 return a + b + c;
23 __attribute__((noinline, noclone)) void
24 bar (int x)
26 int i;
27 if (x == 0)
29 #pragma omp simd
30 for (i = 0; i < N; i++)
31 c[i] = foo (a[i], b[i], c[i]);
33 else
35 #pragma omp simd
36 for (i = 0; i < N; i++)
37 c[i] = foo (a[i], x, i * 3);
41 __attribute__((noinline, noclone)) void
42 baz (void)
44 int i;
45 for (i = 0; i < N; i++)
47 a[i] = 2 * i;
48 b[i] = -7 * i + 6;
49 c[i] = (i & 31) << 4;
53 int
54 main ()
56 int i;
57 check_vect ();
58 baz ();
59 bar (0);
60 for (i = 0; i < N; i++)
61 if (a[i] != 2 * i || b[i] != 6 - 7 * i
62 || c[i] != 6 - 5 * i + ((i & 31) << 4))
63 abort ();
64 else
65 a[i] = c[i];
66 bar (17);
67 for (i = 0; i < N; i++)
68 if (a[i] != 6 - 5 * i + ((i & 31) << 4)
69 || b[i] != 6 - 7 * i
70 || c[i] != 23 - 2 * i + ((i & 31) << 4))
71 abort ();
72 return 0;