xref: /llvm-project/clang/test/CodeGenSYCL/unique_stable_name_windows_diff.cpp (revision b57b3f64253a57831a5e5f4e6557d2f9cb01d017)
1 // RUN: %clang_cc1 -triple spir64-unknown-unknown-sycldevice -aux-triple x86_64-pc-windows-msvc -fsycl-is-device -disable-llvm-passes -fsycl-is-device -emit-llvm %s -o - | FileCheck %s '-D$ADDRSPACE=addrspace(1) '
2 // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsycl-is-device -disable-llvm-passes -fsycl-is-device -emit-llvm %s -o - | FileCheck %s '-D$ADDRSPACE='
3 
4 
5 template<typename KN, typename Func>
6 __attribute__((sycl_kernel)) void kernel(Func F){
7   F();
8 }
9 
10 template<typename KN, typename Func>
11 __attribute__((sycl_kernel)) void kernel2(Func F){
12   F(1);
13 }
14 
15 template<typename KN, typename Func>
16 __attribute__((sycl_kernel)) void kernel3(Func F){
17   F(1.1);
18 }
19 
20 int main() {
21   int i;
22   double d;
23   float f;
24   auto lambda1 = [](){};
25   auto lambda2 = [](int){};
26   auto lambda3 = [](double){};
27 
28   kernel<class K1>(lambda1);
29   kernel2<class K2>(lambda2);
30   kernel3<class K3>(lambda3);
31 
32   // Ensure the kernels are named the same between the device and host
33   // invocations.
34   (void)__builtin_sycl_unique_stable_name(decltype(lambda1));
35   (void)__builtin_sycl_unique_stable_name(decltype(lambda2));
36   (void)__builtin_sycl_unique_stable_name(decltype(lambda3));
37 
38   // Make sure the following 3 are the same between the host and device compile.
39   // Note that these are NOT the same value as each other, they differ by the
40   // signature.
41   // CHECK: private unnamed_addr [[$ADDRSPACE]]constant [17 x i8] c"_ZTSZ4mainEUlvE_\00"
42   // CHECK: private unnamed_addr [[$ADDRSPACE]]constant [17 x i8] c"_ZTSZ4mainEUliE_\00"
43   // CHECK: private unnamed_addr [[$ADDRSPACE]]constant [17 x i8] c"_ZTSZ4mainEUldE_\00"
44 }
45