| 1 |
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-linux -fopenmp-targets=spirv64-intel -emit-llvm-bc %s -o %t-host.bc |
| 2 |
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple spirv64-intel -fopenmp-targets=spirv64-intel -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s |
| 3 |
|
| 4 |
// expected-no-diagnostics |
| 5 |
|
| 6 |
// CHECK: @__omp_offloading_{{.*}}_dynamic_environment = weak_odr protected addrspace(1) global %struct.DynamicEnvironmentTy zeroinitializer |
| 7 |
// CHECK: @__omp_offloading_{{.*}}_kernel_environment = weak_odr protected addrspace(1) constant %struct.KernelEnvironmentTy |
| 8 |
|
| 9 |
// CHECK: @"_gomp_critical_user_$var" = common addrspace(1) global [8 x i32] zeroinitializer, align 8 |
| 10 |
|
| 11 |
// CHECK: define weak_odr protected spir_kernel void @__omp_offloading_{{.*}} |
| 12 |
// CHECK: call spir_func addrspace(9) i32 @__kmpc_target_init( |
| 13 |
// CHECK: call spir_func addrspace(9) void @__kmpc_critical(ptr addrspace(4) addrspacecast (ptr addrspace(1) @{{.*}} to ptr addrspace(4)), i32 %{{.*}}, ptr addrspace(4) addrspacecast (ptr addrspace(1) @"_gomp_critical_user_$var" to ptr addrspace(4))) |
| 14 |
// CHECK: call spir_func addrspace(9) void @__kmpc_end_critical(ptr addrspace(4) addrspacecast (ptr addrspace(1) @{{.*}} to ptr addrspace(4)), i32 %{{.*}}, ptr addrspace(4) addrspacecast (ptr addrspace(1) @"_gomp_critical_user_$var" to ptr addrspace(4))) |
| 15 |
// CHECK: call spir_func addrspace(9) void @__kmpc_target_deinit( |
| 16 |
|
| 17 |
int main() { |
| 18 |
int ret = 0; |
| 19 |
#pragma omp target |
| 20 |
for(int i = 0; i < 5; i++) |
| 21 |
#pragma omp critical |
| 22 |
ret++; |
| 23 |
return ret; |
| 24 |
} |