1 // RUN: %clang_cc1 -fsyntax-only -fopenmp -triple x86_64-unknown-unknown -verify %s
3 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp taskloop simd'}}
4 #pragma omp taskloop simd
6 // expected-error@+1 {{unexpected OpenMP directive '#pragma omp taskloop simd'}}
7 #pragma omp taskloop simd foo
9 void test_no_clause() {
11 #pragma omp taskloop simd
12 for (i = 0; i < 16; ++i)
15 // expected-error@+2 {{statement after '#pragma omp taskloop simd' must be a for loop}}
16 #pragma omp taskloop simd
20 void test_branch_protected_scope() {
28 #pragma omp taskloop simd
29 for (i = 0; i < 16; ++i) {
31 goto L1; // expected-error {{use of undeclared label 'L1'}}
33 return; // expected-error {{cannot return from OpenMP region}}
43 goto L2; // expected-error {{use of undeclared label 'L2'}}
48 void test_invalid_clause() {
51 // expected-warning@+1 {{extra tokens at the end of '#pragma omp taskloop simd' are ignored}}
52 #pragma omp taskloop simd foo bar
53 for (i = 0; i < 16; ++i)
55 // expected-error@+1 {{directive '#pragma omp taskloop simd' cannot contain more than one 'nogroup' clause}}
56 #pragma omp taskloop simd nogroup nogroup
57 for (i = 0; i < 16; ++i)
61 void test_non_identifiers() {
65 // expected-warning@+1 {{extra tokens at the end of '#pragma omp taskloop simd' are ignored}}
66 #pragma omp taskloop simd;
67 for (i = 0; i < 16; ++i)
69 // expected-warning@+2 {{extra tokens at the end of '#pragma omp taskloop simd' are ignored}}
71 #pragma omp taskloop simd linear(x);
72 for (i = 0; i < 16; ++i)
76 // expected-warning@+1 {{extra tokens at the end of '#pragma omp taskloop simd' are ignored}}
77 #pragma omp taskloop simd private(x);
78 for (i = 0; i < 16; ++i)
82 // expected-warning@+1 {{extra tokens at the end of '#pragma omp taskloop simd' are ignored}}
83 #pragma omp taskloop simd, private(x);
84 for (i = 0; i < 16; ++i)
90 void test_collapse() {
93 // expected-error@+1 {{expected '('}}
94 #pragma omp taskloop simd collapse
95 for (i = 0; i < 16; ++i)
98 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
99 #pragma omp taskloop simd collapse(
100 for (i = 0; i < 16; ++i)
103 // expected-error@+1 {{expected expression}}
104 #pragma omp taskloop simd collapse()
105 for (i = 0; i < 16; ++i)
108 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
109 #pragma omp taskloop simd collapse(,
110 for (i = 0; i < 16; ++i)
113 // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
114 #pragma omp taskloop simd collapse(, )
115 for (i = 0; i < 16; ++i)
118 // expected-warning@+2 {{extra tokens at the end of '#pragma omp taskloop simd' are ignored}}
119 // expected-error@+1 {{expected '('}}
120 #pragma omp taskloop simd collapse 4)
121 for (i = 0; i < 16; ++i)
124 // expected-error@+2 {{expected ')'}}
125 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
126 #pragma omp taskloop simd collapse(4
127 for (i = 0; i < 16; ++i)
128 ; // expected-error {{expected 4 for loops after '#pragma omp taskloop simd', but found only 1}}
130 // expected-error@+2 {{expected ')'}}
131 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
132 #pragma omp taskloop simd collapse(4,
133 for (i = 0; i < 16; ++i)
134 ; // expected-error {{expected 4 for loops after '#pragma omp taskloop simd', but found only 1}}
136 // expected-error@+2 {{expected ')'}}
137 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
138 #pragma omp taskloop simd collapse(4, )
139 for (i = 0; i < 16; ++i)
140 ; // expected-error {{expected 4 for loops after '#pragma omp taskloop simd', but found only 1}}
142 // expected-note@+1 {{as specified in 'collapse' clause}}
143 #pragma omp taskloop simd collapse(4)
144 for (i = 0; i < 16; ++i)
145 ; // expected-error {{expected 4 for loops after '#pragma omp taskloop simd', but found only 1}}
147 // expected-error@+2 {{expected ')'}}
148 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
149 #pragma omp taskloop simd collapse(4 4)
150 for (i = 0; i < 16; ++i)
151 ; // expected-error {{expected 4 for loops after '#pragma omp taskloop simd', but found only 1}}
153 // expected-error@+2 {{expected ')'}}
154 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
155 #pragma omp taskloop simd collapse(4, , 4)
156 for (i = 0; i < 16; ++i)
157 ; // expected-error {{expected 4 for loops after '#pragma omp taskloop simd', but found only 1}}
159 #pragma omp taskloop simd collapse(4)
160 for (int i1 = 0; i1 < 16; ++i1)
161 for (int i2 = 0; i2 < 16; ++i2)
162 for (int i3 = 0; i3 < 16; ++i3)
163 for (int i4 = 0; i4 < 16; ++i4)
166 // expected-error@+2 {{expected ')'}}
167 // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
168 #pragma omp taskloop simd collapse(4, 8)
169 for (i = 0; i < 16; ++i)
170 ; // expected-error {{expected 4 for loops after '#pragma omp taskloop simd', but found only 1}}
172 // expected-error@+1 {{expression is not an integer constant expression}}
173 #pragma omp taskloop simd collapse(2.5)
174 for (i = 0; i < 16; ++i)
177 // expected-error@+1 {{expression is not an integer constant expression}}
178 #pragma omp taskloop simd collapse(foo())
179 for (i = 0; i < 16; ++i)
182 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
183 #pragma omp taskloop simd collapse(-5)
184 for (i = 0; i < 16; ++i)
187 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
188 #pragma omp taskloop simd collapse(0)
189 for (i = 0; i < 16; ++i)
192 // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
193 #pragma omp taskloop simd collapse(5 - 5)
194 for (i = 0; i < 16; ++i)
198 void test_private() {
201 // expected-error@+2 {{expected expression}}
202 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
203 #pragma omp taskloop simd private(
204 for (i = 0; i < 16; ++i)
207 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
208 // expected-error@+1 2 {{expected expression}}
209 #pragma omp taskloop simd private(,
210 for (i = 0; i < 16; ++i)
213 // expected-error@+1 2 {{expected expression}}
214 #pragma omp taskloop simd private(, )
215 for (i = 0; i < 16; ++i)
218 // expected-error@+1 {{expected expression}}
219 #pragma omp taskloop simd private()
220 for (i = 0; i < 16; ++i)
223 // expected-error@+1 {{expected expression}}
224 #pragma omp taskloop simd private(int)
225 for (i = 0; i < 16; ++i)
228 // expected-error@+1 {{expected variable name}}
229 #pragma omp taskloop simd private(0)
230 for (i = 0; i < 16; ++i)
235 #pragma omp taskloop simd private(x)
236 for (i = 0; i < 16; ++i)
239 #pragma omp taskloop simd private(x, y)
240 for (i = 0; i < 16; ++i)
243 #pragma omp taskloop simd private(x, y, z)
244 for (i = 0; i < 16; ++i) {
249 void test_lastprivate() {
252 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
253 // expected-error@+1 {{expected expression}}
254 #pragma omp taskloop simd lastprivate(
255 for (i = 0; i < 16; ++i)
259 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
260 // expected-error@+1 2 {{expected expression}}
261 #pragma omp taskloop simd lastprivate(,
262 for (i = 0; i < 16; ++i)
265 // expected-error@+1 2 {{expected expression}}
266 #pragma omp taskloop simd lastprivate(, )
267 for (i = 0; i < 16; ++i)
270 // expected-error@+1 {{expected expression}}
271 #pragma omp taskloop simd lastprivate()
272 for (i = 0; i < 16; ++i)
275 // expected-error@+1 {{expected expression}}
276 #pragma omp taskloop simd lastprivate(int)
277 for (i = 0; i < 16; ++i)
280 // expected-error@+1 {{expected variable name}}
281 #pragma omp taskloop simd lastprivate(0)
282 for (i = 0; i < 16; ++i)
287 #pragma omp taskloop simd lastprivate(x)
288 for (i = 0; i < 16; ++i)
291 #pragma omp taskloop simd lastprivate(x, y)
292 for (i = 0; i < 16; ++i)
295 #pragma omp taskloop simd lastprivate(x, y, z)
296 for (i = 0; i < 16; ++i)
300 void test_firstprivate() {
303 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
304 // expected-error@+1 {{expected expression}}
305 #pragma omp taskloop simd firstprivate(
306 for (i = 0; i < 16; ++i)
310 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
311 // expected-error@+1 2 {{expected expression}}
312 #pragma omp taskloop simd firstprivate(,
313 for (i = 0; i < 16; ++i)
316 // expected-error@+1 2 {{expected expression}}
317 #pragma omp taskloop simd firstprivate(, )
318 for (i = 0; i < 16; ++i)
321 // expected-error@+1 {{expected expression}}
322 #pragma omp taskloop simd firstprivate()
323 for (i = 0; i < 16; ++i)
326 // expected-error@+1 {{expected expression}}
327 #pragma omp taskloop simd firstprivate(int)
328 for (i = 0; i < 16; ++i)
331 // expected-error@+1 {{expected variable name}}
332 #pragma omp taskloop simd firstprivate(0)
333 for (i = 0; i < 16; ++i)
338 #pragma omp taskloop simd lastprivate(x) firstprivate(x)
339 for (i = 0; i < 16; ++i)
342 #pragma omp taskloop simd lastprivate(x, y) firstprivate(x, y)
343 for (i = 0; i < 16; ++i)
346 #pragma omp taskloop simd lastprivate(x, y, z) firstprivate(x, y, z)
347 for (i = 0; i < 16; ++i)
351 void test_loop_messages() {
352 float a[100], b[100], c[100];
354 // expected-error@+2 {{variable must be of integer or pointer type}}
355 #pragma omp taskloop simd
356 for (float fi = 0; fi < 10.0; fi++) {
357 c[(int)fi] = a[(int)fi] + b[(int)fi];
360 // expected-error@+2 {{variable must be of integer or pointer type}}
361 #pragma omp taskloop simd
362 for (double fi = 0; fi < 10.0; fi++) {
363 c[(int)fi] = a[(int)fi] + b[(int)fi];
366 // expected-warning@+2 {{OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed}}
367 #pragma omp taskloop simd
368 for (__int128 ii = 0; ii < 10; ii++) {
369 c[ii] = a[ii] + b[ii];