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 9 10 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 16 17 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}} 25 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 35 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}} 45 46 // expected-no-diagnostics 47 #ifndef HEADER 48 #define HEADER 49 50 // CHECK-DAG: [[TT:%.+]] = type { i64, i8 } 51 // CHECK-DAG: [[ENTTY:%.+]] = type { ptr, ptr, i[[SZ:32|64]], i32, i32 } 52 53 // TCHECK: [[ENTTY:%.+]] = type { ptr, ptr, i{{32|64}}, i32, i32 } 54 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 58 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 62 63 64 // TCHECK: @{{.+}} = weak constant [[ENTTY]] 65 // TCHECK: @{{.+}} = {{.*}}constant [[ENTTY]] 66 // TCHECK-NOT: @{{.+}} = weak constant [[ENTTY]] 67 68 // Check target registration is registered as a Ctor. 69 // CHECK: appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @.omp_offloading.requires_reg, ptr null }] 70 71 72 template<typename tx, typename ty> 73 struct TT{ 74 tx X; 75 ty Y; 76 }; 77 78 int global; 79 extern int global; 80 81 // CHECK: define {{.*}}[[FOO:@.+]]( 82 int foo(int n) { 83 int a = 0; 84 short aa = 0; 85 float b[10]; 86 float bn[n]; 87 double c[5][10]; 88 double cn[5][n]; 89 TT<long long, char> d; 90 static long *plocal; 91 92 // CHECK: [[ADD:%.+]] = add nsw i32 93 // CHECK: store i32 [[ADD]], ptr [[DEVICE_CAP:%.+]], 94 // CHECK: [[GEP:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i32 0, i32 0 95 // CHECK: [[DEV:%.+]] = load i32, ptr [[DEVICE_CAP]], 96 // CHECK: store i32 [[DEV]], ptr [[GEP]], 97 // CHECK: [[TASK:%.+]] = call ptr @__kmpc_omp_task_alloc(ptr [[ID:@.+]], i32 [[GTID:%.+]], i32 1, i[[SZ]] {{20|40}}, i[[SZ]] 4, ptr [[TASK_ENTRY0:@.+]]) 98 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 0 99 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 1 100 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 2 101 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 3 102 // CHECK: call void @__kmpc_omp_taskwait_deps_51(ptr [[ID]], i32 [[GTID]], i32 4, ptr %{{.+}}, i32 0, ptr null, i32 0) 103 // CHECK: call void @__kmpc_omp_task_begin_if0(ptr [[ID]], i32 [[GTID]], ptr [[TASK]]) 104 // CHECK: call i32 [[TASK_ENTRY0]](i32 [[GTID]], ptr [[TASK]]) 105 // CHECK: call void @__kmpc_omp_task_complete_if0(ptr [[ID]], i32 [[GTID]], ptr [[TASK]]) 106 #pragma omp target teams distribute simd device(global + a) depend(in: global) depend(out: a, b, cn[4]) 107 for (int i = 0; i < 10; ++i) { 108 } 109 110 // CHECK: [[ADD:%.+]] = add nsw i32 111 // CHECK: store i32 [[ADD]], ptr [[DEVICE_CAP:%.+]], 112 113 // OMP45: [[BOOL:%.+]] = icmp ne i32 %{{.+}}, 0 114 // OMP45: br i1 [[BOOL]], label %[[THEN:.+]], label %[[ELSE:.+]] 115 // OMP50: br i1 {{.+}}, label %[[THEN:.+]], label %[[ELSE:.+]] 116 // CHECK: [[THEN]]: 117 // OMP45-DAG: [[BPADDR0:%.+]] = getelementptr inbounds [2 x ptr], ptr [[BP:%.+]], i32 0, i32 0 118 // OMP45-DAG: [[PADDR0:%.+]] = getelementptr inbounds [2 x ptr], ptr [[P:%.+]], i32 0, i32 0 119 // OMP50-DAG: [[BPADDR0:%.+]] = getelementptr inbounds [3 x ptr], ptr [[BP:%.+]], i32 0, i32 0 120 // OMP50-DAG: [[PADDR0:%.+]] = getelementptr inbounds [3 x ptr], ptr [[P:%.+]], i32 0, i32 0 121 // CHECK-DAG: store ptr [[BP0:%[^,]+]], ptr [[BPADDR0]] 122 // CHECK-DAG: store ptr [[BP0]], ptr [[PADDR0]] 123 124 // OMP45-DAG: [[BPADDR1:%.+]] = getelementptr inbounds [2 x ptr], ptr [[BP]], i32 0, i32 1 125 // OMP45-DAG: [[PADDR1:%.+]] = getelementptr inbounds [2 x ptr], ptr [[P]], i32 0, i32 1 126 127 // OMP50-DAG: [[BPADDR1:%.+]] = getelementptr inbounds [3 x ptr], ptr [[BP]], i32 0, i32 1 128 // OMP50-DAG: [[PADDR1:%.+]] = getelementptr inbounds [3 x ptr], ptr [[P]], i32 0, i32 1 129 // CHECK-DAG: store i[[SZ]] [[BP1:%[^,]+]], ptr [[BPADDR1]] 130 // CHECK-DAG: store i[[SZ]] [[BP1]], ptr [[PADDR1]] 131 132 // OMP50-DAG: [[BPADDR2:%.+]] = getelementptr inbounds [3 x ptr], ptr [[BP]], i32 0, i32 2 133 // OMP50-DAG: [[PADDR2:%.+]] = getelementptr inbounds [3 x ptr], ptr [[P]], i32 0, i32 2 134 // OMP50-DAG: store i[[SZ]] [[BP2:%[^,]+]], ptr [[BPADDR2]] 135 // OMP50-DAG: store i[[SZ]] [[BP2]], ptr [[PADDR2]] 136 137 138 // OMP45-DAG: getelementptr inbounds [2 x ptr], ptr [[BP]], i32 0, i32 0 139 // OMP45-DAG: getelementptr inbounds [2 x ptr], ptr [[P]], i32 0, i32 0 140 // OMP50-DAG: getelementptr inbounds [3 x ptr], ptr [[BP]], i32 0, i32 0 141 // OMP50-DAG: getelementptr inbounds [3 x ptr], ptr [[P]], i32 0, i32 0 142 143 // OMP45: [[GEP:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i32 0, i32 2 144 // OMP50-64: [[GEP:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i32 0, i32 4 145 // OMP50-32: [[GEP:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i32 0, i32 3 146 // CHECK: [[DEV:%.+]] = load i32, ptr [[DEVICE_CAP]], 147 // CHECK: store i32 [[DEV]], ptr [[GEP]], 148 // CHECK: [[DEV1:%.+]] = load i32, ptr [[DEVICE_CAP]], 149 // CHECK: [[DEV2:%.+]] = sext i32 [[DEV1]] to i64 150 151 // 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]]) 152 // 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]]) 153 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 0 154 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 1 155 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 2 156 // CHECK: call i32 @__kmpc_omp_task_with_deps(ptr [[ID]], i32 [[GTID]], ptr [[TASK]], i32 3, ptr %{{.+}}, i32 0, ptr null) 157 // CHECK: br label %[[EXIT:.+]] 158 159 // CHECK: [[ELSE]]: 160 // OMP45-NOT: getelementptr inbounds [2 x ptr], ptr 161 // OMP50-NOT: getelementptr inbounds [3 x ptr], ptr 162 // OMP45: [[GEP:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i32 0, i32 2 163 // OMP50-64: [[GEP:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i32 0, i32 4 164 // OMP50-32: [[GEP:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i32 0, i32 3 165 // CHECK: [[DEV:%.+]] = load i32, ptr [[DEVICE_CAP]], 166 // CHECK: store i32 [[DEV]], ptr [[GEP]], 167 // CHECK: [[DEV1:%.+]] = load i32, ptr [[DEVICE_CAP]], 168 // CHECK: [[DEV2:%.+]] = sext i32 [[DEV1]] to i64 169 170 // 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]]) 171 // 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]]) 172 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 0 173 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 1 174 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 2 175 // CHECK: call i32 @__kmpc_omp_task_with_deps(ptr [[ID]], i32 [[GTID]], ptr [[TASK]], i32 3, ptr %{{.+}}, i32 0, ptr null) 176 // CHECK: br label %[[EXIT:.+]] 177 // CHECK: [[EXIT]]: 178 179 #pragma omp target teams distribute simd device(global + a) nowait depend(inout: global, a, bn) if(a) 180 for (int i = 0; i < *plocal; ++i) { 181 static int local1; 182 *plocal = global; 183 local1 = global; 184 } 185 186 // CHECK: [[TASK:%.+]] = call ptr @__kmpc_omp_task_alloc(ptr [[ID]], i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, ptr [[TASK_ENTRY2:@.+]]) 187 // CHECK: getelementptr %struct.kmp_depend_info, ptr %{{.+}}, i[[SZ]] 0 188 // CHECK: call void @__kmpc_omp_taskwait_deps_51(ptr [[ID]], i32 [[GTID]], i32 1, ptr %{{.+}}, i32 0, ptr null, i32 0) 189 // CHECK: call void @__kmpc_omp_task_begin_if0(ptr [[ID]], i32 [[GTID]], ptr [[TASK]]) 190 // CHECK: call i32 [[TASK_ENTRY2]](i32 [[GTID]], ptr [[TASK]]) 191 // CHECK: call void @__kmpc_omp_task_complete_if0(ptr [[ID]], i32 [[GTID]], ptr [[TASK]]) 192 #pragma omp target teams distribute simd if(0) firstprivate(global) depend(out:global) 193 for (int i = 0; i < global; ++i) { 194 global += 1; 195 } 196 197 return a; 198 } 199 200 // Check that the offloading functions are emitted and that the arguments are 201 // correct and loaded correctly for the target regions in foo(). 202 203 // CHECK: define internal void [[HVT0:@.+]]() 204 205 // CHECK: define internal{{.*}} i32 [[TASK_ENTRY0]](i32{{.*}}, ptr noalias noundef %1) 206 // CHECK: store ptr null, ptr % 207 // CHECK: [[DEVICE_CAP:%.+]] = load ptr, 208 // CHECK: [[DEV:%.+]] = load i32, ptr [[DEVICE_CAP]], 209 // CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64 210 // CHECK: [[RET:%.+]] = call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 [[DEVICE]], i32 0, i32 1, ptr @.{{.+}}.region_id, ptr %{{.+}}) 211 // CHECK-NEXT: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 212 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]] 213 // CHECK: [[FAIL]] 214 // CHECK: call void [[HVT0]]() 215 // CHECK-NEXT: br label %[[END]] 216 // CHECK: [[END]] 217 // CHECK: ret i32 0 218 219 // CHECK: define internal void [[HVT1:@.+]](ptr noundef %{{.+}}, i[[SZ]] noundef %{{.+}}) 220 221 // CHECK: define internal{{.*}} i32 [[TASK_ENTRY1_]](i32{{.*}}, ptr noalias noundef %1) 222 // CHECK: call void {{%.*}}( 223 // OMP45: [[DEVICE_CAP:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i32 0, i32 2 224 // OMP50-64: [[DEVICE_CAP:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i32 0, i32 4 225 // OMP50-32: [[DEVICE_CAP:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i32 0, i32 3 226 // CHECK: [[DEV:%.+]] = load i32, ptr [[DEVICE_CAP]], 227 // CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64 228 // OMP45: [[RET:%.+]] = call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 [[DEVICE]], i32 0, i32 1, ptr @.{{.+}}.region_id, ptr %{{.+}}) 229 // OMP50: [[RET:%.+]] = call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 [[DEVICE]], i32 0, i32 1, ptr @.{{.+}}.region_id, ptr %{{.+}}) 230 231 // CHECK: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 232 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]] 233 // CHECK: [[FAIL]] 234 // CHECK: [[BP0:%.+]] = load ptr, ptr % 235 // CHECK: [[BP1_I32:%.+]] = load i32, ptr @ 236 // CHECK-64: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]], 237 // CHECK-32: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]], 238 // CHECK: [[BP1:%.+]] = load i[[SZ]], ptr [[BP1_PTR]], 239 // OMP45: call void [[HVT1]](ptr [[BP0]], i[[SZ]] [[BP1]]) 240 241 // OMP50: [[BP2:%.+]] = load i[[SZ]], ptr 242 // OMP50: call void [[HVT1]](ptr [[BP0]], i[[SZ]] [[BP1]], i[[SZ]] [[BP2]]) 243 // CHECK-NEXT: br label %[[END]] 244 // CHECK: [[END]] 245 // CHECK: ret i32 0 246 247 // CHECK: define internal{{.*}} i32 [[TASK_ENTRY1__]](i32{{.*}}, ptr noalias noundef %1) 248 // CHECK: call void {{%.*}}( 249 // CHECK: [[DEVICE_CAP:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i32 0, i32 2 250 // CHECK: [[BP0:%.+]] = load ptr, ptr % 251 // CHECK: [[BP1_I32:%.+]] = load i32, ptr @ 252 // CHECK-64: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]], 253 // CHECK-32: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]], 254 // CHECK: [[BP1:%.+]] = load i[[SZ]], ptr [[BP1_PTR]], 255 // OMP50: [[BP2:%.+]] = load i[[SZ]], ptr 256 // OMP45: call void [[HVT1]](ptr [[BP0]], i[[SZ]] [[BP1]]) 257 // OMP50: call void [[HVT1]](ptr [[BP0]], i[[SZ]] [[BP1]], i[[SZ]] [[BP2]]) 258 259 // CHECK: ret i32 0 260 261 // CHECK: define internal void [[HVT2:@.+]](i[[SZ]] noundef %{{.+}}) 262 // Create stack storage and store argument in there. 263 // CHECK: [[AA_ADDR:%.+]] = alloca i[[SZ]], align 264 // CHECK: store i[[SZ]] %{{.+}}, ptr [[AA_ADDR]], align 265 // CHECK-64: load i32, ptr [[AA_ADDR]], align 266 // CHECK-32: load i32, ptr [[AA_ADDR]], align 267 268 // CHECK: define internal{{.*}} i32 [[TASK_ENTRY2]](i32{{.*}}, ptr noalias noundef %1) 269 // CHECK: call void {{%.*}}( 270 // CHECK: [[BP1_I32:%.+]] = load i32, ptr % 271 // CHECK-64: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]], 272 // CHECK-32: store i32 [[BP1_I32]], ptr [[BP1_PTR:%[^,]+]], 273 // CHECK: [[BP1:%.+]] = load i[[SZ]], ptr [[BP1_PTR]], 274 // CHECK: call void [[HVT2]](i[[SZ]] [[BP1]]) 275 // CHECK: ret i32 0 276 277 278 #endif 279