1 // expected-no-diagnostics
5 ///==========================================================================///
6 // RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64
7 // RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
8 // RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64
9 // RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32
10 // RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
11 // RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32
13 // RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64
14 // RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
15 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64
16 // RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32
17 // RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
18 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32
20 // RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64
21 // RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
22 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64
23 // RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32
24 // RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
25 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32
27 // RUN: %clang_cc1 -DCK29 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s
28 // RUN: %clang_cc1 -DCK29 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
29 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s
30 // RUN: %clang_cc1 -DCK29 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s
31 // RUN: %clang_cc1 -DCK29 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
32 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s
33 // SIMD-ONLY28-NOT: {{__kmpc|__tgt}}
36 // CK29: [[SSA:%.+]] = type { ptr, ptr }
37 // CK29: [[SSB:%.+]] = type { ptr, ptr }
39 // CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
40 // CK29: [[SIZE00:@.+]] = private {{.*}}constant [2 x i64] [i64 0, i64 80]
41 // CK29: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710675]
43 // CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
44 // CK29: [[SIZE01:@.+]] = private {{.*}}constant [3 x i64] [i64 0, i64 {{8|4}}, i64 80]
45 // CK29: [[MTYPE01:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710672, i64 19]
47 // CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
48 // CK29: [[SIZE02:@.+]] = private {{.*}}constant [2 x i64] [i64 0, i64 80]
49 // CK29: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710675]
54 SSA(double *&pr
) : pr(pr
) {}
60 SSB(SSA
*&pr
) : pr(pr
) {}
62 // CK29-LABEL: define {{.+}}foo
66 // CK29-DAG: call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 -1, i32 -1, i32 0, ptr @.{{.+}}.region_id, ptr [[ARGS:%.+]])
67 // CK29-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2
68 // CK29-DAG: store ptr [[BPGEP:%.+]], ptr [[BPARG]]
69 // CK29-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3
70 // CK29-DAG: store ptr [[PGEP:%.+]], ptr [[PARG]]
71 // CK29-DAG: [[SARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 4
72 // CK29-DAG: store ptr [[SIZES:%.+]], ptr [[SARG]]
74 // CK29-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
75 // CK29-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
76 // CK29-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
78 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
79 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
80 // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
81 // CK29-DAG: store ptr [[VAR0:%.+]], ptr [[BP0]]
82 // CK29-DAG: store ptr [[VAR00:%.+]], ptr [[P0]]
83 // CK29-DAG: store i64 %{{.+}}, ptr [[S0]]
84 // CK29-DAG: [[VAR0]] = load ptr, ptr %
85 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], ptr [[VAR0]], i32 0, i32 0
87 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
88 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
89 // CK29-DAG: store ptr [[VAR1:%.+]], ptr [[BP2]]
90 // CK29-DAG: store ptr [[VAR2:%.+]], ptr [[P2]]
91 // CK29-DAG: [[VAR1]] = getelementptr inbounds [[SSA]], ptr %{{.+}}, i32 0, i32 1
92 // CK29-DAG: [[VAR2]] = getelementptr inbounds double, ptr [[VAR22:%.+]], i{{.+}} 0
93 // CK29-DAG: [[VAR22]] = load ptr, ptr %{{.+}},
95 // CK29: call void [[CALL00:@.+]](ptr {{[^,]+}})
96 #pragma omp target map(p->pr[:10])
102 // CK29-DAG: call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 -1, i32 -1, i32 0, ptr @.{{.+}}.region_id, ptr [[ARGS:%.+]])
103 // CK29-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2
104 // CK29-DAG: store ptr [[BPGEP:%.+]], ptr [[BPARG]]
105 // CK29-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3
106 // CK29-DAG: store ptr [[PGEP:%.+]], ptr [[PARG]]
107 // CK29-DAG: [[SARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 4
108 // CK29-DAG: store ptr [[SIZES:%.+]], ptr [[SARG]]
110 // CK29-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
111 // CK29-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
112 // CK29-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
114 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
115 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
116 // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
117 // CK29-DAG: store ptr [[VAR0]], ptr [[BP0]]
118 // CK29-DAG: store ptr [[VAR000:%.+]], ptr [[P0]]
119 // CK29-DAG: store i64 %{{.+}}, ptr [[S0]]
120 // CK29-DAG: [[VAR000]] = getelementptr inbounds [[SSB]], ptr [[VAR0]], i32 0, i32 1
122 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
123 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
124 // CK29-DAG: store ptr [[VAR000]], ptr [[BP1]]
125 // CK29-DAG: store ptr [[VAR1:%.+]], ptr [[P1]]
126 // CK29-DAG: [[VAR1]] = getelementptr inbounds [[SSA]], ptr %{{.+}}, i32 0, i32 0
128 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
129 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
130 // CK29-DAG: store ptr [[VAR1]], ptr [[BP2]]
131 // CK29-DAG: store ptr [[VAR2:%.+]], ptr [[P2]]
132 // CK29-DAG: [[VAR2]] = getelementptr inbounds double, ptr [[VAR22:%.+]], i{{.+}} 0
133 // CK29-DAG: [[VAR22]] = load ptr, ptr %{{.+}},
135 // CK29: call void [[CALL00:@.+]](ptr {{[^,]+}})
136 #pragma omp target map(pr->p[:10])
142 // CK29-DAG: call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 -1, i32 -1, i32 0, ptr @.{{.+}}.region_id, ptr [[ARGS:%.+]])
143 // CK29-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2
144 // CK29-DAG: store ptr [[BPGEP:%.+]], ptr [[BPARG]]
145 // CK29-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3
146 // CK29-DAG: store ptr [[PGEP:%.+]], ptr [[PARG]]
147 // CK29-DAG: [[SARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 4
148 // CK29-DAG: store ptr [[SIZES:%.+]], ptr [[SARG]]
150 // CK29-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
151 // CK29-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
152 // CK29-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
154 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
155 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
156 // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
157 // CK29-DAG: store ptr [[VAR0]], ptr [[BP0]]
158 // CK29-DAG: store ptr [[VAR000:%.+]], ptr [[P0]]
159 // CK29-DAG: store i64 %{{.+}}, ptr [[S0]]
160 // CK29-DAG: [[VAR000]] = getelementptr inbounds [[SSB]], ptr [[VAR0]], i32 0, i32 1
162 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
163 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
164 // CK29-DAG: store ptr [[VAR1:%.+]], ptr [[BP2]]
165 // CK29-DAG: store ptr [[VAR2:%.+]], ptr [[P2]]
166 // CK29-DAG: [[VAR1]] = getelementptr inbounds [[SSA]], ptr %{{.+}}, i32 0, i32 1
167 // CK29-DAG: [[VAR2]] = getelementptr inbounds double, ptr [[VAR22:%.+]], i{{.+}} 0
168 // CK29-DAG: [[VAR22]] = load ptr, ptr %{{.+}},
170 // CK29: call void [[CALL00:@.+]](ptr {{[^,]+}})
171 #pragma omp target map(pr->pr[:10])
178 void explicit_maps_member_pointer_references(SSA
*sap
) {