[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / schedule_codegen.cpp
blob513f10c4b47a4e6e9df6feee8fb3ecb582c185d5
1 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm -fexceptions -fcxx-exceptions -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -emit-llvm -fexceptions -fcxx-exceptions -o - %s | FileCheck --check-prefix SIMD-ONLY0 %s
4 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
6 int main() {
7 // CHECK: @__kmpc_for_static_init
8 // CHECK-NOT: !llvm.access.group
9 // CHECK: @__kmpc_for_static_fini
10 #pragma omp for
11 for(int i = 0; i < 10; ++i);
12 // CHECK: @__kmpc_for_static_init
13 // CHECK: !llvm.access.group
14 // CHECK: @__kmpc_for_static_fini
15 #pragma omp for simd
16 for(int i = 0; i < 10; ++i);
17 // CHECK: @__kmpc_for_static_init
18 // CHECK-NOT: !llvm.access.group
19 // CHECK: @__kmpc_for_static_fini
20 #pragma omp for schedule(static)
21 for(int i = 0; i < 10; ++i);
22 // CHECK: @__kmpc_for_static_init
23 // CHECK: !llvm.access.group
24 // CHECK: @__kmpc_for_static_fini
25 #pragma omp for simd schedule(static)
26 for(int i = 0; i < 10; ++i);
27 // CHECK: @__kmpc_for_static_init
28 // CHECK-NOT: !llvm.access.group
29 // CHECK: @__kmpc_for_static_fini
30 #pragma omp for schedule(static, 2)
31 for(int i = 0; i < 10; ++i);
32 // CHECK: @__kmpc_for_static_init
33 // CHECK: !llvm.access.group
34 // CHECK: @__kmpc_for_static_fini
35 #pragma omp for simd schedule(static, 2)
36 for(int i = 0; i < 10; ++i);
37 // CHECK: @__kmpc_dispatch_init
38 // CHECK: !llvm.access.group
39 #pragma omp for schedule(auto)
40 for(int i = 0; i < 10; ++i);
41 // CHECK: @__kmpc_dispatch_init
42 // CHECK: !llvm.access.group
43 #pragma omp for simd schedule(auto)
44 for(int i = 0; i < 10; ++i);
45 // CHECK: @__kmpc_dispatch_init
46 // CHECK: !llvm.access.group
47 #pragma omp for schedule(runtime)
48 for(int i = 0; i < 10; ++i);
49 // CHECK: @__kmpc_dispatch_init
50 // CHECK: !llvm.access.group
51 #pragma omp for simd schedule(runtime)
52 for(int i = 0; i < 10; ++i);
53 // CHECK: @__kmpc_dispatch_init
54 // CHECK: !llvm.access.group
55 #pragma omp for schedule(guided)
56 for(int i = 0; i < 10; ++i);
57 // CHECK: @__kmpc_dispatch_init
58 // CHECK: !llvm.access.group
59 #pragma omp for simd schedule(guided)
60 for(int i = 0; i < 10; ++i);
61 // CHECK: @__kmpc_dispatch_init
62 // CHECK: !llvm.access.group
63 #pragma omp for schedule(dynamic)
64 for(int i = 0; i < 10; ++i);
65 // CHECK: @__kmpc_dispatch_init
66 // CHECK: !llvm.access.group
67 #pragma omp for simd schedule(dynamic)
68 for(int i = 0; i < 10; ++i);
69 // CHECK: @__kmpc_for_static_init
70 // CHECK-NOT: !llvm.access.group
71 // CHECK: @__kmpc_for_static_fini
72 #pragma omp for schedule(monotonic: static)
73 for(int i = 0; i < 10; ++i);
74 // CHECK: @__kmpc_for_static_init
75 // CHECK: !llvm.access.group
76 // CHECK: @__kmpc_for_static_fini
77 #pragma omp for simd schedule(monotonic: static)
78 for(int i = 0; i < 10; ++i);
79 // CHECK: @__kmpc_for_static_init
80 // CHECK-NOT: !llvm.access.group
81 // CHECK: @__kmpc_for_static_fini
82 #pragma omp for schedule(monotonic: static, 2)
83 for(int i = 0; i < 10; ++i);
84 // CHECK: @__kmpc_for_static_init
85 // CHECK: !llvm.access.group
86 // CHECK: @__kmpc_for_static_fini
87 #pragma omp for simd schedule(monotonic: static, 2)
88 for(int i = 0; i < 10; ++i);
89 // CHECK: @__kmpc_dispatch_init
90 // CHECK-NOT: !llvm.access.group
91 #pragma omp for schedule(monotonic: auto)
92 for(int i = 0; i < 10; ++i);
93 // CHECK: @__kmpc_dispatch_init
94 // CHECK: !llvm.access.group
95 #pragma omp for simd schedule(monotonic: auto)
96 for(int i = 0; i < 10; ++i);
97 // CHECK: @__kmpc_dispatch_init
98 // CHECK-NOT: !llvm.access.group
99 #pragma omp for schedule(monotonic: runtime)
100 for(int i = 0; i < 10; ++i);
101 // CHECK: @__kmpc_dispatch_init
102 // CHECK: !llvm.access.group
103 #pragma omp for simd schedule(monotonic: runtime)
104 for(int i = 0; i < 10; ++i);
105 // CHECK: @__kmpc_dispatch_init
106 // CHECK-NOT: !llvm.access.group
107 #pragma omp for schedule(monotonic: guided)
108 for(int i = 0; i < 10; ++i);
109 // CHECK: @__kmpc_dispatch_init
110 // CHECK: !llvm.access.group
111 #pragma omp for simd schedule(monotonic: guided)
112 for(int i = 0; i < 10; ++i);
113 // CHECK: @__kmpc_dispatch_init
114 // CHECK-NOT: !llvm.access.group
115 #pragma omp for schedule(monotonic: dynamic)
116 for(int i = 0; i < 10; ++i);
117 // CHECK: @__kmpc_dispatch_init
118 // CHECK: !llvm.access.group
119 #pragma omp for simd schedule(monotonic: dynamic)
120 for(int i = 0; i < 10; ++i);
121 // CHECK: @__kmpc_dispatch_init
122 // CHECK: !llvm.access.group
123 #pragma omp for schedule(nonmonotonic: guided)
124 for(int i = 0; i < 10; ++i);
125 // CHECK: @__kmpc_dispatch_init
126 // CHECK: !llvm.access.group
127 #pragma omp for simd schedule(nonmonotonic: guided)
128 for(int i = 0; i < 10; ++i);
129 // CHECK: @__kmpc_dispatch_init
130 // CHECK: !llvm.access.group
131 #pragma omp for schedule(nonmonotonic: dynamic)
132 for(int i = 0; i < 10; ++i);
133 // CHECK: @__kmpc_dispatch_init
134 // CHECK: !llvm.access.group
135 #pragma omp for simd schedule(nonmonotonic: dynamic)
136 for(int i = 0; i < 10; ++i);
137 // CHECK: call void @__kmpc_for_static_init_4(ptr {{.+}}, i32 %{{.+}}, i32 1073741858,
138 // CHECK: !llvm.access.group
139 #pragma omp for simd schedule(nonmonotonic: static)
140 for(int i = 0; i < 10; ++i);
141 // CHECK: call void @__kmpc_dispatch_init_4(ptr {{.+}}, i32 %{{.+}}, i32 1073741862,
142 // CHECK: !llvm.access.group
143 #pragma omp for schedule(nonmonotonic: auto)
144 for(int i = 0; i < 10; ++i);
145 // CHECK: call void @__kmpc_dispatch_init_4(ptr {{.+}}, i32 %{{.+}}, i32 1073741861,
146 // CHECK: !llvm.access.group
147 #pragma omp for simd schedule(nonmonotonic: runtime)
148 for(int i = 0; i < 10; ++i);
149 // CHECK: @__kmpc_dispatch_init
150 // CHECK-NOT: !llvm.access.group
151 // CHECK: @__kmpc_dispatch_next
152 #pragma omp for schedule(static) ordered
153 for(int i = 0; i < 10; ++i);
154 // CHECK: @__kmpc_dispatch_init
155 // CHECK-NOT: !llvm.access.group
156 // CHECK: @__kmpc_dispatch_next
157 #pragma omp for simd schedule(static) ordered
158 for(int i = 0; i < 10; ++i);
159 // CHECK: @__kmpc_dispatch_init
160 // CHECK-NOT: !llvm.access.group
161 // CHECK: @__kmpc_dispatch_next
162 #pragma omp for schedule(static, 2) ordered(1)
163 for(int i = 0; i < 10; ++i);
164 // CHECK: @__kmpc_dispatch_init
165 // CHECK-NOT: !llvm.access.group
166 // CHECK: @__kmpc_dispatch_next
167 #pragma omp for simd schedule(static, 2) ordered
168 for(int i = 0; i < 10; ++i);
169 // CHECK: @__kmpc_dispatch_init
170 // CHECK-NOT: !llvm.access.group
171 // CHECK: @__kmpc_dispatch_next
172 #pragma omp for schedule(auto) ordered(1)
173 for(int i = 0; i < 10; ++i);
174 // CHECK: @__kmpc_dispatch_init
175 // CHECK-NOT: !llvm.access.group
176 #pragma omp for simd schedule(auto) ordered
177 for(int i = 0; i < 10; ++i);
178 // CHECK: @__kmpc_dispatch_init
179 // CHECK-NOT: !llvm.access.group
180 // CHECK: @__kmpc_dispatch_next
181 #pragma omp for schedule(runtime) ordered
182 for(int i = 0; i < 10; ++i);
183 // CHECK: @__kmpc_dispatch_init
184 // CHECK-NOT: !llvm.access.group
185 // CHECK: @__kmpc_dispatch_next
186 #pragma omp for simd schedule(runtime) ordered
187 for(int i = 0; i < 10; ++i);
188 // CHECK: @__kmpc_dispatch_init
189 // CHECK-NOT: !llvm.access.group
190 // CHECK: @__kmpc_dispatch_next
191 #pragma omp for schedule(guided) ordered(1)
192 for(int i = 0; i < 10; ++i);
193 // CHECK: @__kmpc_dispatch_init
194 // CHECK-NOT: !llvm.access.group
195 // CHECK: @__kmpc_dispatch_next
196 #pragma omp for simd schedule(guided) ordered
197 for(int i = 0; i < 10; ++i);
198 // CHECK: @__kmpc_dispatch_init
199 // CHECK-NOT: !llvm.access.group
200 // CHECK: @__kmpc_dispatch_next
201 #pragma omp for schedule(dynamic) ordered(1)
202 for(int i = 0; i < 10; ++i);
203 // CHECK: @__kmpc_dispatch_init
204 // CHECK-NOT: !llvm.access.group
205 // CHECK: @__kmpc_dispatch_next
206 #pragma omp for simd schedule(dynamic)
207 for(int i = 0; i < 10; ++i);
208 return 0;