1 // RUN
: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -O0 -cl-std
=clc
++ -o - %s | FileCheck %s
2 // RUN
: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -O0 -cl-std
=cl2.0 -o - %s | FileCheck %s
3 // RUN
: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -O0 -cl-std
=cl3.0 -o - %s | FileCheck %s
17 //CHECK
: %
[[ARG
:.
*]] = addrspacecast ptr addrspace
(1) %
{{.
*}} to ptr addrspace
(4)
18 //CHECK
: %
[[RET
:.
*]] = call spir_func ptr addrspace
(1) @__to_global
(ptr addrspace
(4) %
[[ARG]])
19 //CHECK: store ptr addrspace(1) %[[RET]], ptr %glob
20 glob = to_global(glob);
22 //CHECK: %[[ARG:.*]] = addrspacecast ptr addrspace(3) %{{.*}} to ptr addrspace(4)
23 //CHECK: %[[RET:.*]] = call spir_func ptr addrspace(1) @__to_global(ptr addrspace(4) %[[ARG]])
24 //CHECK
: store ptr addrspace
(1) %
[[RET]], ptr %glob
25 glob = to_global(loc);
27 //CHECK: %[[ARG:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(4)
28 //CHECK: %[[RET:.*]] = call spir_func ptr addrspace(1) @__to_global(ptr addrspace(4) %[[ARG]])
29 //CHECK: store ptr addrspace(1) %[[RET]], ptr %glob
30 glob
= to_global
(priv);
32 //CHECK
: %
[[ARG
:.
*]] = load ptr addrspace
(4), ptr %gen
33 //CHECK
: %
[[RET
:.
*]] = call spir_func ptr addrspace
(1) @__to_global
(ptr addrspace
(4) %
[[ARG]])
34 //CHECK: store ptr addrspace(1) %[[RET]], ptr %glob
35 glob = to_global(gen);
37 //CHECK: %[[ARG:.*]] = addrspacecast ptr addrspace(1) %{{.*}} to ptr addrspace(4)
38 //CHECK: %[[RET:.*]] = call spir_func ptr addrspace(3) @__to_local(ptr addrspace(4) %[[ARG]])
39 //CHECK
: store ptr addrspace
(3) %
[[RET]], ptr %loc
42 //CHECK: %[[ARG:.*]] = addrspacecast ptr addrspace(3) %{{.*}} to ptr addrspace(4)
43 //CHECK: %[[RET:.*]] = call spir_func ptr addrspace(3) @__to_local(ptr addrspace(4) %[[ARG]])
44 //CHECK: store ptr addrspace(3) %[[RET]], ptr %loc
47 //CHECK
: %
[[ARG
:.
*]] = addrspacecast ptr %
{{.
*}} to ptr addrspace
(4)
48 //CHECK
: %
[[RET
:.
*]] = call spir_func ptr addrspace
(3) @__to_local
(ptr addrspace
(4) %
[[ARG]])
49 //CHECK: store ptr addrspace(3) %[[RET]], ptr %loc
52 //CHECK: %[[ARG:.*]] = load ptr addrspace(4), ptr %gen
53 //CHECK: %[[RET:.*]] = call spir_func ptr addrspace(3) @__to_local(ptr addrspace(4) %[[ARG]])
54 //CHECK
: store ptr addrspace
(3) %
[[RET]], ptr %loc
57 //CHECK: %[[ARG:.*]] = addrspacecast ptr addrspace(1) %{{.*}} to ptr addrspace(4)
58 //CHECK: %[[RET:.*]] = call spir_func ptr @__to_private(ptr addrspace(4) %[[ARG]])
59 //CHECK: store ptr %[[RET]], ptr %priv
60 priv
= to_private
(glob);
62 //CHECK
: %
[[ARG
:.
*]] = addrspacecast ptr addrspace
(3) %
{{.
*}} to ptr addrspace
(4)
63 //CHECK
: %
[[RET
:.
*]] = call spir_func ptr
@__to_private
(ptr addrspace
(4) %
[[ARG]])
64 //CHECK: store ptr %[[RET]], ptr %priv
65 priv = to_private(loc);
67 //CHECK: %[[ARG:.*]] = addrspacecast ptr %{{.*}} to ptr addrspace(4)
68 //CHECK: %[[RET:.*]] = call spir_func ptr @__to_private(ptr addrspace(4) %[[ARG]])
69 //CHECK
: store ptr %
[[RET]], ptr %priv
70 priv = to_private(priv);
72 //CHECK: %[[ARG:.*]] = load ptr addrspace(4), ptr %gen
73 //CHECK: %[[RET:.*]] = call spir_func ptr @__to_private(ptr addrspace(4) %[[ARG]])
74 //CHECK: store ptr %[[RET]], ptr %priv
75 priv
= to_private
(gen);
77 //CHECK
: %
[[ARG
:.
*]] = addrspacecast ptr %
{{.
*}} to ptr addrspace
(4)
78 //CHECK
: %
[[RET
:.
*]] = call spir_func ptr addrspace
(1) @__to_global
(ptr addrspace
(4) %
[[ARG]])
79 //CHECK: store ptr addrspace(1) %[[RET]], ptr %gA
81 GA gA = to_global(pA);
83 //CHECK-NOT: addrspacecast
85 //CHECK: call spir_func ptr addrspace(1) @__to_global(ptr addrspace(4) %{{.*}})
86 //CHECK-NOT: addrspacecast
89 global void *glob_v = to_global(gen_v);