1 // RUN: %clang_cc1 -verify -std=c++11 -fopenmp -fopenmp-version=45 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
4 // RUN: %clang_cc1 -verify -std=c++11 -fopenmp -ast-print %s -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
5 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5
6 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
7 // RUN: %clang_cc1 -verify -std=c++11 -fopenmp -fopenmp-version=51 -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
8 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51
9 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
11 // RUN: %clang_cc1 -verify -std=c++11 -fopenmp-simd -fopenmp-version=45 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
12 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s
13 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
14 // RUN: %clang_cc1 -verify -std=c++11 -fopenmp-simd -ast-print %s -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
15 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5
16 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
17 // RUN: %clang_cc1 -verify -std=c++11 -fopenmp-simd -fopenmp-version=51 -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
18 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51
19 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
20 // expected-no-diagnostics
39 S7(typename
T::type v
) : a(v
) {
42 #pragma omp distribute parallel for private(a) private(this->a) private(T::a)
43 for (int k
= 0; k
< a
.a
; ++k
)
46 S7
&operator=(S7
&s
) {
49 #pragma omp distribute parallel for private(a) private(this->a)
50 for (int k
= 0; k
< s
.a
.a
; ++k
)
56 // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(T::a){{$}}
57 // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a)
58 // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(this->S::a)
60 class S8
: public S7
<S
> {
67 #pragma omp distribute parallel for private(a) private(this->a) private(S7<S>::a)
68 for (int k
= 0; k
< a
.a
; ++k
)
71 S8
&operator=(S8
&s
) {
74 #pragma omp distribute parallel for private(a) private(this->a)
75 for (int k
= 0; k
< s
.a
.a
; ++k
)
81 // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(this->S7<S>::a)
82 // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a)
84 template <class T
, int N
>
86 T b
= argc
, c
, d
, e
, f
, h
;
90 #pragma omp threadprivate(g)
93 #pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a)
94 // CHECK: #pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a)
95 for (int i
= 0; i
< 2; ++i
)
97 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
101 #pragma omp distribute parallel for allocate(argc) private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N)
102 for (int i
= 0; i
< 2; ++i
)
103 for (int j
= 0; j
< 2; ++j
)
104 for (int j
= 0; j
< 2; ++j
)
105 for (int j
= 0; j
< 2; ++j
)
106 for (int j
= 0; j
< 2; ++j
)
107 for (int i
= 0; i
< 2; ++i
)
108 for (int j
= 0; j
< 2; ++j
)
109 for (int j
= 0; j
< 2; ++j
)
110 for (int j
= 0; j
< 2; ++j
)
111 for (int j
= 0; j
< 2; ++j
)
113 // CHECK: #pragma omp distribute parallel for allocate(argc) private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N)
114 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
115 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
116 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
117 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
118 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
119 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
120 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
121 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
122 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
123 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
128 void foo(int argc
, char **argv
) {
129 int b
, c
, d
, e
, f
, h
;
131 // CHECK: static int a;
133 #pragma omp threadprivate(g)
137 #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc)
138 // CHECK: #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc)
139 for (int i
= 0; i
< 2; ++i
)
140 // CHECK: for (int i = 0; i < 2; ++i)
150 #pragma omp distribute parallel for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) schedule(auto) if (argc) num_threads(a) default(shared) shared(e) reduction(+ : h) dist_schedule(static, b)
151 for (int i
= 0; i
< 10; ++i
)
152 for (int j
= 0; j
< 10; ++j
)
156 // CHECK: #pragma omp distribute parallel for private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) schedule(auto) if(argc) num_threads(a) default(shared) shared(e) reduction(+: h) dist_schedule(static, b)
157 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
158 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
163 int main(int argc
, char **argv
) {
164 int b
= argc
, c
, d
, e
, f
, h
;
166 // CHECK: static int a;
168 #pragma omp threadprivate(g)
172 #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc) order(reproducible:concurrent) reduction(task,+:c)
174 #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc) order(concurrent) reduction(task,+:c)
176 #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc)
178 // OMP51: #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc) order(reproducible: concurrent) reduction(task, +: c)
179 // OMP50: #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc) order(concurrent) reduction(task, +: c)
180 // OMP45: #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc)
181 for (int i
= 0; i
< 2; ++i
)
183 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
184 // CHECK-NEXT: a = 2;
187 #pragma omp distribute parallel for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) schedule(auto) if (argc) num_threads(a) default(shared) shared(e) reduction(+ : h) dist_schedule(static, b)
188 for (int i
= 0; i
< 10; ++i
)
189 for (int j
= 0; j
< 10; ++j
)
191 // CHECK: #pragma omp distribute parallel for private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) schedule(auto) if(argc) num_threads(a) default(shared) shared(e) reduction(+: h) dist_schedule(static, b)
192 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
193 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
195 return (tmain
<int, 5>(argc
) + tmain
<char, 1>(argv
[0][0]));