Daily bump.
[official-gcc.git] / libgomp / testsuite / libgomp.c / pr66199-7.c
blob752367e3ac5dbb9f83ac00186303a5dba7cc3e02
1 /* PR middle-end/66199 */
2 /* { dg-do run } */
4 #pragma omp declare target
5 int u[1024], v[1024], w[1024];
6 #pragma omp end declare target
8 __attribute__((noinline, noclone)) long
9 f1 (long a, long b)
11 long d;
12 #pragma omp target map(from: d)
13 #pragma omp teams distribute simd default(none) firstprivate (a, b) shared(u, v, w)
14 for (d = a; d < b; d++)
15 u[d] = v[d] + w[d];
16 return d;
19 __attribute__((noinline, noclone)) long
20 f2 (long a, long b, long c)
22 long d, e;
23 #pragma omp target map(from: d, e)
24 #pragma omp teams distribute simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e)
25 for (d = a; d < b; d++)
27 u[d] = v[d] + w[d];
28 e = c + d * 5;
30 return d + e;
33 __attribute__((noinline, noclone)) long
34 f3 (long a1, long b1, long a2, long b2)
36 long d1, d2;
37 #pragma omp target map(from: d1, d2)
38 #pragma omp teams distribute simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
39 for (d1 = a1; d1 < b1; d1++)
40 for (d2 = a2; d2 < b2; d2++)
41 u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
42 return d1 + d2;
45 __attribute__((noinline, noclone)) long
46 f4 (long a1, long b1, long a2, long b2)
48 long d1, d2;
49 #pragma omp target map(from: d1, d2)
50 #pragma omp teams distribute simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
51 for (d1 = a1; d1 < b1; d1++)
52 for (d2 = a2; d2 < b2; d2++)
53 u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
54 return d1 + d2;
57 int
58 main ()
60 if (f1 (0, 1024) != 1024
61 || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
62 || f3 (0, 32, 0, 32) != 64
63 || f4 (0, 32, 0, 32) != 64)
64 __builtin_abort ();
65 return 0;