================
@@ -0,0 +1,34 @@
+// Test that target teams reduction codegen handles address space casts
correctly.
+
+// RUN: %clang_cc1 -verify -fopenmp -x c -triple x86_64-unknown-linux
-fopenmp-targets=spirv64-intel -emit-llvm-bc %s -o %t-host.bc
+// 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
+
+// expected-no-diagnostics
+
+// Verify the kernel is generated
+// CHECK: define weak_odr protected spir_kernel void
@__omp_offloading_{{.*}}_main_{{.*}}
+
+// Verify __kmpc_alloc_shared is called for reduction variable
+// The return type should be ptr addrspace(4) (generic pointer)
+// CHECK: call spir_func align 8 addrspace(9) ptr addrspace(4)
@__kmpc_alloc_shared(i64 4)
+
+// Verify the reduction runtime function is called
+// CHECK: call spir_func addrspace(9) i32 @__kmpc_nvptx_teams_reduce_nowait_v2(
+
+// Verify __kmpc_free_shared is called
+// CHECK: call spir_func addrspace(9) void @__kmpc_free_shared(ptr addrspace(4)
+
+// Verify the reduction function is generated
+// This is where the address space cast fix is critical
+// CHECK: define internal void @{{.*}}reduction{{.*}}func
----------------
sarnex wrote:
does the function have `spir_func` calling conv? if not that's probably a
separate bug
https://github.com/llvm/llvm-project/pull/194879
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits