11// RUN: %clang -cc1 -triple spir64-unknown-linux-sycldevice -std=c++11 -fsycl-is-device -emit-llvm -x c++ %s -o - | FileCheck %s
22void bar (int & Data) {}
3- // CHECK: define spir_func void [[RAW_REF:@ [a-zA-Z0-9_]+]](i32* dereferenceable(4) %
3+ // CHECK: define spir_func void @ [[RAW_REF:[a-zA-Z0-9_]+]](i32* dereferenceable(4) %
44void bar2 (int & Data) {}
5- // CHECK: define spir_func void [[RAW_REF2:@ [a-zA-Z0-9_]+]](i32* dereferenceable(4) %
5+ // CHECK: define spir_func void @ [[RAW_REF2:[a-zA-Z0-9_]+]](i32* dereferenceable(4) %
66void bar (__local int &Data) {}
77// CHECK: define spir_func void [[LOC_REF:@[a-zA-Z0-9_]+]](i32 addrspace(3)* dereferenceable(4) %
88void foo (int * Data) {}
9- // CHECK: define spir_func void [[RAW_PTR:@ [a-zA-Z0-9_]+]](i32* %
9+ // CHECK: define spir_func void @ [[RAW_PTR:[a-zA-Z0-9_]+]](i32* %
1010void foo2 (int * Data) {}
11- // CHECK: define spir_func void [[RAW_PTR2:@ [a-zA-Z0-9_]+]](i32* %
11+ // CHECK: define spir_func void @ [[RAW_PTR2:[a-zA-Z0-9_]+]](i32* %
1212void foo (__attribute__((address_space(3 ))) int * Data) {}
1313// CHECK: define spir_func void [[LOC_PTR:@[a-zA-Z0-9_]+]](i32 addrspace(3)* %
1414
@@ -26,49 +26,49 @@ void usages() {
2626
2727 bar (*GLOB);
2828 // CHECK: [[GLOB_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(1)*, i32 addrspace(1)** [[GLOB]]
29- // CHECK: [[GLOB_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_LOAD]] to i32*
30- // CHECK: call spir_func void [[RAW_REF]](i32* dereferenceable (4) [[GLOB_CAST]])
29+ // CHECK: [[GLOB_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_LOAD]] to i32 addrspace(4) *
30+ // CHECK: call spir_func void @new. [[RAW_REF]](i32 addrspace (4)* [[GLOB_CAST]])
3131 bar2 (*GLOB);
3232 // CHECK: [[GLOB_LOAD2:%[a-zA-Z0-9]+]] = load i32 addrspace(1)*, i32 addrspace(1)** [[GLOB]]
33- // CHECK: [[GLOB_CAST2:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_LOAD2]] to i32*
34- // CHECK: call spir_func void [[RAW_REF2]](i32* dereferenceable (4) [[GLOB_CAST2]])
33+ // CHECK: [[GLOB_CAST2:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_LOAD2]] to i32 addrspace(4) *
34+ // CHECK: call spir_func void @new. [[RAW_REF2]](i32 addrspace (4)* [[GLOB_CAST2]])
3535
3636 bar (*LOC);
3737 // CHECK: [[LOC_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(3)*, i32 addrspace(3)** [[LOC]]
3838 // CHECK: call spir_func void [[LOC_REF]](i32 addrspace(3)* dereferenceable(4) [[LOC_LOAD]])
3939 bar2 (*LOC);
4040 // CHECK: [[LOC_LOAD2:%[a-zA-Z0-9]+]] = load i32 addrspace(3)*, i32 addrspace(3)** [[LOC]]
41- // CHECK: [[LOC_CAST2:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(3)* [[LOC_LOAD2]] to i32*
42- // CHECK: call spir_func void [[RAW_REF2]](i32* dereferenceable (4) [[LOC_CAST2]])
41+ // CHECK: [[LOC_CAST2:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(3)* [[LOC_LOAD2]] to i32 addrspace(4) *
42+ // CHECK: call spir_func void @new. [[RAW_REF2]](i32 addrspace (4)* [[LOC_CAST2]])
4343
4444 bar (*NoAS);
4545 // CHECK: [[NoAS_LOAD:%[a-zA-Z0-9]+]] = load i32*, i32** [[NoAS]]
46- // CHECK: call spir_func void [[RAW_REF]](i32* dereferenceable(4) [[NoAS_LOAD]])
46+ // CHECK: call spir_func void @ [[RAW_REF]](i32* dereferenceable(4) [[NoAS_LOAD]])
4747 bar2 (*NoAS);
4848 // CHECK: [[NoAS_LOAD2:%[a-zA-Z0-9]+]] = load i32*, i32** [[NoAS]]
49- // CHECK: call spir_func void [[RAW_REF2]](i32* dereferenceable(4) [[NoAS_LOAD2]])
49+ // CHECK: call spir_func void @ [[RAW_REF2]](i32* dereferenceable(4) [[NoAS_LOAD2]])
5050
5151 foo (GLOB);
5252 // CHECK: [[GLOB_LOAD3:%[a-zA-Z0-9]+]] = load i32 addrspace(1)*, i32 addrspace(1)** [[GLOB]]
53- // CHECK: [[GLOB_CAST3:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_LOAD3]] to i32*
54- // CHECK: call spir_func void [[RAW_PTR]](i32* [[GLOB_CAST3]])
53+ // CHECK: [[GLOB_CAST3:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_LOAD3]] to i32 addrspace(4) *
54+ // CHECK: call spir_func void @new. [[RAW_PTR]](i32 addrspace(4) * [[GLOB_CAST3]])
5555 foo2 (GLOB);
5656 // CHECK: [[GLOB_LOAD4:%[a-zA-Z0-9]+]] = load i32 addrspace(1)*, i32 addrspace(1)** [[GLOB]]
57- // CHECK: [[GLOB_CAST4:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_LOAD4]] to i32*
58- // CHECK: call spir_func void [[RAW_PTR2]](i32* [[GLOB_CAST4]])
57+ // CHECK: [[GLOB_CAST4:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_LOAD4]] to i32 addrspace(4) *
58+ // CHECK: call spir_func void @new. [[RAW_PTR2]](i32 addrspace(4) * [[GLOB_CAST4]])
5959 foo (LOC);
6060 // CHECK: [[LOC_LOAD3:%[a-zA-Z0-9]+]] = load i32 addrspace(3)*, i32 addrspace(3)** [[LOC]]
6161 // CHECK: call spir_func void [[LOC_PTR]](i32 addrspace(3)* [[LOC_LOAD3]])
6262 foo2 (LOC);
6363 // CHECK: [[LOC_LOAD4:%[a-zA-Z0-9]+]] = load i32 addrspace(3)*, i32 addrspace(3)** [[LOC]]
64- // CHECK: [[LOC_CAST4:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(3)* [[LOC_LOAD4]] to i32*
65- // CHECK: call spir_func void [[RAW_PTR2]](i32* [[LOC_CAST4]])
64+ // CHECK: [[LOC_CAST4:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(3)* [[LOC_LOAD4]] to i32 addrspace(4) *
65+ // CHECK: call spir_func void @new. [[RAW_PTR2]](i32 addrspace(4) * [[LOC_CAST4]])
6666 foo (NoAS);
6767 // CHECK: [[NoAS_LOAD3:%[a-zA-Z0-9]+]] = load i32*, i32** [[NoAS]]
68- // CHECK: call spir_func void [[RAW_PTR]](i32* [[NoAS_LOAD3]])
68+ // CHECK: call spir_func void @ [[RAW_PTR]](i32* [[NoAS_LOAD3]])
6969 foo2 (NoAS);
7070 // CHECK: [[NoAS_LOAD4:%[a-zA-Z0-9]+]] = load i32*, i32** [[NoAS]]
71- // CHECK: call spir_func void [[RAW_PTR2]](i32* [[NoAS_LOAD4]])
71+ // CHECK: call spir_func void @ [[RAW_PTR2]](i32* [[NoAS_LOAD4]])
7272
7373 // Ensure that we still get 3 different template instantiations.
7474 tmpl (GLOB);
@@ -108,41 +108,50 @@ void usages2() {
108108
109109 bar (*PRIV_NUM);
110110 // CHECK: [[PRIV_NUM_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(5)*, i32 addrspace(5)** [[PRIV_NUM]]
111- // CHECK: [[PRIV_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(5)* [[PRIV_NUM_LOAD]] to i32*
112- // CHECK: call spir_func void [[RAW_REF]](i32* dereferenceable (4) [[PRIV_NUM_CAST]])
111+ // CHECK: [[PRIV_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(5)* [[PRIV_NUM_LOAD]] to i32 addrspace(4) *
112+ // CHECK: call spir_func void @new. [[RAW_REF]](i32 addrspace (4)* [[PRIV_NUM_CAST]])
113113 bar (*PRIV_NUM2);
114114 // CHECK: [[PRIV_NUM2_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(5)*, i32 addrspace(5)** [[PRIV_NUM2]]
115- // CHECK: [[PRIV_NUM2_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(5)* [[PRIV_NUM2_LOAD]] to i32*
116- // CHECK: call spir_func void [[RAW_REF]](i32* dereferenceable (4) [[PRIV_NUM2_CAST]])
115+ // CHECK: [[PRIV_NUM2_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(5)* [[PRIV_NUM2_LOAD]] to i32 addrspace(4) *
116+ // CHECK: call spir_func void @new. [[RAW_REF]](i32 addrspace (4)* [[PRIV_NUM2_CAST]])
117117 bar (*PRIV);
118118 // CHECK: [[PRIV_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(5)*, i32 addrspace(5)** [[PRIV]]
119- // CHECK: [[PRIV_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(5)* [[PRIV_LOAD]] to i32*
120- // CHECK: call spir_func void [[RAW_REF]](i32* dereferenceable (4) [[PRIV_CAST]])
119+ // CHECK: [[PRIV_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(5)* [[PRIV_LOAD]] to i32 addrspace(4) *
120+ // CHECK: call spir_func void @new. [[RAW_REF]](i32 addrspace (4)* [[PRIV_CAST]])
121121 bar (*GLOB_NUM);
122122 // CHECK: [[GLOB_NUM_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(1)*, i32 addrspace(1)** [[GLOB_NUM]]
123- // CHECK: [[GLOB_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_NUM_LOAD]] to i32*
124- // CHECK: call spir_func void [[RAW_REF]](i32* dereferenceable (4) [[GLOB_NUM_CAST]])
123+ // CHECK: [[GLOB_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_NUM_LOAD]] to i32 addrspace(4) *
124+ // CHECK: call spir_func void @new. [[RAW_REF]](i32 addrspace (4)* [[GLOB_NUM_CAST]])
125125 bar (*GLOB);
126126 // CHECK: [[GLOB_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(1)*, i32 addrspace(1)** [[GLOB]]
127- // CHECK: [[GLOB_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_LOAD]] to i32*
128- // CHECK: call spir_func void [[RAW_REF]](i32* dereferenceable (4) [[GLOB_CAST]])
127+ // CHECK: [[GLOB_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_LOAD]] to i32 addrspace(4) *
128+ // CHECK: call spir_func void @new. [[RAW_REF]](i32 addrspace (4)* [[GLOB_CAST]])
129129 bar (*CONST_NUM);
130130 // CHECK: [[CONST_NUM_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(2)*, i32 addrspace(2)** [[CONST_NUM]]
131- // CHECK: [[CONST_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(2)* [[CONST_NUM_LOAD]] to i32*
132- // CHECK: call spir_func void [[RAW_REF]](i32* dereferenceable (4) [[CONST_NUM_CAST]])
131+ // CHECK: [[CONST_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(2)* [[CONST_NUM_LOAD]] to i32 addrspace(4) *
132+ // CHECK: call spir_func void @new. [[RAW_REF]](i32 addrspace (4)* [[CONST_NUM_CAST]])
133133 bar (*CONST);
134134 // CHECK: [[CONST_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(2)*, i32 addrspace(2)** [[CONST]]
135- // CHECK: [[CONST_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(2)* [[CONST_LOAD]] to i32*
136- // CHECK: call spir_func void [[RAW_REF]](i32* dereferenceable (4) [[CONST_CAST]])
135+ // CHECK: [[CONST_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(2)* [[CONST_LOAD]] to i32 addrspace(4) *
136+ // CHECK: call spir_func void @new. [[RAW_REF]](i32 addrspace (4)* [[CONST_CAST]])
137137 bar2 (*LOCAL_NUM);
138138 // CHECK: [[LOCAL_NUM_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(3)*, i32 addrspace(3)** [[LOCAL_NUM]]
139- // CHECK: [[LOCAL_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(3)* [[LOCAL_NUM_LOAD]] to i32*
140- // CHECK: call spir_func void [[RAW_REF2]](i32* dereferenceable (4) [[LOCAL_NUM_CAST]])
139+ // CHECK: [[LOCAL_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(3)* [[LOCAL_NUM_LOAD]] to i32 addrspace(4) *
140+ // CHECK: call spir_func void @new. [[RAW_REF2]](i32 addrspace (4)* [[LOCAL_NUM_CAST]])
141141 bar2 (*LOCAL);
142142 // CHECK: [[LOCAL_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(3)*, i32 addrspace(3)** [[LOCAL]]
143- // CHECK: [[LOCAL_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(3)* [[LOCAL_LOAD]] to i32*
144- // CHECK: call spir_func void [[RAW_REF2]](i32* dereferenceable (4) [[LOCAL_CAST]])
143+ // CHECK: [[LOCAL_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(3)* [[LOCAL_LOAD]] to i32 addrspace(4) *
144+ // CHECK: call spir_func void @new. [[RAW_REF2]](i32 addrspace (4)* [[LOCAL_CAST]])
145145}
146+
147+ // CHECK: define spir_func void @new.[[RAW_REF]](i32 addrspace(4)* dereferenceable(4)
148+
149+ // CHECK: define spir_func void @new.[[RAW_REF2]](i32 addrspace(4)* dereferenceable(4)
150+
151+ // CHECK: define spir_func void @new.[[RAW_PTR2]](i32 addrspace(4)*
152+
153+ // CHECK: define spir_func void @new.[[RAW_PTR]](i32 addrspace(4)*
154+
146155template <typename name, typename Func>
147156__attribute__ ((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
148157 kernelFunc ();
0 commit comments