3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -verify %s
13 for (int j
= 0 ; j
< NNN
; j
++) {
18 #pragma omp parallel for
19 for (int i
= 0 ; i
< NNN
; i
++) {
20 #pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
21 for (int j
= 0 ; j
< NNN
; j
++) {
27 #pragma omp for nowait
28 for (int i
= 0 ; i
< NNN
; i
++) {
29 #pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
30 for (int j
= 0 ; j
< NNN
; j
++) {
35 #pragma omp parallel for
36 for (int i
= 0 ; i
< NNN
; i
++) {
39 for (int j
= 0 ; j
< NNN
; j
++) {
44 #pragma omp target teams distribute parallel for
45 for (int i
= 0 ; i
< NNN
; i
++) {
46 #pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
47 for (int j
= 0 ; j
< NNN
; j
++) {
52 #pragma omp target parallel
53 for (int i
= 0 ; i
< NNN
; i
++) {
54 #pragma omp loop bind(parallel)
55 for (int j
= 0 ; j
< NNN
; j
++) {
60 #pragma omp parallel for
61 for (int i
= 0; i
< 100; ++i
) {
62 #pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
63 for (int i
= 0 ; i
< NNN
; i
++) {
64 #pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'loop' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
65 for (int j
= 0 ; j
< NNN
; j
++) {
75 for (int i
= 0 ; i
< NNN
; i
++) {
76 #pragma omp loop bind(parallel) // expected-error{{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp loop' directive into a parallel region?}}
77 for (int j
= 0 ; j
< NNN
; j
++) {
96 #pragma omp loop bind(teams)
97 for (int j
= 0 ; j
< NNN
; j
++) {
101 #pragma omp loop bind(teams) collapse(2) private(var1)
102 for (int i
= 0 ; i
< 3 ; i
++) {
103 for (int j
= 0 ; j
< NNN
; j
++) {
109 #pragma omp target teams
110 for (int i
= 0 ; i
< NNN
; i
++) {
111 #pragma omp loop bind(teams)
112 for (int j
= 0 ; j
< NNN
; j
++) {
117 #pragma omp target teams distribute parallel for
118 for (int i
= 0 ; i
< NNN
; i
++) {
119 #pragma omp loop bind(teams) // expected-error{{region cannot be closely nested inside 'target teams distribute parallel for' region; perhaps you forget to enclose 'omp loop' directive into a teams region?}}
120 for (int j
= 0 ; j
< NNN
; j
++) {
127 #pragma omp loop bind(teams)
128 for (int j
= 0 ; j
< NNN
; j
++) {
132 #pragma omp loop bind(teams) reduction(+:total) // expected-error{{'reduction' clause not allowed with '#pragma omp loop bind(teams)'}}
133 for (int j
= 0 ; j
< NNN
; j
++) {
138 #pragma omp teams num_teams(8) thread_limit(256)
139 #pragma omp distribute parallel for dist_schedule(static, 1024) \
141 for (int i
= 0; i
< NNN
; i
++) {
142 #pragma omp loop bind(teams) // expected-error{{'distribute parallel for' region; perhaps you forget to enclose 'omp loop' directive into a teams region?}}
143 for (int j
= 0; j
< NNN
; j
++) {
149 for (int i
= 0; i
< NNN
; i
++) {
150 #pragma omp loop bind(thread)
151 for (int j
= 0 ; j
< NNN
; j
++) {
156 #pragma omp teams loop
157 for (int i
= 0; i
< NNN
; i
++) {
159 for (int j
= 0 ; j
< NNN
; j
++) {
164 #pragma omp teams loop
165 for (int i
= 0; i
< NNN
; i
++) {
166 #pragma omp loop bind(teams) // expected-error{{region cannot be closely nested inside 'teams loop' region; perhaps you forget to enclose 'omp loop' directive into a teams region?}}
167 for (int j
= 0 ; j
< NNN
; j
++) {
175 for (int i
= 0; i
< NNN
; i
++) {
176 #pragma omp loop bind(thread)
177 for (int j
= 0 ; j
< NNN
; j
++) {
183 for (int i
= 0; i
< NNN
; i
++) {
184 #pragma omp loop bind(thread)
185 for (int j
= 0 ; j
< NNN
; j
++) {
191 void parallel_for_with_loop_teams_bind(){
192 #pragma omp parallel for
193 for (int i
= 0; i
< NNN
; i
++) {
194 #pragma omp loop bind(teams) // expected-error{{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp loop' directive into a teams region?}}
195 for (int j
= 0 ; j
< NNN
; j
++) {
201 void orphan_loops() {
202 #pragma omp loop // expected-error{{expected 'bind' clause for 'loop' construct without an enclosing OpenMP construct}}
203 for (int j
= 0 ; j
< NNN
; j
++) {
207 #pragma omp loop bind(parallel)
208 for (int j
= 0 ; j
< NNN
; j
++) {
212 #pragma omp loop bind(teams)
213 for (int i
= 0; i
< NNN
; i
++) {
217 #pragma omp loop bind(thread)
218 for (int i
= 0; i
< NNN
; i
++) {
223 int main(int argc
, char *argv
[]) {
227 parallel_for_with_loop_teams_bind();