1 /* { dg-do compile } */
2 /* { dg-additional-options "-std=c99" { target c } } */
3 
4 int t;
5 #pragma omp threadprivate (t)
6 
7 #pragma omp declare target
8 int f, l, ll, r;
9 
10 void
foo(int d,int m,int i1,int i2,int p,int * idp,int s,int nte,int tl,int nth,int g,int nta,int fi,int pp,int * q)11 foo (int d, int m, int i1, int i2, int p, int *idp, int s,
12      int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q)
13 {
14   #pragma omp distribute parallel for \
15     private (p) firstprivate (f) collapse(1) dist_schedule(static, 16) \
16     if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
17     lastprivate (l) schedule(static, 4)
18   for (int i = 0; i < 64; i++)
19     ll++;
20   #pragma omp distribute parallel for simd \
21     private (p) firstprivate (f) collapse(1) dist_schedule(static, 16) \
22     if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
23     lastprivate (l) schedule(static, 4) \
24     safelen(8) simdlen(4) aligned(q: 32)
25   for (int i = 0; i < 64; i++)
26     ll++;
27   #pragma omp distribute simd \
28     private (p) firstprivate (f) collapse(1) dist_schedule(static, 16) \
29     safelen(8) simdlen(4) aligned(q: 32) reduction(+:r)
30   for (int i = 0; i < 64; i++)
31     ll++;
32 }
33 #pragma omp end declare target
34 
35 void
bar(int d,int m,int i1,int i2,int p,int * idp,int s,int nte,int tl,int nth,int g,int nta,int fi,int pp,int * q,int * dd)36 bar (int d, int m, int i1, int i2, int p, int *idp, int s,
37      int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd)
38 {
39   #pragma omp for simd \
40     private (p) firstprivate (f) lastprivate (l) linear (ll:1) reduction(+:r) schedule(static, 4) collapse(1) nowait \
41     safelen(8) simdlen(4) aligned(q: 32)
42   for (int i = 0; i < 64; i++)
43     ll++;
44   #pragma omp parallel for \
45     private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread) \
46     lastprivate (l) linear (ll:1) ordered schedule(static, 4) collapse(1)
47   for (int i = 0; i < 64; i++)
48     ll++;
49   #pragma omp parallel for simd \
50     private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread) \
51     lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) \
52     safelen(8) simdlen(4) aligned(q: 32)
53   for (int i = 0; i < 64; i++)
54     ll++;
55   #pragma omp parallel sections \
56     private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread) \
57     lastprivate (l)
58   {
59     #pragma omp section
60     {}
61     #pragma omp section
62     {}
63   }
64   #pragma omp target parallel \
65     device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
66     if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
67     nowait depend(inout: dd[0])
68     ;
69   #pragma omp target parallel for \
70     device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
71     if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
72     lastprivate (l) linear (ll:1) ordered schedule(static, 4) collapse(1) nowait depend(inout: dd[0])
73   for (int i = 0; i < 64; i++)
74     ll++;
75   #pragma omp target parallel for simd \
76     device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
77     if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
78     lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) \
79     safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0])
80   for (int i = 0; i < 64; i++)
81     ll++;
82   #pragma omp target teams \
83     device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
84     shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0])
85     ;
86   #pragma omp target teams distribute \
87     device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
88     shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
89     collapse(1) dist_schedule(static, 16) nowait depend(inout: dd[0])
90   for (int i = 0; i < 64; i++)
91     ;
92   #pragma omp target teams distribute parallel for \
93     device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
94     shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
95     collapse(1) dist_schedule(static, 16) \
96     if (parallel: i2) num_threads (nth) proc_bind(spread) \
97     lastprivate (l) schedule(static, 4) nowait depend(inout: dd[0])
98   for (int i = 0; i < 64; i++)
99     ll++;
100   #pragma omp target teams distribute parallel for simd \
101     device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
102     shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
103     collapse(1) dist_schedule(static, 16) \
104     if (parallel: i2) num_threads (nth) proc_bind(spread) \
105     lastprivate (l) schedule(static, 4) \
106     safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0])
107   for (int i = 0; i < 64; i++)
108     ll++;
109   #pragma omp target teams distribute simd \
110     device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
111     shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
112     collapse(1) dist_schedule(static, 16) \
113     safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0])
114   for (int i = 0; i < 64; i++)
115     ll++;
116   #pragma omp target simd \
117     device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
118     safelen(8) simdlen(4) lastprivate (l) linear(ll: 1) aligned(q: 32) reduction(+:r) \
119      nowait depend(inout: dd[0])
120   for (int i = 0; i < 64; i++)
121     ll++;
122   #pragma omp taskloop simd \
123     private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable nogroup priority (pp) \
124     safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(+:r)
125   for (int i = 0; i < 64; i++)
126     ll++;
127   #pragma omp taskwait
128   #pragma omp taskloop simd \
129     private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) if(taskloop: i1) final(fi) priority (pp) \
130     safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(+:r)
131   for (int i = 0; i < 64; i++)
132     ll++;
133   #pragma omp target nowait depend(inout: dd[0])
134   #pragma omp teams distribute \
135     private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
136     collapse(1) dist_schedule(static, 16)
137   for (int i = 0; i < 64; i++)
138     ;
139   #pragma omp target
140   #pragma omp teams distribute parallel for \
141     private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
142     collapse(1) dist_schedule(static, 16) \
143     if (parallel: i2) num_threads (nth) proc_bind(spread) \
144     lastprivate (l) schedule(static, 4)
145   for (int i = 0; i < 64; i++)
146     ll++;
147   #pragma omp target
148   #pragma omp teams distribute parallel for simd \
149     private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
150     collapse(1) dist_schedule(static, 16) \
151     if (parallel: i2) num_threads (nth) proc_bind(spread) \
152     lastprivate (l) schedule(static, 4) \
153     safelen(8) simdlen(4) aligned(q: 32)
154   for (int i = 0; i < 64; i++)
155     ll++;
156   #pragma omp target
157   #pragma omp teams distribute simd \
158     private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
159     collapse(1) dist_schedule(static, 16) \
160     safelen(8) simdlen(4) aligned(q: 32)
161   for (int i = 0; i < 64; i++)
162     ll++;
163 }
164