1 // RUN
: %clang_cc1 -no-opaque-pointers -triple spir-unknown-unknown -emit-llvm -O0 -cl-std
=clc
++ -o - %s | FileCheck %s
2 // RUN
: %clang_cc1 -no-opaque-pointers -triple spir-unknown-unknown -emit-llvm -O0 -cl-std
=cl2.0 -o - %s | FileCheck %s
3 // RUN
: %clang_cc1 -no-opaque-pointers -triple spir-unknown-unknown -emit-llvm -O0 -cl-std
=cl3.0 -o - %s | FileCheck %s
5 // CHECK
: %
[[A
:.
*]] = type
{ float
, float
, float
}
18 //CHECK
: %
[[ARG
:.
*]] = addrspacecast i32 addrspace
(1)* %
{{.
*}} to i8 addrspace
(4)*
19 //CHECK
: %
[[RET
:.
*]] = call spir_func i8 addrspace
(1)* @__to_global
(i8 addrspace
(4)* %
[[ARG]])
20 //CHECK: %{{.*}} = bitcast i8 addrspace(1)* %[[RET]] to i32 addrspace(1)*
21 glob = to_global(glob);
23 //CHECK: %[[ARG:.*]] = addrspacecast i32 addrspace(3)* %{{.*}} to i8 addrspace(4)*
24 //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(1)* @__to_global(i8 addrspace(4)* %[[ARG]])
25 //CHECK
: %
{{.
*}} = bitcast i8 addrspace
(1)* %
[[RET]] to i32 addrspace(1)*
26 glob = to_global(loc);
28 //CHECK: %[[ARG:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(4)*
29 //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(1)* @__to_global(i8 addrspace(4)* %[[ARG]])
30 //CHECK: %{{.*}} = bitcast i8 addrspace(1)* %[[RET]] to i32 addrspace
(1)*
31 glob
= to_global
(priv);
33 //CHECK
: %
[[ARG
:.
*]] = bitcast i32 addrspace
(4)* %
{{.
*}} to i8 addrspace
(4)*
34 //CHECK
: %
[[RET
:.
*]] = call spir_func i8 addrspace
(1)* @__to_global
(i8 addrspace
(4)* %
[[ARG]])
35 //CHECK: %{{.*}} = bitcast i8 addrspace(1)* %[[RET]] to i32 addrspace(1)*
36 glob = to_global(gen);
38 //CHECK: %[[ARG:.*]] = addrspacecast i32 addrspace(1)* %{{.*}} to i8 addrspace(4)*
39 //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(3)* @__to_local(i8 addrspace(4)* %[[ARG]])
40 //CHECK
: %
{{.
*}} = bitcast i8 addrspace
(3)* %
[[RET]] to i32 addrspace(3)*
43 //CHECK: %[[ARG:.*]] = addrspacecast i32 addrspace(3)* %{{.*}} to i8 addrspace(4)*
44 //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(3)* @__to_local(i8 addrspace(4)* %[[ARG]])
45 //CHECK: %{{.*}} = bitcast i8 addrspace(3)* %[[RET]] to i32 addrspace
(3)*
48 //CHECK
: %
[[ARG
:.
*]] = addrspacecast i32
* %
{{.
*}} to i8 addrspace
(4)*
49 //CHECK
: %
[[RET
:.
*]] = call spir_func i8 addrspace
(3)* @__to_local
(i8 addrspace
(4)* %
[[ARG]])
50 //CHECK: %{{.*}} = bitcast i8 addrspace(3)* %[[RET]] to i32 addrspace(3)*
53 //CHECK: %[[ARG:.*]] = bitcast i32 addrspace(4)* %{{.*}} to i8 addrspace(4)*
54 //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(3)* @__to_local(i8 addrspace(4)* %[[ARG]])
55 //CHECK
: %
{{.
*}} = bitcast i8 addrspace
(3)* %
[[RET]] to i32 addrspace(3)*
58 //CHECK: %[[ARG:.*]] = addrspacecast i32 addrspace(1)* %{{.*}} to i8 addrspace(4)*
59 //CHECK: %[[RET:.*]] = call spir_func i8* @__to_private(i8 addrspace(4)* %[[ARG]])
60 //CHECK: %{{.*}} = bitcast i8* %[[RET]] to i32
*
61 priv
= to_private
(glob);
63 //CHECK
: %
[[ARG
:.
*]] = addrspacecast i32 addrspace
(3)* %
{{.
*}} to i8 addrspace
(4)*
64 //CHECK
: %
[[RET
:.
*]] = call spir_func i8
* @__to_private
(i8 addrspace
(4)* %
[[ARG]])
65 //CHECK: %{{.*}} = bitcast i8* %[[RET]] to i32*
66 priv = to_private(loc);
68 //CHECK: %[[ARG:.*]] = addrspacecast i32* %{{.*}} to i8 addrspace(4)*
69 //CHECK: %[[RET:.*]] = call spir_func i8* @__to_private(i8 addrspace(4)* %[[ARG]])
70 //CHECK
: %
{{.
*}} = bitcast i8
* %
[[RET]] to i32*
71 priv = to_private(priv);
73 //CHECK: %[[ARG:.*]] = bitcast i32 addrspace(4)* %{{.*}} to i8 addrspace(4)*
74 //CHECK: %[[RET:.*]] = call spir_func i8* @__to_private(i8 addrspace(4)* %[[ARG]])
75 //CHECK: %{{.*}} = bitcast i8* %[[RET]] to i32
*
76 priv
= to_private
(gen);
78 //CHECK
: %
[[ARG
:.
*]] = addrspacecast %
[[A]]* %{{.*}} to i8 addrspace(4)*
79 //CHECK: %[[RET:.*]] = call spir_func i8 addrspace(1)* @__to_global(i8 addrspace(4)* %[[ARG]])
80 //CHECK: %{{.*}} = bitcast i8 addrspace(1)* %[[RET]] to %[[A]] addrspace
(1)*
82 GA gA
= to_global
(pA);
84 //CHECK-NOT
: addrspacecast
86 //CHECK
: call spir_func i8 addrspace
(1)* @__to_global
(i8 addrspace
(4)* %
{{.
*}})
87 //CHECK-NOT
: addrspacecast
90 global void
*glob_v
= to_global
(gen_v);