Debian Codegraph @

clang/test/CodeGenSPIRV/Builtins/generic_cast_to_ptr_explicit.c

raw
1 // RUN: %clang_cc1 -O1 -triple spirv64 -fsycl-is-device -x c++ %s -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -O1 -triple spirv64 -cl-std=CL3.0 -x cl %s -emit-llvm -o - | FileCheck %s
3 // RUN: %clang_cc1 -O1 -triple spirv32 -cl-std=CL3.0 -x cl %s -emit-llvm -o - | FileCheck %s
4
5 #ifdef __SYCL_DEVICE_ONLY__
6 #define SYCL_EXTERNAL [[clang::sycl_external]]
7 #else
8 #define SYCL_EXTERNAL
9 #endif
10
11 // CHECK: spir_func noundef ptr @{{.*}}test_cast_to_private{{.*}}(ptr addrspace(4) noundef readnone [[P:%.*]]
12 // CHECK-NEXT: [[ENTRY:.*:]]
13 // CHECK-NEXT: [[SPV_CAST:%.*]] = tail call noundef ptr @llvm.spv.generic.cast.to.ptr.explicit.p0(ptr addrspace(4) %p)
14 // CHECK-NEXT: ret ptr [[SPV_CAST]]
15 //
16 SYCL_EXTERNAL __attribute__((opencl_private)) int* test_cast_to_private(int* p) {
17 return __builtin_spirv_generic_cast_to_ptr_explicit(p, 7);
18 }
19
20 // CHECK: spir_func noundef ptr addrspace(1) @{{.*}}test_cast_to_global{{.*}}(ptr addrspace(4) noundef readnone [[P:%.*]]
21 // CHECK-NEXT: [[ENTRY:.*:]]
22 // CHECK-NEXT: [[SPV_CAST:%.*]] = tail call noundef ptr addrspace(1) @llvm.spv.generic.cast.to.ptr.explicit.p1(ptr addrspace(4) %p)
23 // CHECK-NEXT: ret ptr addrspace(1) [[SPV_CAST]]
24 //
25 SYCL_EXTERNAL __attribute__((opencl_global)) int* test_cast_to_global(int* p) {
26 return __builtin_spirv_generic_cast_to_ptr_explicit(p, 5);
27 }
28
29 // CHECK: spir_func noundef ptr addrspace(3) @{{.*}}test_cast_to_local{{.*}}(ptr addrspace(4) noundef readnone [[P:%.*]]
30 // CHECK-NEXT: [[ENTRY:.*:]]
31 // CHECK-NEXT: [[SPV_CAST:%.*]] = tail call noundef ptr addrspace(3) @llvm.spv.generic.cast.to.ptr.explicit.p3(ptr addrspace(4) %p)
32 // CHECK-NEXT: ret ptr addrspace(3) [[SPV_CAST]]
33 //
34 SYCL_EXTERNAL __attribute__((opencl_local)) int* test_cast_to_local(int* p) {
35 return __builtin_spirv_generic_cast_to_ptr_explicit(p, 4);
36 }