[ELF] Reorder SectionBase/InputSectionBase members
[llvm-project.git] / clang / test / CodeGenOpenCL / to_addr_builtin.cl
blob49b210ce84df1bc2b1b749df3d01dacfd54ffc17
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
5 typedef struct {
6 float x,y,z;
7 } A;
8 typedef private A *PA;
9 typedef global A *GA;
11 void test(void) {
12 global int *glob;
13 local int *loc;
14 private int *priv;
15 generic int *gen;
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
40 loc = to_local(glob);
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
45 loc = to_local(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
50 loc = to_local(priv);
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
55 loc = to_local(gen);
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
80 PA pA;
81 GA gA = to_global(pA);
83 //CHECK-NOT: addrspacecast
84 //CHECK-NOT: bitcast
85 //CHECK: call spir_func ptr addrspace(1) @__to_global(ptr addrspace(4) %{{.*}})
86 //CHECK-NOT: addrspacecast
87 //CHECK-NOT: bitcast
88 generic void *gen_v;
89 global void *glob_v = to_global(gen_v);