[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / distribute_dist_schedule_ast_print.cpp
blob16fda05b9112b58cc8e7e86fa2ff904c6f9d2c5d
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 distribute dist_schedule(static,10)
21 // CHECK-NEXT: #pragma omp distribute dist_schedule(static, 10){{$}}
22 for (int i=0; i < 2; ++i)a=2;
23 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
24 // CHECK-NEXT: a = 2;
25 #pragma omp distribute dist_schedule(static,a)
26 // CHECK-NEXT: #pragma omp distribute dist_schedule(static, a)
27 for (int i=0; i < 2; ++i)a=2;
28 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
29 // CHECK-NEXT: a = 2;
30 #pragma omp target
31 #pragma omp teams
32 #pragma omp distribute dist_schedule(static,2)
33 for (int i = 0; i < 10; ++i)
34 for (int j = 0; j < 10; ++j)foo();
35 // CHECK-NEXT: #pragma omp target
36 // CHECK-NEXT: #pragma omp teams
37 // CHECK-NEXT: #pragma omp distribute dist_schedule(static, 2)
38 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
39 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
40 // CHECK-NEXT: foo();
41 #pragma omp target
42 #pragma omp teams
43 #pragma omp distribute dist_schedule(static,a)
44 for (int i = 0; i < 10; ++i)
45 for (int j = 0; j < 10; ++j)foo();
46 // CHECK-NEXT: #pragma omp target
47 // CHECK-NEXT: #pragma omp teams
48 // CHECK-NEXT: #pragma omp distribute dist_schedule(static, a)
49 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
50 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
51 // CHECK-NEXT: foo();
52 for (int i = 0; i < 10; ++i)foo();
53 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
54 // CHECK-NEXT: foo();
55 #pragma omp distribute
56 // CHECK: #pragma omp distribute
57 for (int i = 0; i < 10; ++i)foo();
58 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
59 // CHECK-NEXT: foo();
60 return T();
63 int main (int argc, char **argv) {
64 // CHECK: int main(int argc, char **argv) {
65 int b = argc, c, d, e, f, g;
66 static int a;
67 // CHECK: static int a;
68 #pragma omp distribute dist_schedule(static,10)
69 // CHECK-NEXT: #pragma omp distribute dist_schedule(static, 10)
70 for (int i=0; i < 2; ++i)a=2;
71 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
72 // CHECK-NEXT: a = 2;
73 #pragma omp distribute dist_schedule(static,b)
74 // CHECK-NEXT: #pragma omp distribute dist_schedule(static, b)
75 for (int i=0; i < 2; ++i)a=2;
76 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
77 // CHECK-NEXT: a = 2;
78 #pragma omp target
79 #pragma omp teams
80 #pragma omp distribute dist_schedule(static,2)
81 for (int i = 0; i < 10; ++i)
82 for (int j = 0; j < 10; ++j)foo();
83 // CHECK-NEXT: #pragma omp target
84 // CHECK-NEXT: #pragma omp teams
85 // CHECK-NEXT: #pragma omp distribute dist_schedule(static, 2)
86 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
87 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
88 // CHECK-NEXT: foo();
89 #pragma omp target
90 #pragma omp teams
91 #pragma omp distribute dist_schedule(static,a)
92 for (int i = 0; i < 10; ++i)
93 for (int j = 0; j < 10; ++j)foo();
94 // CHECK-NEXT: #pragma omp target
95 // CHECK-NEXT: #pragma omp teams
96 // CHECK-NEXT: #pragma omp distribute dist_schedule(static, a)
97 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
98 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
99 // CHECK-NEXT: foo();
100 for (int i = 0; i < 10; ++i)foo();
101 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
102 // CHECK-NEXT: foo();
103 #pragma omp distribute
104 // CHECK: #pragma omp distribute
105 for (int i = 0; i < 10; ++i)foo();
106 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
107 // CHECK-NEXT: foo();
108 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
111 #endif