]> git.ipfire.org Git - thirdparty/gcc.git/blob - libgomp/testsuite/libgomp.c-c++-common/pr66199-10.c
* builtin-types.def (BT_FN_VOID_BOOL, BT_FN_VOID_SIZE_SIZE_PTR,
[thirdparty/gcc.git] / libgomp / testsuite / libgomp.c-c++-common / pr66199-10.c
1 /* PR middle-end/66199 */
2 /* { dg-do run } */
3
4 int u[1024], v[1024], w[1024];
5
6 __attribute__((noinline, noclone)) long
7 f1 (long a, long b)
8 {
9 long d;
10 #pragma omp teams distribute parallel for simd default(none) firstprivate (a, b) shared(u, v, w)
11 for (d = a; d < b; d++)
12 u[d] = v[d] + w[d];
13 return d;
14 }
15
16 __attribute__((noinline, noclone)) long
17 f2 (long a, long b, long c)
18 {
19 long d, e;
20 #pragma omp teams distribute parallel for simd default(none) firstprivate (a, b, c) shared(u, v, w) linear(d) lastprivate(e)
21 for (d = a; d < b; d++)
22 {
23 u[d] = v[d] + w[d];
24 e = c + d * 5;
25 }
26 return d + e;
27 }
28
29 __attribute__((noinline, noclone)) long
30 f3 (long a1, long b1, long a2, long b2)
31 {
32 long d1, d2;
33 #pragma omp teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) lastprivate(d1, d2) collapse(2)
34 for (d1 = a1; d1 < b1; d1++)
35 for (d2 = a2; d2 < b2; d2++)
36 u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
37 return d1 + d2;
38 }
39
40 __attribute__((noinline, noclone)) long
41 f4 (long a1, long b1, long a2, long b2)
42 {
43 long d1, d2;
44 #pragma omp teams distribute parallel for simd default(none) firstprivate (a1, b1, a2, b2) shared(u, v, w) collapse(2)
45 for (d1 = a1; d1 < b1; d1++)
46 for (d2 = a2; d2 < b2; d2++)
47 u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
48 return d1 + d2;
49 }
50
51 int
52 main ()
53 {
54 if (f1 (0, 1024) != 1024
55 || f2 (0, 1024, 17) != 1024 + (17 + 5 * 1023)
56 || f3 (0, 32, 0, 32) != 64
57 || f4 (0, 32, 0, 32) != 64)
58 __builtin_abort ();
59 return 0;
60 }