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 -fopenmp-version=50 -DOMP5 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix CHECK --check-prefix OMP50
5 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -DOMP5 -x c++ -std=c++11 -emit-pch -o %t %s
6 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -DOMP5 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix CHECK --check-prefix OMP50
7 // RUN: %clang_cc1 -verify -fopenmp -DOMP51 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix CHECK --check-prefix OMP51
8 // RUN: %clang_cc1 -fopenmp -DOMP51 -x c++ -std=c++11 -emit-pch -o %t %s
9 // RUN: %clang_cc1 -fopenmp -DOMP51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | 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 -fopenmp-version=50 -DOMP5 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix CHECK --check-prefix OMP50
15 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -DOMP5 -x c++ -std=c++11 -emit-pch -o %t %s
16 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -DOMP5 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix CHECK --check-prefix OMP50
17 // RUN: %clang_cc1 -verify -fopenmp-simd -DOMP51 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix CHECK --check-prefix OMP51
18 // RUN: %clang_cc1 -fopenmp-simd -DOMP51 -x c++ -std=c++11 -emit-pch -o %t %s
19 // RUN: %clang_cc1 -fopenmp-simd -DOMP51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix CHECK --check-prefix OMP51
20 // expected-no-diagnostics
41 S7(typename
T::type v
) : a(v
) {
43 #pragma omp teams distribute parallel for simd private(a) private(this->a) private(T::a)
44 for (int k
= 0; k
< a
.a
; ++k
)
47 S7
&operator=(S7
&s
) {
50 #pragma omp teams distribute parallel for simd private(a) private(this->a) linear(k)
51 for (k
= 0; k
< s
.a
.a
; ++k
)
59 int b
, argv
, d
, c
, e
, f
;
61 #pragma omp teams distribute parallel for simd default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d)
62 for (int k
= 0; k
< a
.a
; ++k
)
71 #pragma omp teams distribute parallel for simd simdlen(slen1) safelen(slen2) aligned(arr:alen)
72 for (int k
= 0; k
< a
.a
; ++k
)
76 // CHECK: #pragma omp target
77 // CHECK-NEXT: #pragma omp teams distribute parallel for simd private(this->a) private(this->a) private(T::a)
78 // CHECK: #pragma omp target
79 // CHECK-NEXT: #pragma omp teams distribute parallel for simd private(this->a) private(this->a) linear(k)
80 // CHECK: #pragma omp target
81 // CHECK-NEXT: #pragma omp teams distribute parallel for simd default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d)
82 // CHECK: #pragma omp target
83 // CHECK-NEXT: #pragma omp teams distribute parallel for simd simdlen(slen1) safelen(slen2) aligned(arr: alen)
85 class S8
: public S7
<S
> {
91 #pragma omp teams distribute parallel for simd private(a) private(this->a) private(S7<S>::a)
92 for (int k
= 0; k
< a
.a
; ++k
)
95 S8
&operator=(S8
&s
) {
97 #pragma omp teams distribute parallel for simd private(a) private(this->a)
98 for (int k
= 0; k
< s
.a
.a
; ++k
)
106 int b
, argv
, d
, c
, e
, f8
;
108 #pragma omp teams distribute parallel for simd default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f8) thread_limit(d)
109 for (int k
= 0; k
< a
.a
; ++k
)
118 #pragma omp teams distribute parallel for simd simdlen(slen1) safelen(slen2) aligned(arr:alen)
119 for (int k
= 0; k
< a
.a
; ++k
)
123 // CHECK: #pragma omp target
124 // CHECK-NEXT: #pragma omp teams distribute parallel for simd private(this->a) private(this->a) private(this->S::a)
125 // CHECK: #pragma omp target
126 // CHECK-NEXT: #pragma omp teams distribute parallel for simd private(this->a) private(this->a) private(this->S7<S>::a)
127 // CHECK: #pragma omp target
128 // CHECK-NEXT: #pragma omp teams distribute parallel for simd private(this->a) private(this->a)
129 // CHECK: #pragma omp target
130 // CHECK-NEXT: #pragma omp teams distribute parallel for simd default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f8) thread_limit(d)
131 // CHECK: #pragma omp target
132 // CHECK-NEXT: #pragma omp teams distribute parallel for simd simdlen(slen1) safelen(slen2) aligned(arr: alen)
134 template <class T
, int N
>
136 T b
= argc
, c
, d
, e
, f
, g
;
138 // CHECK: static T a;
143 #pragma omp teams distribute parallel for simd
144 for (int i
=0; i
< 2; ++i
)
146 // CHECK: #pragma omp target
147 // CHECK-NEXT: #pragma omp teams distribute parallel for simd{{$}}
148 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
149 // CHECK-NEXT: a = 2;
151 #pragma omp teams distribute parallel for simd allocate(b) private(argc, b), firstprivate(c, d), collapse(2) allocate(d)
152 for (int i
= 0; i
< 10; ++i
)
153 for (int j
= 0; j
< 10; ++j
)
155 // CHECK: #pragma omp target
156 // CHECK-NEXT: #pragma omp teams distribute parallel for simd allocate(b) private(argc,b) firstprivate(c,d) collapse(2) allocate(d)
157 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
158 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
159 // CHECK-NEXT: foo();
160 for (int i
= 0; i
< 10; ++i
)
162 // CHECK: for (int i = 0; i < 10; ++i)
163 // CHECK-NEXT: foo();
166 #pragma omp teams distribute parallel for simd if(simd:argc) nontemporal(argc, c, d) order(reproducible:concurrent)
168 #pragma omp teams distribute parallel for simd if(simd:argc) nontemporal(argc, c, d) order(concurrent)
170 #pragma omp teams distribute parallel for simd
172 for (int i
= 0; i
< 10; ++i
)
174 // CHECK: #pragma omp target
175 // OMP45-NEXT: #pragma omp teams distribute parallel for simd
176 // OMP50-NEXT: #pragma omp teams distribute parallel for simd if(simd: argc) nontemporal(argc,c,d) order(concurrent)
177 // OMP51-NEXT: #pragma omp teams distribute parallel for simd if(simd: argc) nontemporal(argc,c,d) order(reproducible: concurrent)
178 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
179 // CHECK-NEXT: foo();
181 #pragma omp teams distribute parallel for simd default(none), private(b) firstprivate(argc) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d)
182 for (int k
= 0; k
< 10; ++k
)
184 // CHECK: #pragma omp target
185 // CHECK-NEXT: #pragma omp teams distribute parallel for simd default(none) private(b) firstprivate(argc) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d)
186 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
187 // CHECK-NEXT: e += d + argc;
189 #pragma omp teams distribute parallel for simd simdlen(clen-1)
190 for (int k
= 0; k
< 10; ++k
)
192 // CHECK: #pragma omp target
193 // CHECK-NEXT: #pragma omp teams distribute parallel for simd simdlen(clen - 1)
194 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
195 // CHECK-NEXT: e += d + argc;
197 #pragma omp teams distribute parallel for simd safelen(clen-1) aligned(arr:alen)
198 for (int k
= 0; k
< 10; ++k
)
199 e
+= d
+ argc
+ arr
[k
];
200 // CHECK: #pragma omp target
201 // CHECK-NEXT: #pragma omp teams distribute parallel for simd safelen(clen - 1) aligned(arr: alen)
202 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
203 // CHECK-NEXT: e += d + argc + arr[k];
207 int main (int argc
, char **argv
) {
208 int b
= argc
, c
, d
, e
, f
, g
;
210 // CHECK: static int a;
215 #pragma omp teams distribute parallel for simd
216 for (int i
=0; i
< 2; ++i
)
218 // CHECK: #pragma omp target
219 // CHECK-NEXT: #pragma omp teams distribute parallel for simd
220 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
221 // CHECK-NEXT: a = 2;
223 #pragma omp teams distribute parallel for simd private(argc,b),firstprivate(argv, c), collapse(2)
224 for (int i
= 0; i
< 10; ++i
)
225 for (int j
= 0; j
< 10; ++j
)
227 // CHECK: #pragma omp target
228 // CHECK-NEXT: #pragma omp teams distribute parallel for simd private(argc,b) firstprivate(argv,c) collapse(2)
229 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
230 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
231 // CHECK-NEXT: foo();
232 for (int i
= 0; i
< 10; ++i
)
234 // CHECK: for (int i = 0; i < 10; ++i)
235 // CHECK-NEXT: foo();
237 #pragma omp teams distribute parallel for simd
238 for (int i
= 0; i
< 10; ++i
)foo();
239 // CHECK: #pragma omp target
240 // CHECK-NEXT: #pragma omp teams distribute parallel for simd
241 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
242 // CHECK-NEXT: foo();
244 #pragma omp teams distribute parallel for simd default(none), private(b) firstprivate(argc) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d)
245 for (int k
= 0; k
< 10; ++k
)
247 // CHECK: #pragma omp target
248 // CHECK-NEXT: #pragma omp teams distribute parallel for simd default(none) private(b) firstprivate(argc) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d)
249 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
250 // CHECK-NEXT: e += d + argc;
252 #pragma omp teams distribute parallel for simd simdlen(clen-1)
253 for (int k
= 0; k
< 10; ++k
)
255 // CHECK: #pragma omp target
256 // CHECK-NEXT: #pragma omp teams distribute parallel for simd simdlen(clen - 1)
257 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
258 // CHECK-NEXT: e += d + argc;
260 #pragma omp teams distribute parallel for simd safelen(clen-1) aligned(arr:N+6)
261 for (int k
= 0; k
< 10; ++k
)
262 e
+= d
+ argc
+ arr
[k
];
263 // CHECK: #pragma omp target
264 // CHECK-NEXT: #pragma omp teams distribute parallel for simd safelen(clen - 1) aligned(arr: N + 6)
265 // CHECK-NEXT: for (int k = 0; k < 10; ++k)
266 // CHECK-NEXT: e += d + argc + arr[k];