[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / target_teams_distribute_simd_depend_codegen.cpp
blobf3dfd1f10316fd9f5d0a478e0aff9a9b0cb02f97
1 // Test host codegen.
2 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64 --check-prefix OMP50 --check-prefix OMP50-64
3 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp -fopenmp-version=45 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64 --check-prefix OMP45
4 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
5 // RUN: %clang_cc1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64 --check-prefix OMP50 --check-prefix OMP50-64
6 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32 --check-prefix OMP50 --check-prefix OMP50-32
7 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
8 // RUN: %clang_cc1 -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32 --check-prefix OMP50 --check-prefix OMP50-32
11 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
12 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64 --check-prefix OMP45
13 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp -fopenmp-version=45 -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32 --check-prefix OMP45
14 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
15 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32 --check-prefix OMP45
18 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
19 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
20 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
21 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
22 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
23 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
24 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
26 // Test target codegen - host bc file has to be created first.
27 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm-bc %s -o %t-ppc-host.bc
28 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix TCHECK --check-prefix TCHECK-64
29 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o %t %s
30 // RUN: %clang_cc1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix TCHECK --check-prefix TCHECK-64
31 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm-bc %s -o %t-x86-host.bc
32 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix TCHECK --check-prefix TCHECK-32
33 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -o %t %s
34 // RUN: %clang_cc1 -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix TCHECK --check-prefix TCHECK-32
36 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm-bc %s -o %t-ppc-host.bc
37 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck --check-prefix SIMD-ONLY1 %s
38 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o %t %s
39 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY1 %s
40 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm-bc %s -o %t-x86-host.bc
41 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck --check-prefix SIMD-ONLY1 %s
42 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -o %t %s
43 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY1 %s
44 // SIMD-ONLY1-NOT: {{__kmpc|__tgt}}
46 // expected-no-diagnostics
47 #ifndef HEADER
48 #define HEADER
50 // CHECK-DAG: [[TT:%.+]] = type { i64, i8 }
51 // CHECK-DAG: [[ENTTY:%.+]] = type { ptr, ptr, i[[SZ:32|64]], i32, i32 }
53 // TCHECK: [[ENTTY:%.+]] = type { ptr, ptr, i{{32|64}}, i32, i32 }
55 // OMP45-DAG: [[SIZET:@.+]] = private unnamed_addr constant [2 x i64] [i64 0, i64 4]
56 // OMP45-DAG: [[MAPT:@.+]] = private unnamed_addr constant [2 x i64] [i64 544, i64 800]
57 // OMP45-DAG: @{{.*}} = weak constant i8 0
59 // OMP50-DAG: [[SIZET:@.+]] = private unnamed_addr constant [3 x i64] [i64 0, i64 4, i64 1]
60 // OMP50-DAG: [[MAPT:@.+]] = private unnamed_addr constant [3 x i64] [i64 544, i64 800, i64 800]
61 // OMP50-DAG: @{{.*}} = weak constant i8 0
64 // TCHECK: @{{.+}} = weak constant [[ENTTY]]
65 // TCHECK: @{{.+}} = {{.*}}constant [[ENTTY]]
66 // TCHECK-NOT: @{{.+}} = weak constant [[ENTTY]]
68 template<typename tx, typename ty>
69 struct TT{
70 tx X;
71 ty Y;
74 int global;
75 extern int global;
77 // CHECK: define {{.*}}[[FOO:@.+]](
78 int foo(int n) {
79 int a = 0;
80 short aa = 0;
81 float b[10];
82 float bn[n];
83 double c[5][10];
84 double cn[5][n];
85 TT<long long, char> d;
86 static long *plocal;
88 // CHECK: [[ADD:%.+]] = add nsw i32
89 // CHECK: store i32 [[ADD]], ptr [[DEVICE_CAP:%.+]],
90 // CHECK: [[GEP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 0
91 // CHECK: [[DEV:%.+]] = load i32, ptr [[DEVICE_CAP]],
92 // CHECK: store i32 [[DEV]], ptr [[GEP]],
93 // CHECK: [[TASK:%.+]] = call ptr @__kmpc_omp_task_alloc(ptr [[ID:@.+]], i32 [[GTID:%.+]], i32 1, i[[SZ]] {{20|40}}, i[[SZ]] 4, ptr [[TASK_ENTRY0:@.+]])
94 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 0
95 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 1
96 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 2
97 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 3
98 // CHECK: call void @__kmpc_omp_taskwait_deps_51(ptr [[ID]], i32 [[GTID]], i32 4, ptr %{{.+}}, i32 0, ptr null, i32 0)
99 // CHECK: call void @__kmpc_omp_task_begin_if0(ptr [[ID]], i32 [[GTID]], ptr [[TASK]])
100 // CHECK: call i32 [[TASK_ENTRY0]](i32 [[GTID]], ptr [[TASK]])
101 // CHECK: call void @__kmpc_omp_task_complete_if0(ptr [[ID]], i32 [[GTID]], ptr [[TASK]])
102 #pragma omp target teams distribute simd device(global + a) depend(in: global) depend(out: a, b, cn[4])
103 for (int i = 0; i < 10; ++i) {
106 // CHECK: [[ADD:%.+]] = add nsw i32
107 // CHECK: store i32 [[ADD]], ptr [[DEVICE_CAP:%.+]],
109 // OMP45: [[BOOL:%.+]] = icmp ne i32 %{{.+}}, 0
110 // OMP45: br i1 [[BOOL]], label %[[THEN:.+]], label %[[ELSE:.+]]
111 // OMP50: br i1 {{.+}}, label %[[THEN:.+]], label %[[ELSE:.+]]
112 // CHECK: [[THEN]]:
113 // OMP45-DAG: [[BPADDR0:%.+]] = getelementptr inbounds [2 x ptr], ptr [[BP:%.+]], i32 0, i32 0
114 // OMP45-DAG: [[PADDR0:%.+]] = getelementptr inbounds [2 x ptr], ptr [[P:%.+]], i32 0, i32 0
115 // OMP50-DAG: [[BPADDR0:%.+]] = getelementptr inbounds [3 x ptr], ptr [[BP:%.+]], i32 0, i32 0
116 // OMP50-DAG: [[PADDR0:%.+]] = getelementptr inbounds [3 x ptr], ptr [[P:%.+]], i32 0, i32 0
117 // CHECK-DAG: store ptr [[BP0:%[^,]+]], ptr [[BPADDR0]]
118 // CHECK-DAG: store ptr [[BP0]], ptr [[PADDR0]]
120 // OMP45-DAG: [[BPADDR1:%.+]] = getelementptr inbounds [2 x ptr], ptr [[BP]], i32 0, i32 1
121 // OMP45-DAG: [[PADDR1:%.+]] = getelementptr inbounds [2 x ptr], ptr [[P]], i32 0, i32 1
123 // OMP50-DAG: [[BPADDR1:%.+]] = getelementptr inbounds [3 x ptr], ptr [[BP]], i32 0, i32 1
124 // OMP50-DAG: [[PADDR1:%.+]] = getelementptr inbounds [3 x ptr], ptr [[P]], i32 0, i32 1
125 // CHECK-DAG: store i[[SZ]] [[BP1:%[^,]+]], ptr [[BPADDR1]]
126 // CHECK-DAG: store i[[SZ]] [[BP1]], ptr [[PADDR1]]
128 // OMP50-DAG: [[BPADDR2:%.+]] = getelementptr inbounds [3 x ptr], ptr [[BP]], i32 0, i32 2
129 // OMP50-DAG: [[PADDR2:%.+]] = getelementptr inbounds [3 x ptr], ptr [[P]], i32 0, i32 2
130 // OMP50-DAG: store i[[SZ]] [[BP2:%[^,]+]], ptr [[BPADDR2]]
131 // OMP50-DAG: store i[[SZ]] [[BP2]], ptr [[PADDR2]]
134 // OMP45-DAG: getelementptr inbounds [2 x ptr], ptr [[BP]], i32 0, i32 0
135 // OMP45-DAG: getelementptr inbounds [2 x ptr], ptr [[P]], i32 0, i32 0
136 // OMP50-DAG: getelementptr inbounds [3 x ptr], ptr [[BP]], i32 0, i32 0
137 // OMP50-DAG: getelementptr inbounds [3 x ptr], ptr [[P]], i32 0, i32 0
139 // OMP45: [[GEP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 2
140 // OMP50-64: [[GEP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 4
141 // OMP50-32: [[GEP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 3
142 // CHECK: [[DEV:%.+]] = load i32, ptr [[DEVICE_CAP]],
143 // CHECK: store i32 [[DEV]], ptr [[GEP]],
144 // CHECK: [[DEV1:%.+]] = load i32, ptr [[DEVICE_CAP]],
145 // CHECK: [[DEV2:%.+]] = sext i32 [[DEV1]] to i64
147 // OMP45: [[TASK:%.+]] = call ptr @__kmpc_omp_target_task_alloc(ptr [[ID]], i32 [[GTID]], i32 1, i[[SZ]] {{104|60}}, i[[SZ]] {{16|12}}, ptr [[TASK_ENTRY1_:@.+]], i64 [[DEV2]])
148 // OMP50: [[TASK:%.+]] = call ptr @__kmpc_omp_target_task_alloc(ptr [[ID]], i32 [[GTID]], i32 1, i[[SZ]] {{28|128|76}}, i[[SZ]] {{16|12|24}}, ptr [[TASK_ENTRY1_:@.+]], i64 [[DEV2]])
149 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 0
150 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 1
151 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 2
152 // CHECK: call i32 @__kmpc_omp_task_with_deps(ptr [[ID]], i32 [[GTID]], ptr [[TASK]], i32 3, ptr %{{.+}}, i32 0, ptr null)
153 // CHECK: br label %[[EXIT:.+]]
155 // CHECK: [[ELSE]]:
156 // OMP45-NOT: getelementptr inbounds [2 x ptr], ptr
157 // OMP50-NOT: getelementptr inbounds [3 x ptr], ptr
158 // OMP45: [[GEP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 2
159 // OMP50-64: [[GEP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 4
160 // OMP50-32: [[GEP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 3
161 // CHECK: [[DEV:%.+]] = load i32, ptr [[DEVICE_CAP]],
162 // CHECK: store i32 [[DEV]], ptr [[GEP]],
163 // CHECK: [[DEV1:%.+]] = load i32, ptr [[DEVICE_CAP]],
164 // CHECK: [[DEV2:%.+]] = sext i32 [[DEV1]] to i64
166 // OMP45: [[TASK:%.+]] = call ptr @__kmpc_omp_target_task_alloc(ptr [[ID]], i32 [[GTID]], i32 1, i[[SZ]] {{56|28}}, i[[SZ]] {{16|12}}, ptr [[TASK_ENTRY1__:@.+]], i64 [[DEV2]])
167 // OMP50: [[TASK:%.+]] = call ptr @__kmpc_omp_target_task_alloc(ptr [[ID]], i32 [[GTID]], i32 1, i[[SZ]] {{56|28}}, i[[SZ]] {{16|12|24}}, ptr [[TASK_ENTRY1__:@.+]], i64 [[DEV2]])
168 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 0
169 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 1
170 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 2
171 // CHECK: call i32 @__kmpc_omp_task_with_deps(ptr [[ID]], i32 [[GTID]], ptr [[TASK]], i32 3, ptr %{{.+}}, i32 0, ptr null)
172 // CHECK: br label %[[EXIT:.+]]
173 // CHECK: [[EXIT]]:
175 #pragma omp target teams distribute simd device(global + a) nowait depend(inout: global, a, bn) if(a)
176 for (int i = 0; i < *plocal; ++i) {
177 static int local1;
178 *plocal = global;
179 local1 = global;
182 // CHECK: [[TASK:%.+]] = call ptr @__kmpc_omp_task_alloc(ptr [[ID]], i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, ptr [[TASK_ENTRY2:@.+]])
183 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 0
184 // CHECK: call void @__kmpc_omp_taskwait_deps_51(ptr [[ID]], i32 [[GTID]], i32 1, ptr %{{.+}}, i32 0, ptr null, i32 0)
185 // CHECK: call void @__kmpc_omp_task_begin_if0(ptr [[ID]], i32 [[GTID]], ptr [[TASK]])
186 // CHECK: call i32 [[TASK_ENTRY2]](i32 [[GTID]], ptr [[TASK]])
187 // CHECK: call void @__kmpc_omp_task_complete_if0(ptr [[ID]], i32 [[GTID]], ptr [[TASK]])
188 #pragma omp target teams distribute simd if(0) firstprivate(global) depend(out:global)
189 for (int i = 0; i < global; ++i) {
190 global += 1;
193 return a;
196 // Check that the offloading functions are emitted and that the arguments are
197 // correct and loaded correctly for the target regions in foo().
199 // CHECK: define internal void [[HVT0:@.+]]()
201 // CHECK: define internal{{.*}} i32 [[TASK_ENTRY0]](i32{{.*}}, ptr noalias noundef %1)
202 // CHECK: store ptr null, ptr %
203 // CHECK: [[DEVICE_CAP:%.+]] = load ptr,
204 // CHECK: [[DEV:%.+]] = load i32, ptr [[DEVICE_CAP]],
205 // CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64
206 // CHECK: [[RET:%.+]] = call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 [[DEVICE]], i32 0, i32 1, ptr @.{{.+}}.region_id, ptr %{{.+}})
207 // CHECK-NEXT: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0
208 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]]
209 // CHECK: [[FAIL]]
210 // CHECK: call void [[HVT0]]()
211 // CHECK-NEXT: br label %[[END]]
212 // CHECK: [[END]]
213 // CHECK: ret i32 0
215 // CHECK: define internal void [[HVT1:@.+]](ptr noundef %{{.+}}, i[[SZ]] noundef %{{.+}})
217 // CHECK: define internal{{.*}} i32 [[TASK_ENTRY1_]](i32{{.*}}, ptr noalias noundef %1)
218 // CHECK: call void {{%.*}}(
219 // OMP45: [[DEVICE_CAP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 2
220 // OMP50-64: [[DEVICE_CAP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 4
221 // OMP50-32: [[DEVICE_CAP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 3
222 // CHECK: [[DEV:%.+]] = load i32, ptr [[DEVICE_CAP]],
223 // CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64
224 // OMP45: [[RET:%.+]] = call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 [[DEVICE]], i32 0, i32 1, ptr @.{{.+}}.region_id, ptr %{{.+}})
225 // OMP50: [[RET:%.+]] = call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 [[DEVICE]], i32 0, i32 1, ptr @.{{.+}}.region_id, ptr %{{.+}})
227 // CHECK: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0
228 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]]
229 // CHECK: [[FAIL]]
230 // CHECK: [[BP0:%.+]] = load ptr, ptr %
231 // CHECK: [[BP1_I32:%.+]] = load i32, ptr @
232 // CHECK-64: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]],
233 // CHECK-32: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]],
234 // CHECK: [[BP1:%.+]] = load i[[SZ]], ptr [[BP1_PTR]],
235 // OMP45: call void [[HVT1]](ptr [[BP0]], i[[SZ]] [[BP1]])
237 // OMP50: [[BP2:%.+]] = load i[[SZ]], ptr
238 // OMP50: call void [[HVT1]](ptr [[BP0]], i[[SZ]] [[BP1]], i[[SZ]] [[BP2]])
239 // CHECK-NEXT: br label %[[END]]
240 // CHECK: [[END]]
241 // CHECK: ret i32 0
243 // CHECK: define internal{{.*}} i32 [[TASK_ENTRY1__]](i32{{.*}}, ptr noalias noundef %1)
244 // CHECK: call void {{%.*}}(
245 // CHECK: [[DEVICE_CAP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr %{{.+}}, i32 0, i32 2
246 // CHECK: [[BP0:%.+]] = load ptr, ptr %
247 // CHECK: [[BP1_I32:%.+]] = load i32, ptr @
248 // CHECK-64: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]],
249 // CHECK-32: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]],
250 // CHECK: [[BP1:%.+]] = load i[[SZ]], ptr [[BP1_PTR]],
251 // OMP50: [[BP2:%.+]] = load i[[SZ]], ptr
252 // OMP45: call void [[HVT1]](ptr [[BP0]], i[[SZ]] [[BP1]])
253 // OMP50: call void [[HVT1]](ptr [[BP0]], i[[SZ]] [[BP1]], i[[SZ]] [[BP2]])
255 // CHECK: ret i32 0
257 // CHECK: define internal void [[HVT2:@.+]](i[[SZ]] noundef %{{.+}})
258 // Create stack storage and store argument in there.
259 // CHECK: [[AA_ADDR:%.+]] = alloca i[[SZ]], align
260 // CHECK: store i[[SZ]] %{{.+}}, ptr [[AA_ADDR]], align
261 // CHECK-64: load i32, ptr [[AA_ADDR]], align
262 // CHECK-32: load i32, ptr [[AA_ADDR]], align
264 // CHECK: define internal{{.*}} i32 [[TASK_ENTRY2]](i32{{.*}}, ptr noalias noundef %1)
265 // CHECK: call void {{%.*}}(
266 // CHECK: [[BP1_I32:%.+]] = load i32, ptr %
267 // CHECK-64: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]],
268 // CHECK-32: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]],
269 // CHECK: [[BP1:%.+]] = load i[[SZ]], ptr [[BP1_PTR]],
270 // CHECK: call void [[HVT2]](i[[SZ]] [[BP1]])
271 // CHECK: ret i32 0
274 #endif