2014-09-25 Sandra Loosemore <sandra@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-simd-clone-10.c
blob923a9453c25f92397047a2e7512abc6e389d2774
1 /* { dg-require-effective-target vect_simd_clones } */
2 /* { dg-additional-options "-fopenmp-simd" } */
3 /* { dg-additional-options "-mavx" { target avx_runtime } } */
4 /* { dg-additional-sources vect-simd-clone-10a.c } */
6 #include "tree-vect.h"
8 #ifndef N
9 #define N 1024
10 #endif
12 int a[N], b[N];
13 long int c[N];
14 unsigned char d[N];
16 #include "vect-simd-clone-10.h"
18 __attribute__((noinline)) void
19 fn1 (void)
21 int i;
22 #pragma omp simd
23 for (i = 0; i < N; i++)
24 a[i] = foo (c[i], a[i], b[i]) + 6;
25 #pragma omp simd
26 for (i = 0; i < N; i++)
27 c[i] = bar (a[i], b[i], c[i]) * 2;
30 __attribute__((noinline)) void
31 fn2 (void)
33 int i;
34 #pragma omp simd
35 for (i = 0; i < N; i++)
37 a[i] = foo (c[i], a[i], b[i]) + 6;
38 d[i]++;
40 #pragma omp simd
41 for (i = 0; i < N; i++)
43 c[i] = bar (a[i], b[i], c[i]) * 2;
44 d[i] /= 2;
48 __attribute__((noinline)) void
49 fn3 (void)
51 int i;
52 for (i = 0; i < N; i++)
54 a[i] = i * 2;
55 b[i] = 17 + (i % 37);
56 c[i] = (i & 63);
57 d[i] = 16 + i;
61 int
62 main ()
64 int i;
65 check_vect ();
66 fn3 ();
67 fn1 ();
68 for (i = 0; i < N; i++)
69 if (a[i] != i * 2 + 23 + (i % 37) + (i & 63)
70 || b[i] != 17 + (i % 37)
71 || c[i] != i * 4 + 80 + 4 * (i % 37) + 4 * (i & 63))
72 abort ();
73 fn3 ();
74 fn2 ();
75 for (i = 0; i < N; i++)
76 if (a[i] != i * 2 + 23 + (i % 37) + (i & 63)
77 || b[i] != 17 + (i % 37)
78 || c[i] != i * 4 + 80 + 4 * (i % 37) + 4 * (i & 63)
79 || d[i] != ((unsigned char) (17 + i)) / 2)
80 abort ();
81 return 0;
84 /* { dg-final { cleanup-tree-dump "vect" } } */