1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
4 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
5 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51
6 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
8 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
9 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s
10 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
11 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
12 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51
13 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
14 // expected-no-diagnostics
22 #pragma omp threadprivate(x)
38 S7(typename
T::type v
) : a(v
) {
40 #pragma omp teams distribute parallel for private(a) private(this->a) private(T::a)
41 for (int k
= 0; k
< a
.a
; ++k
)
44 S7
&operator=(S7
&s
) {
46 #pragma omp teams distribute parallel for private(a) private(this->a)
47 for (int k
= 0; k
< s
.a
.a
; ++k
)
54 int b
, argv
, d
, c
, e
, f
;
56 #pragma omp teams distribute parallel for default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) copyin(x)
57 for (int k
= 0; k
< a
.a
; ++k
)
61 // CHECK: #pragma omp target
62 // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) private(this->a) private(T::a)
63 // CHECK: #pragma omp target
64 // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) private(this->a)
65 // CHECK: #pragma omp target
66 // CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) copyin(x)
68 class S8
: public S7
<S
> {
74 #pragma omp teams distribute parallel for private(a) private(this->a) private(S7<S>::a)
75 for (int k
= 0; k
< a
.a
; ++k
)
78 S8
&operator=(S8
&s
) {
80 #pragma omp teams distribute parallel for private(a) private(this->a)
81 for (int k
= 0; k
< s
.a
.a
; ++k
)
88 int b
, argv
, d
, c
, e
, f8
;
90 #pragma omp teams distribute parallel for allocate(b) default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f8) thread_limit(d) copyin(x) allocate(argv)
91 for (int k
= 0; k
< a
.a
; ++k
)
95 // CHECK: #pragma omp target
96 // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) private(this->a) private(this->S::a)
97 // CHECK: #pragma omp target
98 // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) private(this->a) private(this->S7<S>::a)
99 // CHECK: #pragma omp target
100 // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) private(this->a)
101 // CHECK: #pragma omp target
102 // CHECK-NEXT: #pragma omp teams distribute parallel for allocate(b) default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f8) thread_limit(d) copyin(x) allocate(argv)
104 template <class T
, int N
>
106 T b
= argc
, c
, d
, e
, f
, g
;
108 // CHECK: static T a;
113 #pragma omp teams distribute parallel for
114 for (int i
=0; i
< 2; ++i
)
116 // CHECK: #pragma omp target
117 // CHECK-NEXT: #pragma omp teams distribute parallel for{{$}}
118 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
119 // CHECK-NEXT: a = 2;
122 #pragma omp teams distribute parallel for private(argc, b), firstprivate(c, d), collapse(2) order(unconstrained:concurrent)
124 #pragma omp teams distribute parallel for private(argc, b), firstprivate(c, d), collapse(2) order(concurrent)
126 for (int i
= 0; i
< 10; ++i
)
127 for (int j
= 0; j
< 10; ++j
)
129 // CHECK: #pragma omp target
130 // OMP50: #pragma omp teams distribute parallel for private(argc,b) firstprivate(c,d) collapse(2) order(concurrent)
131 // OMP51: #pragma omp teams distribute parallel for private(argc,b) firstprivate(c,d) collapse(2) order(unconstrained: concurrent)
132 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
133 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
134 // CHECK-NEXT: foo();
135 for (int i
= 0; i
< 10; ++i
)
137 // CHECK: for (int i = 0; i < 10; ++i)
138 // CHECK-NEXT: foo();
140 #pragma omp teams distribute parallel for
141 for (int i
= 0; i
< 10; ++i
)
143 // CHECK: #pragma omp target
144 // CHECK-NEXT: #pragma omp teams distribute parallel for
145 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
146 // CHECK-NEXT: foo();
148 #pragma omp teams distribute parallel for default(none), private(b) firstprivate(argc) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) copyin(x)
149 for (int k
= 0; k
< 10; ++k
)
151 // CHECK: #pragma omp target
152 // CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argc) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) copyin(x)
153 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
154 // CHECK-NEXT: e += d + argc;
156 #pragma omp teams distribute parallel for
157 for (int k
= 0; k
< 10; ++k
)
159 // CHECK: #pragma omp target
160 // CHECK-NEXT: #pragma omp teams distribute parallel for
161 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
162 // CHECK-NEXT: e += d + argc;
166 int main (int argc
, char **argv
) {
167 int b
= argc
, c
, d
, e
, f
, g
;
169 // CHECK: static int a;
174 #pragma omp teams distribute parallel for
175 for (int i
=0; i
< 2; ++i
)
177 // CHECK: #pragma omp target
178 // CHECK-NEXT: #pragma omp teams distribute parallel for
179 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
180 // CHECK-NEXT: a = 2;
182 #pragma omp teams distribute parallel for private(argc,b),firstprivate(argv, c), collapse(2)
183 for (int i
= 0; i
< 10; ++i
)
184 for (int j
= 0; j
< 10; ++j
)
186 // CHECK: #pragma omp target
187 // CHECK-NEXT: #pragma omp teams distribute parallel for private(argc,b) firstprivate(argv,c) collapse(2)
188 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
189 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
190 // CHECK-NEXT: foo();
191 for (int i
= 0; i
< 10; ++i
)
193 // CHECK: for (int i = 0; i < 10; ++i)
194 // CHECK-NEXT: foo();
196 #pragma omp teams distribute parallel for
197 for (int i
= 0; i
< 10; ++i
)foo();
198 // CHECK: #pragma omp target
199 // CHECK-NEXT: #pragma omp teams distribute parallel for
200 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
201 // CHECK-NEXT: foo();
203 #pragma omp teams distribute parallel for default(none), private(b) firstprivate(argc) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) copyin(x)
204 for (int k
= 0; k
< 10; ++k
)
206 // CHECK: #pragma omp target
207 // CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argc) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) copyin(x)
208 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
209 // CHECK-NEXT: e += d + argc;
211 #pragma omp teams distribute parallel for reduction(task,&&:argc)
212 for (int k
= 0; k
< 10; ++k
)
214 // CHECK: #pragma omp target
215 // CHECK-NEXT: #pragma omp teams distribute parallel for reduction(task, &&: argc)
216 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
217 // CHECK-NEXT: e += d + argc;