[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / parallel_masked_taskloop_simd_ast_print.cpp
blob3b4d71289d5b3c805378b6163b9f802610f5e32c
1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s
8 // expected-no-diagnostics
10 #ifndef HEADER
11 #define HEADER
13 void foo() {}
15 template <class T, int N>
16 T tmain(T argc) {
17 T b = argc, c, d, e, f, g;
18 static T a;
19 // CHECK: static T a;
20 #pragma omp taskgroup allocate(d) task_reduction(+: d)
21 #pragma omp parallel masked taskloop simd if(taskloop: argc > N) default(shared) untied priority(N) grainsize(N) reduction(+:g) allocate(g) simdlen(8)
22 // CHECK-NEXT: #pragma omp taskgroup allocate(d) task_reduction(+: d)
23 // CHECK-NEXT: #pragma omp parallel masked taskloop simd if(taskloop: argc > N) default(shared) untied priority(N) grainsize(N) reduction(+: g) allocate(g) simdlen(8){{$}}
24 for (int i = 0; i < 2; ++i)
25 a = 2;
26 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
27 // CHECK-NEXT: a = 2;
28 #pragma omp parallel
29 #pragma omp parallel masked taskloop simd private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) shared(g) if (c) final(d) mergeable priority(f) nogroup num_tasks(N) safelen(8)
30 for (int i = 0; i < 2; ++i)
31 for (int j = 0; j < 2; ++j)
32 for (int j = 0; j < 2; ++j)
33 for (int j = 0; j < 2; ++j)
34 for (int j = 0; j < 2; ++j)
35 for (int i = 0; i < 2; ++i)
36 for (int j = 0; j < 2; ++j)
37 for (int j = 0; j < 2; ++j)
38 for (int j = 0; j < 2; ++j)
39 for (int j = 0; j < 2; ++j)
40 foo();
41 // CHECK-NEXT: #pragma omp parallel
42 // CHECK-NEXT: #pragma omp parallel masked taskloop simd private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) shared(g) if(c) final(d) mergeable priority(f) nogroup num_tasks(N) safelen(8)
43 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
44 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
45 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
46 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
47 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
48 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
49 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
50 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
51 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
52 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
53 // CHECK-NEXT: foo();
54 return T();
57 // CHECK-LABEL: int main(int argc, char **argv) {
58 int main(int argc, char **argv) {
59 int b = argc, c, d, e, f, g, h, tid = 0;
60 static int a;
61 // CHECK: static int a;
62 #pragma omp taskgroup task_reduction(+: d)
63 #pragma omp parallel masked taskloop simd if(parallel: a) default(none) shared(a, b, argc) final(b) priority(5) num_tasks(argc) reduction(*: g) aligned(argv: 8) linear(c:b) filter(tid)
64 // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d)
65 // CHECK-NEXT: #pragma omp parallel masked taskloop simd if(parallel: a) default(none) shared(a,b,argc) final(b) priority(5) num_tasks(argc) reduction(*: g) aligned(argv: 8) linear(c: step(b)) filter(tid)
66 for (int i = 0; i < 2; ++i)
67 a = 2;
68 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
69 // CHECK-NEXT: a = 2;
70 #pragma omp parallel
71 #pragma omp parallel masked taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(simd:argc) mergeable priority(argc) grainsize(argc) reduction(max: a, e) nontemporal(argc, c, d) order(concurrent)
72 for (int i = 0; i < 10; ++i)
73 for (int j = 0; j < 10; ++j)
74 foo();
75 // CHECK-NEXT: #pragma omp parallel
76 // CHECK-NEXT: #pragma omp parallel masked taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) grainsize(argc) reduction(max: a,e) nontemporal(argc,c,d) order(concurrent)
77 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
78 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
79 // CHECK-NEXT: foo();
80 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
83 #endif