brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 30f4ecb Raw
37 lines · c
1// RUN: %clang_cc1 -O1 -triple spirv64 -fsycl-is-device -x c++ %s -emit-llvm -o - | FileCheck %s2// RUN: %clang_cc1 -O1 -triple spirv64 -cl-std=CL3.0 -x cl %s -emit-llvm -o - | FileCheck %s3// RUN: %clang_cc1 -O1 -triple spirv32 -cl-std=CL3.0 -x cl %s -emit-llvm -o - | FileCheck %s4 5#ifdef __SYCL_DEVICE_ONLY__6#define SYCL_EXTERNAL [[clang::sycl_external]]7#else8#define SYCL_EXTERNAL9#endif10 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//16SYCL_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//25SYCL_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//34SYCL_EXTERNAL __attribute__((opencl_local)) int* test_cast_to_local(int* p) {35    return __builtin_spirv_generic_cast_to_ptr_explicit(p, 4);36}37