1 // RUN: %clang_cc1 -verify -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 -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix CHECK --check-prefix OMP45
4 // RUN: %clang_cc1 -verify -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 -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix CHECK --check-prefix OMP50
7 // RUN: %clang_cc1 -verify -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 -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix CHECK --check-prefix OMP51
11 // RUN: %clang_cc1 -verify -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 -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix CHECK --check-prefix OMP45
14 // RUN: %clang_cc1 -verify -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 -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix CHECK --check-prefix OMP50
17 // RUN: %clang_cc1 -verify -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 -fsyntax-only -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 simd private(a) private(this->a) private(T::a)
43 for (int k
= 0; k
< a
.a
; ++k
)
46 S7
&operator=(S7
&s
) {
50 #pragma omp distribute parallel for simd private(a) private(this->a) linear(k)
51 for (k
= 0; k
< s
.a
.a
; ++k
)
57 // CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) private(T::a){{$}}
58 // CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) linear(k)
59 // CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) private(this->S::a)
61 class S8
: public S7
<S
> {
68 #pragma omp distribute parallel for simd private(a) private(this->a) private(S7<S>::a)
69 for (int k
= 0; k
< a
.a
; ++k
)
72 S8
&operator=(S8
&s
) {
75 #pragma omp distribute parallel for simd private(a) private(this->a)
76 for (int k
= 0; k
< s
.a
.a
; ++k
)
82 // CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) private(this->S7<S>::a)
83 // CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a)
85 template <class T
, int N
>
87 T b
= argc
, c
, d
, e
, f
, h
;
91 #pragma omp threadprivate(g)
94 #pragma omp distribute parallel for simd dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a)
95 // CHECK: #pragma omp distribute parallel for simd dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a)
96 for (int i
= 0; i
< 2; ++i
)
98 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
102 #pragma omp distribute parallel for simd 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)
103 for (int i
= 0; i
< 2; ++i
)
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 j
= 0; j
< 2; ++j
)
108 for (int i
= 0; i
< 2; ++i
)
109 for (int j
= 0; j
< 2; ++j
)
110 for (int j
= 0; j
< 2; ++j
)
111 for (int j
= 0; j
< 2; ++j
)
112 for (int j
= 0; j
< 2; ++j
)
114 // CHECK: #pragma omp distribute parallel for simd 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)
115 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
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 j = 0; j < 2; ++j)
120 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
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)
124 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
129 int main(int argc
, char **argv
) {
130 int b
= argc
, c
, d
, e
, f
, h
;
133 // CHECK: static int a;
135 #pragma omp threadprivate(g)
138 #pragma omp distribute parallel for simd schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc)
139 // CHECK: #pragma omp distribute parallel for simd schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc)
140 for (int i
= 0; i
< 2; ++i
)
142 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
143 // CHECK-NEXT: a = 2;
146 #pragma omp distribute parallel for simd 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)
147 for (int i
= 0; i
< 10; ++i
)
148 for (int j
= 0; j
< 10; ++j
)
150 // CHECK: #pragma omp distribute parallel for simd 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 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
152 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
159 #pragma omp distribute parallel for simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(simd: argc) nontemporal(argc, c, d) order(unconstrained:concurrent)
161 #pragma omp distribute parallel for simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(simd: argc) nontemporal(argc, c, d) order(concurrent)
163 #pragma omp distribute parallel for simd aligned(x:8) linear(i:2) safelen(8) simdlen(8)
165 for (i
= 0; i
< 100; i
++)
166 for (int j
= 0; j
< 200; j
++)
168 // OMP45: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8)
169 // OMP50: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) if(simd: argc) nontemporal(argc,c,d) order(concurrent)
170 // OMP51: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) if(simd: argc) nontemporal(argc,c,d) order(unconstrained: concurrent)
171 // CHECK-NEXT: for (i = 0; i < 100; i++)
172 // CHECK-NEXT: for (int j = 0; j < 200; j++)
173 // CHECK-NEXT: a += h + x[j];
175 return (tmain
<int, 5>(argc
) + tmain
<char, 1>(argv
[0][0]));