21 #pragma omp declare target to (bar, baz, v)
23 __attribute__((noinline
, noclone
)) void
24 foo (int a
, int b
, long c
, long d
)
27 if (omp_get_num_teams () != 1)
29 /* The OpenMP 4.5 spec says that these expressions are evaluated before
30 target region on combined target teams, so those cases are always
32 #pragma omp target map(from: err)
33 err
= omp_get_num_teams () != 1;
36 #pragma omp target map(from: err)
39 err
= omp_get_num_teams () < 1;
40 #pragma omp parallel if(0)
41 err
|= omp_get_thread_limit () < 1;
45 #pragma omp target teams map(from: err)
47 err
= omp_get_num_teams () < 1;
48 #pragma omp parallel if(0)
49 err
|= omp_get_thread_limit () < 1;
53 #pragma omp target map(from: err)
54 #pragma omp teams num_teams (4)
56 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > 4;
57 #pragma omp parallel if(0)
58 err
|= omp_get_thread_limit () < 1;
62 #pragma omp target teams num_teams (4) map(from: err)
64 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > 4;
65 #pragma omp parallel if(0)
66 err
|= omp_get_thread_limit () < 1;
70 #pragma omp target map(from: err)
71 #pragma omp teams thread_limit (7)
73 err
= omp_get_num_teams () < 1;
74 #pragma omp parallel if(0)
75 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > 7;
79 #pragma omp target teams thread_limit (7) map(from: err)
81 err
= omp_get_num_teams () < 1;
82 #pragma omp parallel if(0)
83 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > 7;
87 #pragma omp target map(from: err)
88 #pragma omp teams num_teams (4) thread_limit (8)
91 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > 4;
93 #pragma omp parallel if(0)
94 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > 8;
98 #pragma omp target teams num_teams (4) thread_limit (8) map(from: err)
100 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > 4;
101 #pragma omp parallel if(0)
102 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > 8;
106 #pragma omp target map(from: err)
107 #pragma omp teams num_teams (a) thread_limit (b)
109 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > a
;
110 #pragma omp parallel if(0)
111 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > b
;
115 #pragma omp target teams num_teams (a) thread_limit (b) map(from: err)
117 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > a
;
118 #pragma omp parallel if(0)
119 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > b
;
123 #pragma omp target map(from: err)
124 #pragma omp teams num_teams (c + 1) thread_limit (d - 1)
126 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > c
+ 1;
127 #pragma omp parallel if(0)
128 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > d
- 1;
132 #pragma omp target teams num_teams (c + 1) thread_limit (d - 1) map(from: err)
134 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > c
+ 1;
135 #pragma omp parallel if(0)
136 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > d
- 1;
140 #pragma omp target map (always, to: c, d) map(from: err)
141 #pragma omp teams num_teams (c + 1) thread_limit (d - 1)
143 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > c
+ 1;
144 #pragma omp parallel if(0)
145 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > d
- 1;
149 #pragma omp target data map (to: c, d)
151 #pragma omp target defaultmap (tofrom: scalar)
153 /* This is one of the cases which can't be generally optimized,
154 the c and d are (or could be) already mapped and whether
155 their device and original values match is unclear. */
156 #pragma omp target map (to: c, d) map(from: err)
157 #pragma omp teams num_teams (c + 1) thread_limit (d - 1)
159 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > c
+ 1;
160 #pragma omp parallel if(0)
161 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > d
- 1;
166 /* This can't be optimized, there are function calls inside of
168 #pragma omp target map(from: err)
169 #pragma omp teams num_teams (baz () + 1) thread_limit (baz () - 1)
171 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > baz () + 1;
172 #pragma omp parallel if(0)
173 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > baz () - 1;
177 #pragma omp target teams num_teams (baz () + 1) thread_limit (baz () - 1) map(from: err)
179 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > baz () + 1;
180 #pragma omp parallel if(0)
181 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > baz () - 1;
185 /* This one can't be optimized, as v might have different value between
187 #pragma omp target map(from: err)
188 #pragma omp teams num_teams (v + 1) thread_limit (v - 1)
190 err
= omp_get_num_teams () < 1 || omp_get_num_teams () > v
+ 1;
191 #pragma omp parallel if(0)
192 err
|= omp_get_thread_limit () < 1 || omp_get_thread_limit () > v
- 1;