blob: 72589b530f5a15c0e8b5083878e3f49a9b37f0f6 [file] [log] [blame]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001// expected-no-diagnostics
2#ifndef HEADER
3#define HEADER
4
5///
6/// Implicit maps.
7///
8
9///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +000010// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
11// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
12// 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 %s --check-prefix CK1 --check-prefix CK1-64
13// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
14// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
15// 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 %s --check-prefix CK1 --check-prefix CK1-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +000016#ifdef CK1
17
Alexey Bataev6a71f362017-08-22 17:54:52 +000018class B {
19public:
20 static double VAR;
21 B() {
22 }
23
24 static void modify(int &res) {
25#pragma omp target map(tofrom \
26 : res)
27 {
28 res = B::VAR;
29 }
30 }
31};
32double B::VAR = 1.0;
33
Samuel Antao4af1b7b2015-12-02 17:44:43 +000034// CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +000035// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
36// CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000037
38// CK1-LABEL: implicit_maps_integer
39void implicit_maps_integer (int a){
Alexey Bataev6a71f362017-08-22 17:54:52 +000040 // CK1: call void{{.*}}modify
41 B::modify(a);
Samuel Antao4af1b7b2015-12-02 17:44:43 +000042 int i = a;
43
44 // CK1-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
45 // CK1-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
46 // CK1-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
47 // CK1-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
48 // CK1-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +000049 // CK1-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
50 // CK1-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
51 // CK1-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
52 // CK1-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000053 // CK1-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
54 // CK1-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
55 // CK1-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
56
57 // CK1: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
58 #pragma omp target
59 {
60 ++i;
61 }
62}
63
64// CK1: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
65// CK1: [[ADDR:%.+]] = alloca i[[sz]],
66// CK1: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
67// CK1-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
68// CK1-64: {{.+}} = load i32, i32* [[CADDR]],
69// CK1-32: {{.+}} = load i32, i32* [[ADDR]],
70
71#endif
72///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +000073// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-64
74// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
75// 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 %s --check-prefix CK2 --check-prefix CK2-64
76// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-32
77// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
78// 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 %s --check-prefix CK2 --check-prefix CK2-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +000079#ifdef CK2
80
Samuel Antao403ffd42016-07-27 22:49:49 +000081// CK2: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +000082// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
Samuel Antao403ffd42016-07-27 22:49:49 +000083// CK2: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
84// CK2: [[SIZES2:@.+]] = {{.+}}constant [1 x i[[sz]]] zeroinitializer
85// Map types: OMP_MAP_IS_PTR = 32
86// CK2: [[TYPES2:@.+]] = {{.+}}constant [1 x i32] [i32 32]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000087
Samuel Antao403ffd42016-07-27 22:49:49 +000088// CK2-LABEL: implicit_maps_reference
89void implicit_maps_reference (int a, int *b){
Samuel Antao4af1b7b2015-12-02 17:44:43 +000090 int &i = a;
91 // CK2-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
92 // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
93 // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
94 // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
95 // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +000096 // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
97 // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
98 // CK2-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
99 // CK2-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000100 // CK2-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
101 // CK2-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
102 // CK2-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
103
104 // CK2: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
105 #pragma omp target
106 {
107 ++i;
108 }
Samuel Antao403ffd42016-07-27 22:49:49 +0000109
110 int *&p = b;
111 // CK2-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}})
112 // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
113 // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
114 // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
115 // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000116 // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
117 // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
118 // CK2-DAG: store i32* [[VAL:%[^,]+]], i32** [[CBP1]]
119 // CK2-DAG: store i32* [[VAL]], i32** [[CP1]]
Samuel Antao403ffd42016-07-27 22:49:49 +0000120 // CK2-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]],
121 // CK2-DAG: [[ADDR]] = load i32**, i32*** [[ADDR2:%.+]],
122
123 // CK2: call void [[KERNEL2:@.+]](i32* [[VAL]])
124 #pragma omp target
125 {
126 ++p;
127 }
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000128}
129
130// CK2: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
131// CK2: [[ADDR:%.+]] = alloca i[[sz]],
132// CK2: [[REF:%.+]] = alloca i32*,
133// CK2: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
134// CK2-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
135// CK2-64: store i32* [[CADDR]], i32** [[REF]],
136// CK2-64: [[RVAL:%.+]] = load i32*, i32** [[REF]],
137// CK2-64: {{.+}} = load i32, i32* [[RVAL]],
138// CK2-32: store i32* [[ADDR]], i32** [[REF]],
139// CK2-32: [[RVAL:%.+]] = load i32*, i32** [[REF]],
140// CK2-32: {{.+}} = load i32, i32* [[RVAL]],
141
Samuel Antao403ffd42016-07-27 22:49:49 +0000142// CK2: define internal void [[KERNEL2]](i32* [[ARG:%.+]])
143// CK2: [[ADDR:%.+]] = alloca i32*,
144// CK2: [[REF:%.+]] = alloca i32**,
145// CK2: store i32* [[ARG]], i32** [[ADDR]],
146// CK2: store i32** [[ADDR]], i32*** [[REF]],
147// CK2: [[T:%.+]] = load i32**, i32*** [[REF]],
148// CK2: [[TT:%.+]] = load i32*, i32** [[T]],
149// CK2: getelementptr inbounds i32, i32* [[TT]], i32 1
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000150#endif
151///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000152// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-64
153// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
154// 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 %s --check-prefix CK3 --check-prefix CK3-64
155// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-32
156// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
157// 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 %s --check-prefix CK3 --check-prefix CK3-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000158#ifdef CK3
159
160// CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000161// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
162// CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000163
164// CK3-LABEL: implicit_maps_parameter
165void implicit_maps_parameter (int a){
166
167 // CK3-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
168 // CK3-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
169 // CK3-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
170 // CK3-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
171 // CK3-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000172 // CK3-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
173 // CK3-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
174 // CK3-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
175 // CK3-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000176 // CK3-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
177 // CK3-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
178 // CK3-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
179
180 // CK3: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
181 #pragma omp target
182 {
183 ++a;
184 }
185}
186
187// CK3: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
188// CK3: [[ADDR:%.+]] = alloca i[[sz]],
189// CK3: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
190// CK3-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
191// CK3-64: {{.+}} = load i32, i32* [[CADDR]],
192// CK3-32: {{.+}} = load i32, i32* [[ADDR]],
193
194#endif
195///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000196// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-64
197// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
198// 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 %s --check-prefix CK4 --check-prefix CK4-64
199// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-32
200// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
201// 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 %s --check-prefix CK4 --check-prefix CK4-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000202#ifdef CK4
203
204// CK4-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000205// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
206// CK4-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000207
208// CK4-LABEL: implicit_maps_nested_integer
209void implicit_maps_nested_integer (int a){
210 int i = a;
211
212 // The captures in parallel are by reference. Only the capture in target is by
213 // copy.
214
215 // CK4: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP1:@.+]] to void (i32*, i32*, ...)*), i32* {{.+}})
216 // CK4: define internal void [[KERNELP1]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
217 #pragma omp parallel
218 {
219 // CK4-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
220 // CK4-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
221 // CK4-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
222 // CK4-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
223 // CK4-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000224 // CK4-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
225 // CK4-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
226 // CK4-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
227 // CK4-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000228 // CK4-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
229 // CK4-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
230 // CK4-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
231
232 // CK4: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
233 #pragma omp target
234 {
235 #pragma omp parallel
236 {
237 ++i;
238 }
239 }
240 }
241}
242
243// CK4: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
244// CK4: [[ADDR:%.+]] = alloca i[[sz]],
245// CK4: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
246// CK4-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
247// CK4-64: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[CADDR]])
248// CK4-32: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[ADDR]])
249// CK4: define internal void [[KERNELP2]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
250#endif
251///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000252// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-64
253// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
254// 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 %s --check-prefix CK5 --check-prefix CK5-64
255// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-32
256// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
257// 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 %s --check-prefix CK5 --check-prefix CK5-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000258#ifdef CK5
259
260// CK5-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000261// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
262// CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000263
264// CK5-LABEL: implicit_maps_nested_integer_and_enum
265void implicit_maps_nested_integer_and_enum (int a){
266 enum Bla {
267 SomeEnum = 0x09
268 };
269
270 // Using an enum should not change the mapping information.
271 int i = a;
272
273 // CK5-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
274 // CK5-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
275 // CK5-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
276 // CK5-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
277 // CK5-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000278 // CK5-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
279 // CK5-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
280 // CK5-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
281 // CK5-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000282 // CK5-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
283 // CK5-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
284 // CK5-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
285
286 // CK5: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
287 #pragma omp target
288 {
289 ++i;
290 i += SomeEnum;
291 }
292}
293
294// CK5: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
295// CK5: [[ADDR:%.+]] = alloca i[[sz]],
296// CK5: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
297// CK5-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
298// CK5-64: {{.+}} = load i32, i32* [[CADDR]],
299// CK5-32: {{.+}} = load i32, i32* [[ADDR]],
300
301#endif
302///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000303// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-64
304// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
305// 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 %s --check-prefix CK6 --check-prefix CK6-64
306// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-32
307// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
308// 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 %s --check-prefix CK6 --check-prefix CK6-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000309#ifdef CK6
310// CK6-DAG: [[GBL:@Gi]] = global i32 0
311// CK6-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000312// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
313// CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000314
315// CK6-LABEL: implicit_maps_host_global
316int Gi;
317void implicit_maps_host_global (int a){
318 // CK6-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
319 // CK6-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
320 // CK6-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
321 // CK6-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
322 // CK6-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000323 // CK6-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
324 // CK6-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
325 // CK6-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
326 // CK6-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000327 // CK6-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
328 // CK6-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
329 // CK6-64-DAG: store i32 [[GBLVAL:%.+]], i32* [[CADDR]],
330 // CK6-64-DAG: [[GBLVAL]] = load i32, i32* [[GBL]],
331 // CK6-32-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[GBLVAL:%.+]],
332
333 // CK6: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
334 #pragma omp target
335 {
336 ++Gi;
337 }
338}
339
340// CK6: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
341// CK6: [[ADDR:%.+]] = alloca i[[sz]],
342// CK6: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
343// CK6-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
344// CK6-64: {{.+}} = load i32, i32* [[CADDR]],
345// CK6-32: {{.+}} = load i32, i32* [[ADDR]],
346
347#endif
348///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000349// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-64
350// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
351// 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 %s --check-prefix CK7 --check-prefix CK7-64
352// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-32
353// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
354// 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 %s --check-prefix CK7 --check-prefix CK7-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000355#ifdef CK7
356
357// For a 32-bit targets, the value doesn't fit the size of the pointer,
358// therefore it is passed by reference with a map 'to' specification.
359
360// CK7-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Samuel Antao6782e942016-05-26 16:48:10 +0000361// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
362// CK7-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Alexey Bataev2fd0cb22017-10-05 17:51:39 +0000363// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE_PTR | OMP_MAP_FIRST_REF = 161
364// CK7-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 161]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000365
366// CK7-LABEL: implicit_maps_double
367void implicit_maps_double (int a){
368 double d = (double)a;
369
370 // CK7-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
371 // CK7-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
372 // CK7-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
373 // CK7-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
374 // CK7-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
375
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000376 // CK7-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
377 // CK7-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
378 // CK7-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
379 // CK7-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000380 // CK7-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
381 // CK7-64-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to double*
382 // CK7-64-64-DAG: store double {{.+}}, double* [[CADDR]],
383
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000384 // CK7-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double**
385 // CK7-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
386 // CK7-32-DAG: store double* [[DECL:%[^,]+]], double** [[CBP1]]
387 // CK7-32-DAG: store double* [[DECL]], double** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000388
389 // CK7-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
390 // CK7-32: call void [[KERNEL:@.+]](double* [[DECL]])
391 #pragma omp target
392 {
393 d += 1.0;
394 }
395}
396
397// CK7-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
398// CK7-64: [[ADDR:%.+]] = alloca i[[sz]],
399// CK7-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
400// CK7-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to double*
401// CK7-64: {{.+}} = load double, double* [[CADDR]],
402
403// CK7-32: define internal void [[KERNEL]](double* {{.+}}[[ARG:%.+]])
404// CK7-32: [[ADDR:%.+]] = alloca double*,
405// CK7-32: store double* [[ARG]], double** [[ADDR]],
406// CK7-32: [[REF:%.+]] = load double*, double** [[ADDR]],
407// CK7-32: {{.+}} = load double, double* [[REF]],
408
409#endif
410///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000411// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK8
412// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
413// 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 %s --check-prefix CK8
414// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK8
415// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
416// 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 %s --check-prefix CK8
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000417#ifdef CK8
418
419// CK8-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000420// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
421// CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000422
423// CK8-LABEL: implicit_maps_float
424void implicit_maps_float (int a){
425 float f = (float)a;
426
427 // CK8-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
428 // CK8-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
429 // CK8-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
430 // CK8-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
431 // CK8-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000432 // CK8-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
433 // CK8-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
434 // CK8-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
435 // CK8-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000436 // CK8-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
437 // CK8-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
438 // CK8-DAG: store float {{.+}}, float* [[CADDR]],
439
440 // CK8: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
441 #pragma omp target
442 {
443 f += 1.0;
444 }
445}
446
447// CK8: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
448// CK8: [[ADDR:%.+]] = alloca i[[sz]],
449// CK8: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
450// CK8: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
451// CK8: {{.+}} = load float, float* [[CADDR]],
452
453#endif
454///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000455// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK9
456// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
457// 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 %s --check-prefix CK9
458// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK9
459// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
460// 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 %s --check-prefix CK9
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000461#ifdef CK9
462
463// CK9-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000464// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_MAP_IMPLICIT = 547
465// CK9-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000466
467// CK9-LABEL: implicit_maps_array
468void implicit_maps_array (int a){
469 double darr[2] = {(double)a, (double)a};
470
471 // CK9-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
472 // CK9-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
473 // CK9-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
474 // CK9-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
475 // CK9-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000476 // CK9-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [2 x double]**
477 // CK9-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [2 x double]**
478 // CK9-DAG: store [2 x double]* [[DECL:%[^,]+]], [2 x double]** [[CBP1]]
479 // CK9-DAG: store [2 x double]* [[DECL]], [2 x double]** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000480
481 // CK9: call void [[KERNEL:@.+]]([2 x double]* [[DECL]])
482 #pragma omp target
483 {
484 darr[0] += 1.0;
485 darr[1] += 1.0;
486 }
487}
488
489// CK9: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]])
490// CK9: [[ADDR:%.+]] = alloca [2 x double]*,
491// CK9: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]],
492// CK9: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]],
493// CK9: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i[[sz]] 0, i[[sz]] 0
494#endif
495///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000496// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK10
497// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
498// 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 %s --check-prefix CK10
499// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK10
500// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
501// 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 %s --check-prefix CK10
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000502#ifdef CK10
503
Samuel Antao6782e942016-05-26 16:48:10 +0000504// CK10-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] zeroinitializer
505// Map types: OMP_MAP_IS_FIRST = 32
506// CK10-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 32]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000507
508// CK10-LABEL: implicit_maps_pointer
509void implicit_maps_pointer (){
510 double *ddyn;
511
512 // CK10-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
513 // CK10-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
514 // CK10-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
515 // CK10-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
516 // CK10-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000517 // CK10-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double**
518 // CK10-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
519 // CK10-DAG: store double* [[PTR:%[^,]+]], double** [[CBP1]]
520 // CK10-DAG: store double* [[PTR]], double** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000521
522 // CK10: call void [[KERNEL:@.+]](double* [[PTR]])
523 #pragma omp target
524 {
525 ddyn[0] += 1.0;
526 ddyn[1] += 1.0;
527 }
528}
529
530// CK10: define internal void [[KERNEL]](double* {{.*}}[[ARG:%.+]])
531// CK10: [[ADDR:%.+]] = alloca double*,
532// CK10: store double* [[ARG]], double** [[ADDR]],
533// CK10: [[REF:%.+]] = load double*, double** [[ADDR]],
534// CK10: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] 0
535
536#endif
537///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000538// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK11
539// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
540// 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 %s --check-prefix CK11
541// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK11
542// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
543// 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 %s --check-prefix CK11
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000544#ifdef CK11
545
546// CK11-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000547// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_MAP_IMPLICIT = 547
548// CK11-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000549
550// CK11-LABEL: implicit_maps_double_complex
551void implicit_maps_double_complex (int a){
552 double _Complex dc = (double)a;
553
554 // CK11-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
555 // CK11-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
556 // CK11-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
557 // CK11-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
558 // CK11-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000559 // CK11-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { double, double }**
560 // CK11-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { double, double }**
561 // CK11-DAG: store { double, double }* [[PTR:%[^,]+]], { double, double }** [[CBP1]]
562 // CK11-DAG: store { double, double }* [[PTR]], { double, double }** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000563
564 // CK11: call void [[KERNEL:@.+]]({ double, double }* [[PTR]])
Alexey Bataev2fd0cb22017-10-05 17:51:39 +0000565 #pragma omp target defaultmap(tofrom:scalar)
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000566 {
567 dc *= dc;
568 }
569}
570
571// CK11: define internal void [[KERNEL]]({ double, double }* {{.*}}[[ARG:%.+]])
572// CK11: [[ADDR:%.+]] = alloca { double, double }*,
573// CK11: store { double, double }* [[ARG]], { double, double }** [[ADDR]],
574// CK11: [[REF:%.+]] = load { double, double }*, { double, double }** [[ADDR]],
575// CK11: {{.+}} = getelementptr inbounds { double, double }, { double, double }* [[REF]], i32 0, i32 0
576#endif
577///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000578// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-64
579// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
580// 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 %s --check-prefix CK12 --check-prefix CK12-64
581// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-32
582// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
583// 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 %s --check-prefix CK12 --check-prefix CK12-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000584#ifdef CK12
585
586// For a 32-bit targets, the value doesn't fit the size of the pointer,
587// therefore it is passed by reference with a map 'to' specification.
588
589// CK12-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Samuel Antao6782e942016-05-26 16:48:10 +0000590// Map types: OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
591// CK12-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Alexey Bataev2fd0cb22017-10-05 17:51:39 +0000592// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE_PTR | OMP_MAP_FIRST_REF = 161
593// CK12-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 161]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000594
595// CK12-LABEL: implicit_maps_float_complex
596void implicit_maps_float_complex (int a){
597 float _Complex fc = (float)a;
598
599 // CK12-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
600 // CK12-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
601 // CK12-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
602 // CK12-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
603 // CK12-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
604
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000605 // CK12-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
606 // CK12-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
607 // CK12-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
608 // CK12-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000609 // CK12-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
610 // CK12-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
611 // CK12-64-DAG: store { float, float } {{.+}}, { float, float }* [[CADDR]],
612
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000613 // CK12-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { float, float }**
614 // CK12-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { float, float }**
615 // CK12-32-DAG: store { float, float }* [[DECL:%[^,]+]], { float, float }** [[CBP1]]
616 // CK12-32-DAG: store { float, float }* [[DECL]], { float, float }** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000617
618 // CK12-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
619 // CK12-32: call void [[KERNEL:@.+]]({ float, float }* [[DECL]])
620 #pragma omp target
621 {
622 fc *= fc;
623 }
624}
625
626// CK12-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
627// CK12-64: [[ADDR:%.+]] = alloca i[[sz]],
628// CK12-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
629// CK12-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
630// CK12-64: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[CADDR]], i32 0, i32 0
631
632// CK12-32: define internal void [[KERNEL]]({ float, float }* {{.+}}[[ARG:%.+]])
633// CK12-32: [[ADDR:%.+]] = alloca { float, float }*,
634// CK12-32: store { float, float }* [[ARG]], { float, float }** [[ADDR]],
635// CK12-32: [[REF:%.+]] = load { float, float }*, { float, float }** [[ADDR]],
636// CK12-32: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[REF]], i32 0, i32 0
637#endif
638///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000639// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK13
640// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
641// 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 %s --check-prefix CK13
642// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK13
643// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
644// 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 %s --check-prefix CK13
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000645#ifdef CK13
646
647// We don't have a constant map size for VLAs.
648// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000649// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288 (vla size)
650// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288 (vla size)
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000651// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_IMPICIT_MAP = 547
652// CK13-DAG: [[TYPES:@.+]] = {{.+}}constant [3 x i32] [i32 288, i32 288, i32 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000653
654// CK13-LABEL: implicit_maps_variable_length_array
655void implicit_maps_variable_length_array (int a){
656 double vla[2][a];
657
658 // CK13-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 3, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i[[sz:64|32]]* [[SGEP:%[^,]+]], {{.+}}[[TYPES]]{{.+}})
659 // CK13-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
660 // CK13-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
661 // CK13-DAG: [[SGEP]] = getelementptr inbounds {{.+}}[[SS:%[^,]+]], i32 0, i32 0
662
663 // CK13-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
664 // CK13-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
665 // CK13-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000666 // CK13-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[sz]]*
667 // CK13-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[sz]]*
668 // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CBP0]]
669 // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000670 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S0]],
671
672 // CK13-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
673 // CK13-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
674 // CK13-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000675 // CK13-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
676 // CK13-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
677 // CK13-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
678 // CK13-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000679 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S1]],
680
681 // CK13-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
682 // CK13-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
683 // CK13-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000684 // CK13-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double**
685 // CK13-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
686 // CK13-DAG: store double* [[DECL:%.+]], double** [[CBP2]]
687 // CK13-DAG: store double* [[DECL]], double** [[CP2]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000688 // CK13-DAG: store i[[sz]] [[VALS2:%.+]], i[[sz]]* [[S2]],
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000689 // CK13-DAG: [[VALS2]] = mul nuw i[[sz]] %{{.+}}, 8
690
691 // CK13: call void [[KERNEL:@.+]](i[[sz]] {{.+}}, i[[sz]] {{.+}}, double* [[DECL]])
692 #pragma omp target
693 {
694 vla[1][3] += 1.0;
695 }
696}
697
Alexey Bataev2f5ed342016-10-13 09:52:46 +0000698// CK13: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.*}}[[ARG:%.+]])
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000699// CK13: [[ADDR0:%.+]] = alloca i[[sz]],
700// CK13: [[ADDR1:%.+]] = alloca i[[sz]],
701// CK13: [[ADDR2:%.+]] = alloca double*,
702// CK13: store i[[sz]] [[VLA0]], i[[sz]]* [[ADDR0]],
703// CK13: store i[[sz]] [[VLA1]], i[[sz]]* [[ADDR1]],
704// CK13: store double* [[ARG]], double** [[ADDR2]],
705// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR0]],
706// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR1]],
707// CK13: [[REF:%.+]] = load double*, double** [[ADDR2]],
708// CK13: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] %{{.+}}
709#endif
710///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000711// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-64
712// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
713// 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 %s --check-prefix CK14 --check-prefix CK14-64
714// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-32
715// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
716// 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 %s --check-prefix CK14 --check-prefix CK14-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000717#ifdef CK14
718
719// CK14-DAG: [[ST:%.+]] = type { i32, double }
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000720// CK14-DAG: [[SIZES:@.+]] = {{.+}}constant [3 x i[[sz:64|32]]] [i{{64|32}} 4, i{{64|32}} 8, i{{64|32}} 4]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000721// Map types:
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000722// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_IMPLICIT_MAP = 547
723// - OMP_MAP_TO + OMP_MAP_FROM + OMP_IMPLICIT_MAP = 515
Samuel Antao6782e942016-05-26 16:48:10 +0000724// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000725// CK14-DAG: [[TYPES:@.+]] = {{.+}}constant [3 x i32] [i32 547, i32 515, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000726
727class SSS {
728public:
729 int a;
730 double b;
731
732 void foo(int c) {
733 #pragma omp target
734 {
735 a += c;
736 b += (double)c;
737 }
738 }
739
740 SSS(int a, double b) : a(a), b(b) {}
741};
742
743// CK14-LABEL: implicit_maps_class
744void implicit_maps_class (int a){
745 SSS sss(a, (double)a);
746
747 // CK14: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000748 // CK14-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 3, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000749 // CK14-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
750 // CK14-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
751
752 // CK14-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
753 // CK14-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000754 // CK14-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000755 // CK14-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000756 // CK14-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]]
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000757 // CK14-DAG: store i32* %{{.+}}, i32** [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000758
759 // CK14-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
760 // CK14-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000761 // CK14-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
762 // CK14-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
763 // CK14-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]]
764 // CK14-DAG: store double* %{{.+}}, double** [[CP1]]
765
766 // CK14-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
767 // CK14-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000768 // CK14-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
769 // CK14-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
770 // CK14-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
771 // CK14-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000772 // CK14-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
773 // CK14-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
774 // CK14-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
775
776 // CK14: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
777 sss.foo(123);
778}
779
780// CK14: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
781// CK14: [[ADDR0:%.+]] = alloca [[ST]]*,
782// CK14: [[ADDR1:%.+]] = alloca i[[sz]],
783// CK14: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
784// CK14: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
785// CK14: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
786// CK14-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
787// CK14-64: {{.+}} = load i32, i32* [[CADDR1]],
788// CK14-32: {{.+}} = load i32, i32* [[ADDR1]],
789// CK14: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
790
791#endif
792///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000793// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-64
794// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
795// 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 %s --check-prefix CK15 --check-prefix CK15-64
796// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-32
797// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
798// 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 %s --check-prefix CK15 --check-prefix CK15-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000799#ifdef CK15
800
801// CK15: [[ST:%.+]] = type { i32, double, i32* }
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000802// CK15: [[SIZES:@.+]] = {{.+}}constant [5 x i[[sz:64|32]]] [i{{64|32}} 4, i{{64|32}} 8, i{{64|32}} {{8|4}}, i{{64|32}} 4, i{{64|32}} 4]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000803// Map types:
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000804// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_MAP_IMPLICIT = 547
Samuel Antao6782e942016-05-26 16:48:10 +0000805// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000806// CK15: [[TYPES:@.+]] = {{.+}}constant [5 x i32] [i32 547, i32 515, i32 512, i32 531, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000807
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000808// CK15: [[SIZES2:@.+]] = {{.+}}constant [5 x i[[sz]]] [i{{64|32}} 4, i{{64|32}} 8, i{{64|32}} {{8|4}}, i{{64|32}} 4, i{{64|32}} 4]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000809// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000810// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
811// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000812// CK15: [[TYPES2:@.+]] = {{.+}}constant [5 x i32] [i32 547, i32 515, i32 512, i32 531, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000813
814template<int x>
815class SSST {
816public:
817 int a;
818 double b;
819 int &r;
820
821 void foo(int c) {
822 #pragma omp target
823 {
824 a += c + x;
825 b += (double)(c + x);
826 r += x;
827 }
828 }
829 template<int y>
830 void bar(int c) {
831 #pragma omp target
832 {
833 a += c + x + y;
834 b += (double)(c + x + y);
835 r += x + y;
836 }
837 }
838
839 SSST(int a, double b, int &r) : a(a), b(b), r(r) {}
840};
841
842// CK15-LABEL: implicit_maps_templated_class
843void implicit_maps_templated_class (int a){
844 SSST<123> ssst(a, (double)a, a);
845
846 // CK15: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000847 // CK15-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 5, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000848 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
849 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
850
851 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
852 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000853 // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000854 // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000855 // CK15-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]]
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000856 // CK15-DAG: store i32* %{{.+}}, i32** [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000857
858 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
859 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000860 // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
861 // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
862 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]]
863 // CK15-DAG: store double* %{{.+}}, double** [[CP1]]
864
865 // CK15-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
866 // CK15-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
867 // CK15-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]**
868 // CK15-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32***
869 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]]
870 // CK15-DAG: store i32** %{{.+}}, i32*** [[CP2]]
871
872 // CK15-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3
873 // CK15-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3
874 // CK15-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i32***
875 // CK15-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32**
876 // CK15-DAG: store i32** %{{.+}}, i32*** [[CBP3]]
877 // CK15-DAG: store i32* %{{.+}}, i32** [[CP3]]
878
879 // CK15-DAG: [[BP4:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 4
880 // CK15-DAG: [[P4:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 4
881 // CK15-DAG: [[CBP4:%.+]] = bitcast i8** [[BP4]] to i[[sz]]*
882 // CK15-DAG: [[CP4:%.+]] = bitcast i8** [[P4]] to i[[sz]]*
883 // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP4]]
884 // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP4]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000885 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
886 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
887 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
888
889 // CK15: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
890 ssst.foo(456);
891
892 // CK15: define {{.*}}void @{{.+}}bar{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000893 // CK15-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 5, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000894 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
895 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
896
897 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
898 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000899 // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000900 // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
901 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP0]]
902 // CK15-DAG: store i32* %{{.+}}, i32** [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000903
904 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
905 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000906 // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
907 // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
908 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]]
909 // CK15-DAG: store double* %{{.+}}, double** [[CP1]]
910
911 // CK15-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
912 // CK15-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
913 // CK15-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]**
914 // CK15-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32***
915 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]]
916 // CK15-DAG: store i32** %{{.+}}, i32*** [[CP2]]
917
918 // CK15-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3
919 // CK15-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3
920 // CK15-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i32***
921 // CK15-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32**
922 // CK15-DAG: store i32** %{{.+}}, i32*** [[CBP3]]
923 // CK15-DAG: store i32* %{{.+}}, i32** [[CP3]]
924
925 // CK15-DAG: [[BP4:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 4
926 // CK15-DAG: [[P4:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 4
927 // CK15-DAG: [[CBP4:%.+]] = bitcast i8** [[BP4]] to i[[sz]]*
928 // CK15-DAG: [[CP4:%.+]] = bitcast i8** [[P4]] to i[[sz]]*
929 // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP4]]
930 // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP4]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000931 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
932 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
933 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
934
935 // CK15: call void [[KERNEL2:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
936 ssst.bar<210>(789);
937}
938
939// CK15: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
940// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
941// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
942// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
943// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
944// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
945// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
946// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
947// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
948// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
949
950// CK15: define internal void [[KERNEL2]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
951// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
952// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
953// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
954// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
955// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
956// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
957// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
958// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
959// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
960
961#endif
962///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000963// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-64
964// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
965// 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 %s --check-prefix CK16 --check-prefix CK16-64
966// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-32
967// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
968// 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 %s --check-prefix CK16 --check-prefix CK16-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000969#ifdef CK16
970
971// CK16-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
972// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000973// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
974// CK16-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000975
976template<int y>
977int foo(int d) {
978 int res = d;
979 #pragma omp target
980 {
981 res += y;
982 }
983 return res;
984}
985// CK16-LABEL: implicit_maps_templated_function
986void implicit_maps_templated_function (int a){
987 int i = a;
988
989 // CK16: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
990 // CK16-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
991 // CK16-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
992 // CK16-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
993
994 // CK16-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
995 // CK16-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000996 // CK16-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
997 // CK16-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
998 // CK16-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
999 // CK16-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001000 // CK16-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1001 // CK16-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1002 // CK16-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1003
1004 // CK16: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
1005 i = foo<543>(i);
1006}
1007// CK16: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
1008// CK16: [[ADDR:%.+]] = alloca i[[sz]],
1009// CK16: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
1010// CK16-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
1011// CK16-64: {{.+}} = load i32, i32* [[CADDR]],
1012// CK16-32: {{.+}} = load i32, i32* [[ADDR]],
1013
1014#endif
1015///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00001016// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK17
1017// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1018// 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 %s --check-prefix CK17
1019// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK17
1020// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1021// 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 %s --check-prefix CK17
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001022#ifdef CK17
1023
1024// CK17-DAG: [[ST:%.+]] = type { i32, double }
1025// CK17-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} {{16|12}}]
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001026// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_MAP_IMPLICIT = 547
1027// CK17-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001028
1029class SSS {
1030public:
1031 int a;
1032 double b;
1033};
1034
1035// CK17-LABEL: implicit_maps_struct
1036void implicit_maps_struct (int a){
1037 SSS s = {a, (double)a};
1038
1039 // CK17-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
1040 // CK17-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1041 // CK17-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1042 // CK17-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1043 // CK17-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001044 // CK17-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
1045 // CK17-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[ST]]**
1046 // CK17-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP1]]
1047 // CK17-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001048
1049 // CK17: call void [[KERNEL:@.+]]([[ST]]* [[DECL]])
1050 #pragma omp target
1051 {
1052 s.a += 1;
1053 s.b += 1.0;
1054 }
1055}
1056
1057// CK17: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]])
1058// CK17: [[ADDR:%.+]] = alloca [[ST]]*,
1059// CK17: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]],
1060// CK17: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]],
1061// CK17: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0
1062#endif
1063///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00001064// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-64
1065// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1066// 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 %s --check-prefix CK18 --check-prefix CK18-64
1067// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-32
1068// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1069// 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 %s --check-prefix CK18 --check-prefix CK18-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001070#ifdef CK18
1071
1072// CK18-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
1073// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +00001074// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
1075// CK18-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001076
1077template<typename T>
1078int foo(T d) {
1079 #pragma omp target
1080 {
1081 d += (T)1;
1082 }
1083 return d;
1084}
1085// CK18-LABEL: implicit_maps_template_type_capture
1086void implicit_maps_template_type_capture (int a){
1087 int i = a;
1088
1089 // CK18: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
1090 // CK18-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
1091 // CK18-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1092 // CK18-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1093
1094 // CK18-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1095 // CK18-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001096 // CK18-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
1097 // CK18-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
1098 // CK18-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
1099 // CK18-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001100 // CK18-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1101 // CK18-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1102 // CK18-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1103
1104 // CK18: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
1105 i = foo(i);
1106}
1107// CK18: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
1108// CK18: [[ADDR:%.+]] = alloca i[[sz]],
1109// CK18: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
1110// CK18-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
1111// CK18-64: {{.+}} = load i32, i32* [[CADDR]],
1112// CK18-32: {{.+}} = load i32, i32* [[ADDR]],
1113
1114#endif
Samuel Antao86ace552016-04-27 22:40:57 +00001115///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00001116// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-64
1117// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1118// 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 %s --check-prefix CK19 --check-prefix CK19-64
1119// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-32
1120// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1121// 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 %s --check-prefix CK19 --check-prefix CK19-32
Samuel Antao86ace552016-04-27 22:40:57 +00001122#ifdef CK19
1123
1124// CK19: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001125// CK19: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001126
Jonas Hahnfeldf7c4d7b2017-07-01 10:40:50 +00001127// CK19: [[SIZE00n:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
1128// CK19: [[MTYPE00n:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
1129
Samuel Antao86ace552016-04-27 22:40:57 +00001130// CK19: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00001131// CK19: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001132
1133// CK19: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001134// CK19: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001135
1136// CK19: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001137// CK19: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001138
1139// CK19: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00001140// CK19: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001141
1142// CK19: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001143// CK19: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001144
Samuel Antao6782e942016-05-26 16:48:10 +00001145// CK19: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001146
Samuel Antao6782e942016-05-26 16:48:10 +00001147// CK19: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001148
1149// CK19: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001150// CK19: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001151
1152// CK19: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00001153// CK19: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001154
1155// CK19: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001156// CK19: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001157
1158// CK19: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001159// CK19: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001160
1161// CK19: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001162// CK19: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001163
Samuel Antao6782e942016-05-26 16:48:10 +00001164// CK19: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001165
Samuel Antao6782e942016-05-26 16:48:10 +00001166// CK19: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001167
1168// CK19: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001169// CK19: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001170
Samuel Antao6782e942016-05-26 16:48:10 +00001171// CK19: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001172
1173// CK19: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001174// CK19: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001175
1176// CK19: [[SIZE18:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001177// CK19: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001178
Samuel Antao6782e942016-05-26 16:48:10 +00001179// CK19: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001180
1181// CK19: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001182// CK19: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001183
Samuel Antao6782e942016-05-26 16:48:10 +00001184// CK19: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001185
1186// CK19: [[SIZE22:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001187// CK19: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001188
1189// CK19: [[SIZE23:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001190// CK19: [[MTYPE23:@.+]] = private {{.*}}constant [1 x i32] [i32 39]
Samuel Antao86ace552016-04-27 22:40:57 +00001191
1192// CK19: [[SIZE24:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 480]
Samuel Antao6782e942016-05-26 16:48:10 +00001193// CK19: [[MTYPE24:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001194
1195// CK19: [[SIZE25:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00001196// CK19: [[MTYPE25:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001197
1198// CK19: [[SIZE26:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 24]
Samuel Antao6782e942016-05-26 16:48:10 +00001199// CK19: [[MTYPE26:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001200
1201// CK19: [[SIZE27:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001202// CK19: [[MTYPE27:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001203
1204// CK19: [[SIZE28:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00001205// CK19: [[MTYPE28:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001206
1207// CK19: [[SIZE29:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001208// CK19: [[MTYPE29:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001209
Samuel Antao6782e942016-05-26 16:48:10 +00001210// CK19: [[MTYPE30:@.+]] = private {{.*}}constant [4 x i32] [i32 288, i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001211
1212// CK19: [[SIZE31:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 40]
Samuel Antao6782e942016-05-26 16:48:10 +00001213// CK19: [[MTYPE31:@.+]] = private {{.*}}constant [4 x i32] [i32 288, i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001214
1215// CK19: [[SIZE32:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001216// CK19: [[MTYPE32:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001217
1218// CK19: [[SIZE33:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001219// CK19: [[MTYPE33:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001220
1221// CK19: [[SIZE34:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001222// CK19: [[MTYPE34:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001223
Samuel Antao6782e942016-05-26 16:48:10 +00001224// CK19: [[MTYPE35:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001225
1226// CK19: [[SIZE36:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 208]
Samuel Antao6782e942016-05-26 16:48:10 +00001227// CK19: [[MTYPE36:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001228
Samuel Antao6782e942016-05-26 16:48:10 +00001229// CK19: [[MTYPE37:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001230
Samuel Antao6782e942016-05-26 16:48:10 +00001231// CK19: [[MTYPE38:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001232
Samuel Antao6782e942016-05-26 16:48:10 +00001233// CK19: [[MTYPE39:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001234
Samuel Antao6782e942016-05-26 16:48:10 +00001235// CK19: [[MTYPE40:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001236
1237// CK19: [[SIZE41:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 208]
Samuel Antao6782e942016-05-26 16:48:10 +00001238// CK19: [[MTYPE41:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001239
1240// CK19: [[SIZE42:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 104]
Samuel Antao6782e942016-05-26 16:48:10 +00001241// CK19: [[MTYPE42:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001242
Samuel Antao6782e942016-05-26 16:48:10 +00001243// CK19: [[MTYPE43:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001244
1245// CK19-LABEL: explicit_maps_single
1246void explicit_maps_single (int ii){
1247 // Map of a scalar.
1248 int a = ii;
1249
1250 // Region 00
1251 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
1252 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1253 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1254
1255 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1256 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001257 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1258 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1259 // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
1260 // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001261
1262 // CK19: call void [[CALL00:@.+]](i32* {{[^,]+}})
1263 #pragma omp target map(alloc:a)
1264 {
1265 ++a;
1266 }
1267
Jonas Hahnfeldf7c4d7b2017-07-01 10:40:50 +00001268 // Map of a scalar in nested region.
1269 int b = a;
1270
1271 // Region 00n
1272 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00n]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00n]]{{.+}})
1273 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1274 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1275
1276 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1277 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1278 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1279 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1280 // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
1281 // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
1282
1283 // CK19: call void [[CALL00n:@.+]](i32* {{[^,]+}})
1284 #pragma omp target map(alloc:b)
1285 #pragma omp parallel
1286 {
1287 ++b;
1288 }
1289
Samuel Antao86ace552016-04-27 22:40:57 +00001290 // Map of an array.
1291 int arra[100];
1292
1293 // Region 01
1294 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
1295 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1296 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1297
1298 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1299 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001300 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1301 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]**
1302 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1303 // CK19-DAG: store [100 x i32]* [[VAR0]], [100 x i32]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001304
1305 // CK19: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
1306 #pragma omp target map(to:arra)
1307 {
1308 arra[50]++;
1309 }
1310
1311 // Region 02
1312 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
1313 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1314 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1315
1316 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1317 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001318 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1319 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1320 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1321 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001322 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 20
1323
1324 // CK19: call void [[CALL02:@.+]]([100 x i32]* {{[^,]+}})
1325 #pragma omp target map(from:arra[20:60])
1326 {
1327 arra[50]++;
1328 }
1329
1330 // Region 03
1331 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
1332 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1333 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1334
1335 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1336 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001337 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1338 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1339 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1340 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001341 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1342
1343 // CK19: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
1344 #pragma omp target map(tofrom:arra[:60])
1345 {
1346 arra[50]++;
1347 }
1348
1349 // Region 04
1350 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
1351 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1352 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1353
1354 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1355 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001356 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1357 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1358 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1359 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001360 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1361
1362 // CK19: call void [[CALL04:@.+]]([100 x i32]* {{[^,]+}})
1363 #pragma omp target map(alloc:arra[:])
1364 {
1365 arra[50]++;
1366 }
1367
1368 // Region 05
1369 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
1370 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1371 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1372
1373 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1374 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001375 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1376 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1377 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1378 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001379 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 15
1380
1381 // CK19: call void [[CALL05:@.+]]([100 x i32]* {{[^,]+}})
1382 #pragma omp target map(to:arra[15])
1383 {
1384 arra[15]++;
1385 }
1386
1387 // Region 06
1388 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
1389 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1390 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1391 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1392
1393 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1394 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1395 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001396 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1397 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1398 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1399 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001400 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001401 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1402 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1403
1404 // CK19: call void [[CALL06:@.+]]([100 x i32]* {{[^,]+}})
1405 #pragma omp target map(tofrom:arra[ii:ii+23])
1406 {
1407 arra[50]++;
1408 }
1409
1410 // Region 07
1411 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
1412 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1413 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1414 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1415
1416 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1417 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1418 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001419 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1420 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1421 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1422 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001423 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001424 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1425 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1426
1427 // CK19: call void [[CALL07:@.+]]([100 x i32]* {{[^,]+}})
1428 #pragma omp target map(alloc:arra[:ii])
1429 {
1430 arra[50]++;
1431 }
1432
1433 // Region 08
1434 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
1435 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1436 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1437
1438 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1439 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001440 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1441 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1442 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1443 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001444 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1445
1446 // CK19: call void [[CALL08:@.+]]([100 x i32]* {{[^,]+}})
1447 #pragma omp target map(tofrom:arra[ii])
1448 {
1449 arra[15]++;
1450 }
1451
1452 // Map of a pointer.
1453 int *pa;
1454
1455 // Region 09
1456 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
1457 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1458 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1459
1460 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1461 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001462 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
1463 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
1464 // CK19-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]]
1465 // CK19-DAG: store i32** [[VAR0]], i32*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001466
1467 // CK19: call void [[CALL09:@.+]](i32** {{[^,]+}})
1468 #pragma omp target map(from:pa)
1469 {
1470 pa[50]++;
1471 }
1472
1473 // Region 10
1474 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
1475 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1476 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1477
1478 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1479 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001480 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1481 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1482 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1483 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001484 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1485 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 20
1486 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1487
1488 // CK19: call void [[CALL10:@.+]](i32* {{[^,]+}})
1489 #pragma omp target map(tofrom:pa[20:60])
1490 {
1491 pa[50]++;
1492 }
1493
1494 // Region 11
1495 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
1496 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1497 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1498
1499 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1500 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001501 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1502 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1503 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1504 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001505 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1506 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1507 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1508
1509 // CK19: call void [[CALL11:@.+]](i32* {{[^,]+}})
1510 #pragma omp target map(alloc:pa[:60])
1511 {
1512 pa[50]++;
1513 }
1514
1515 // Region 12
1516 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
1517 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1518 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1519
1520 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1521 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001522 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1523 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1524 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1525 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001526 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1527 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 15
1528 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1529
1530 // CK19: call void [[CALL12:@.+]](i32* {{[^,]+}})
1531 #pragma omp target map(to:pa[15])
1532 {
1533 pa[15]++;
1534 }
1535
1536 // Region 13
1537 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
1538 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1539 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1540 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1541
1542 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1543 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1544 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001545 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1546 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1547 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1548 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001549 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001550 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1551 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1552 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1553 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1554
1555 // CK19: call void [[CALL13:@.+]](i32* {{[^,]+}})
1556 #pragma omp target map(alloc:pa[ii-23:ii])
1557 {
1558 pa[50]++;
1559 }
1560
1561 // Region 14
1562 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
1563 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1564 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1565 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1566
1567 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1568 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1569 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001570 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1571 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1572 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1573 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001574 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001575 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1576 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1577 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1578 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1579
1580 // CK19: call void [[CALL14:@.+]](i32* {{[^,]+}})
1581 #pragma omp target map(to:pa[:ii])
1582 {
1583 pa[50]++;
1584 }
1585
1586 // Region 15
1587 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
1588 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1589 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1590
1591 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1592 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001593 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1594 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1595 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1596 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001597 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1598 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1599 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1600
1601 // CK19: call void [[CALL15:@.+]](i32* {{[^,]+}})
1602 #pragma omp target map(from:pa[ii+12])
1603 {
1604 pa[15]++;
1605 }
1606
1607 // Map of a variable-size array.
1608 int va[ii];
1609
1610 // Region 16
1611 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE16]]{{.+}})
1612 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1613 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1614 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1615
1616 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1617 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1618 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001619 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1620 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1621 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1622 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001623 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001624
1625 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1626 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1627 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001628 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1629 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1630 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1631 // CK19-DAG: store i32* [[VAR1]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001632 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001633 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1634
1635 // CK19: call void [[CALL16:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1636 #pragma omp target map(to:va)
1637 {
1638 va[50]++;
1639 }
1640
1641 // Region 17
1642 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
1643 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1644 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1645
1646 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1647 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001648 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1649 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1650 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1651 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001652
1653 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1654 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001655 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1656 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1657 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1658 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001659 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 20
1660
1661 // CK19: call void [[CALL17:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1662 #pragma omp target map(from:va[20:60])
1663 {
1664 va[50]++;
1665 }
1666
1667 // Region 18
1668 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE18]]{{.+}})
1669 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1670 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1671
1672 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1673 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001674 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1675 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1676 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1677 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001678
1679 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1680 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001681 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1682 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1683 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1684 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001685 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1686
1687 // CK19: call void [[CALL18:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1688 #pragma omp target map(tofrom:va[:60])
1689 {
1690 va[50]++;
1691 }
1692
1693 // Region 19
1694 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
1695 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1696 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1697 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1698
1699 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1700 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1701 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001702 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1703 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1704 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1705 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001706 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001707
1708 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1709 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1710 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001711 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1712 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1713 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1714 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001715 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001716 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1717 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1718
1719 // CK19: call void [[CALL19:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1720 #pragma omp target map(alloc:va[:])
1721 {
1722 va[50]++;
1723 }
1724
1725 // Region 20
1726 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
1727 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1728 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1729
1730 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1731 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001732 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1733 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1734 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1735 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001736
1737 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1738 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001739 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1740 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1741 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1742 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001743 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 15
1744
1745 // CK19: call void [[CALL20:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1746 #pragma omp target map(to:va[15])
1747 {
1748 va[15]++;
1749 }
1750
1751 // Region 21
1752 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
1753 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1754 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1755 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1756
1757 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1758 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1759 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001760 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1761 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1762 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1763 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001764 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001765
1766 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1767 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1768 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001769 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1770 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1771 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1772 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001773 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001774 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1775 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1776
1777 // CK19: call void [[CALL21:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1778 #pragma omp target map(tofrom:va[ii:ii+23])
1779 {
1780 va[50]++;
1781 }
1782
1783 // Region 22
1784 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE22]]{{.+}})
1785 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1786 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1787
1788 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1789 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001790 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1791 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1792 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1793 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001794
1795 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1796 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001797 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1798 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1799 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1800 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001801 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1802
1803 // CK19: call void [[CALL22:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1804 #pragma omp target map(tofrom:va[ii])
1805 {
1806 va[15]++;
1807 }
1808
1809 // Always.
1810 // Region 23
1811 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE23]]{{.+}})
1812 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1813 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1814
1815 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1816 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001817 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1818 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1819 // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
1820 // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001821
1822 // CK19: call void [[CALL23:@.+]](i32* {{[^,]+}})
1823 #pragma omp target map(always, tofrom: a)
1824 {
1825 a++;
1826 }
1827
1828 // Multidimensional arrays.
1829 int marr[4][5][6];
1830 int ***mptr;
1831
1832 // Region 24
1833 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE24]]{{.+}})
1834 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1835 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1836
1837 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1838 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001839 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
1840 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [4 x [5 x [6 x i32]]]**
1841 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
1842 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0]], [4 x [5 x [6 x i32]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001843
1844 // CK19: call void [[CALL24:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1845 #pragma omp target map(tofrom: marr)
1846 {
1847 marr[1][2][3]++;
1848 }
1849
1850 // Region 25
1851 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE25]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE25]]{{.+}})
1852 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1853 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1854
1855 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1856 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001857 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
1858 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1859 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
1860 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001861 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 2
1862 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1863 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1864
1865 // CK19: call void [[CALL25:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1866 #pragma omp target map(tofrom: marr[1][2][2:4])
1867 {
1868 marr[1][2][3]++;
1869 }
1870
1871 // Region 26
1872 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE26]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE26]]{{.+}})
1873 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1874 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1875
1876 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1877 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001878 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
1879 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1880 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
1881 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001882 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 0
1883 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1884 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1885
1886 // CK19: call void [[CALL26:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1887 #pragma omp target map(tofrom: marr[1][2][:])
1888 {
1889 marr[1][2][3]++;
1890 }
1891
1892 // Region 27
1893 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE27]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE27]]{{.+}})
1894 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1895 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1896
1897 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1898 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001899 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
1900 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1901 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
1902 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001903 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 3
1904 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1905 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1906
1907 // CK19: call void [[CALL27:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1908 #pragma omp target map(tofrom: marr[1][2][3])
1909 {
1910 marr[1][2][3]++;
1911 }
1912
1913 // Region 28
1914 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE28]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE28]]{{.+}})
1915 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1916 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1917
1918 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1919 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001920 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32****
1921 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32****
1922 // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]]
1923 // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001924 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
1925 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
1926 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
1927
1928 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1929 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001930 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32****
1931 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32***
1932 // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]]
1933 // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001934 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
1935 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
1936 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
1937 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
1938
1939 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1940 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001941 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32***
1942 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
1943 // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]]
1944 // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00001945 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 2
1946 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
1947 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
1948 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
1949 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
1950 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
1951
1952 // CK19: call void [[CALL28:@.+]](i32*** {{[^,]+}})
1953 #pragma omp target map(tofrom: mptr[1][2][2:4])
1954 {
1955 mptr[1][2][3]++;
1956 }
1957
1958 // Region 29
1959 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE29]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE29]]{{.+}})
1960 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1961 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1962
1963 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1964 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001965 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32****
1966 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32****
1967 // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]]
1968 // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001969 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
1970 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
1971 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
1972
1973 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1974 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001975 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32****
1976 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32***
1977 // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]]
1978 // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001979 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
1980 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
1981 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
1982 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
1983
1984 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1985 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001986 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32***
1987 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
1988 // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]]
1989 // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00001990 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 3
1991 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
1992 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
1993 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
1994 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
1995 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
1996
1997 // CK19: call void [[CALL29:@.+]](i32*** {{[^,]+}})
1998 #pragma omp target map(tofrom: mptr[1][2][3])
1999 {
2000 mptr[1][2][3]++;
2001 }
2002
2003 // Multidimensional VLA.
2004 double mva[23][ii][ii+5];
2005
2006 // Region 30
2007 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE30]]{{.+}})
2008 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2009 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2010 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2011 //
2012 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2013 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2014 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002015 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2016 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2017 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]]
2018 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002019 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2020 //
2021 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2022 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2023 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002024 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2025 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2026 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2027 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002028 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002029 // CK19-64-DAG: [[VAR1]] = zext i32 %{{[^,]+}} to i64
2030 // CK19-64-DAG: [[VAR11]] = zext i32 %{{[^,]+}} to i64
2031 //
2032 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2033 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2034 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002035 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]*
2036 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]*
2037 // CK19-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]]
2038 // CK19-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002039 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002040 // CK19-64-DAG: [[VAR2]] = zext i32 %{{[^,]+}} to i64
2041 // CK19-64-DAG: [[VAR22]] = zext i32 %{{[^,]+}} to i64
2042 //
2043 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
2044 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
2045 // CK19-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002046 // CK19-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double**
2047 // CK19-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
2048 // CK19-DAG: store double* [[VAR3:%.+]], double** [[CBP3]]
2049 // CK19-DAG: store double* [[VAR3]], double** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00002050 // CK19-DAG: store i[[Z]] [[CSVAL3:%[^,]+]], i[[Z]]* [[S3]]
Samuel Antao86ace552016-04-27 22:40:57 +00002051 // CK19-DAG: [[CSVAL3]] = mul nuw i[[Z]] %{{[^,]+}}, {{8|4}}
2052
2053 // CK19: call void [[CALL30:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
2054 #pragma omp target map(tofrom: mva)
2055 {
2056 mva[1][2][3]++;
2057 }
2058
2059 // Region 31
2060 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE31]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE31]]{{.+}})
2061 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2062 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2063 //
2064 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2065 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002066 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2067 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2068 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]]
2069 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002070 //
2071 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2072 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002073 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2074 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2075 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2076 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002077 //
2078 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2079 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002080 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]*
2081 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]*
2082 // CK19-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]]
2083 // CK19-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002084 //
2085 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
2086 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002087 // CK19-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double**
2088 // CK19-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
2089 // CK19-DAG: store double* [[VAR3:%.+]], double** [[CBP3]]
2090 // CK19-DAG: store double* [[SEC3:%.+]], double** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00002091 // CK19-DAG: [[SEC3]] = getelementptr {{.*}}double* [[SEC33:%.+]], i[[Z]] 0
2092 // CK19-DAG: [[SEC33]] = getelementptr {{.*}}double* [[SEC333:%.+]], i[[Z]] [[IDX3:%.+]]
2093 // CK19-DAG: [[IDX3]] = mul nsw i[[Z]] %{{[^,]+}}, %{{[^,]+}}
2094 // CK19-DAG: [[SEC333]] = getelementptr {{.*}}double* [[VAR3]], i[[Z]] [[IDX33:%.+]]
2095 // CK19-DAG: [[IDX33]] = mul nsw i[[Z]] 1, %{{[^,]+}}
2096
2097 // CK19: call void [[CALL31:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
2098 #pragma omp target map(tofrom: mva[1][ii-2][:5])
2099 {
2100 mva[1][2][3]++;
2101 }
2102
2103 // Multidimensional array sections.
2104 double marras[11][12][13];
2105 double mvlaas[11][ii][13];
2106 double ***mptras;
2107
2108 // Region 32
2109 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE32]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE32]]{{.+}})
2110 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2111 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2112
2113 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2114 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002115 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2116 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [11 x [12 x [13 x double]]]**
2117 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2118 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0]], [11 x [12 x [13 x double]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002119
2120 // CK19: call void [[CALL32:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2121 #pragma omp target map(marras)
2122 {
2123 marras[1][2][3]++;
2124 }
2125
2126 // Region 33
2127 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE33]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE33]]{{.+}})
2128 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2129 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2130
2131 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2132 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002133 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2134 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]**
2135 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2136 // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002137 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2138
2139 // CK19: call void [[CALL33:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2140 #pragma omp target map(marras[:])
2141 {
2142 marras[1][2][3]++;
2143 }
2144
2145 // Region 34
2146 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE34]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE34]]{{.+}})
2147 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2148 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2149
2150 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2151 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002152 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2153 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]**
2154 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2155 // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002156 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2157
2158 // CK19: call void [[CALL34:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2159 #pragma omp target map(marras[:][:][:])
2160 {
2161 marras[1][2][3]++;
2162 }
2163
2164 // Region 35
2165 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE35]]{{.+}})
2166 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2167 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2168 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2169 //
2170 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2171 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2172 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2173
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002174 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2175 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2176 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2177 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002178 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002179 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2180 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2181 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2182
2183 // CK19: call void [[CALL35:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2184 #pragma omp target map(marras[1][:ii][:])
2185 {
2186 marras[1][2][3]++;
2187 }
2188
2189 // Region 36
2190 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE36]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE36]]{{.+}})
2191 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2192 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2193
2194 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2195 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002196 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2197 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2198 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2199 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002200 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i{{.+}} 0
2201 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 0
2202 // CK19-DAG: [[SEC000]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2203
2204 // CK19: call void [[CALL36:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2205 #pragma omp target map(marras[:1][:2][:13])
2206 {
2207 marras[1][2][3]++;
2208 }
2209
2210 // Region 37
2211 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE37]]{{.+}})
2212 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2213 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2214 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2215 //
2216 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2217 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2218 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002219 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2220 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2221 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2222 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002223 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2224 //
2225 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2226 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2227 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002228 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2229 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2230 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2231 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002232 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002233 //
2234 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2235 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2236 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002237 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2238 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2239 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2240 // CK19-DAG: store [13 x double]* [[VAR2]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002241 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002242 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2243
2244 // CK19: call void [[CALL37:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2245 #pragma omp target map(mvlaas)
2246 {
2247 mvlaas[1][2][3]++;
2248 }
2249
2250 // Region 38
2251 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE38]]{{.+}})
2252 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2253 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2254 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2255 //
2256 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2257 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2258 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002259 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2260 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2261 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2262 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002263 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2264 //
2265 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2266 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2267 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002268 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2269 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2270 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2271 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002272 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002273 //
2274 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2275 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2276 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002277 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2278 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2279 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2280 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002281 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002282 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2283 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2284 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2285
2286 // CK19: call void [[CALL38:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2287 #pragma omp target map(mvlaas[:])
2288 {
2289 mvlaas[1][2][3]++;
2290 }
2291
2292 // Region 39
2293 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE39]]{{.+}})
2294 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2295 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2296 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2297 //
2298 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2299 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2300 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002301 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2302 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2303 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2304 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002305 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2306 //
2307 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2308 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2309 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002310 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2311 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2312 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2313 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002314 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002315 //
2316 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2317 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2318 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002319 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2320 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2321 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2322 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002323 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002324 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2325 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2326 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2327
2328 // CK19: call void [[CALL39:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2329 #pragma omp target map(mvlaas[:][:][:])
2330 {
2331 mvlaas[1][2][3]++;
2332 }
2333
2334 // Region 40
2335 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE40]]{{.+}})
2336 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2337 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2338 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2339 //
2340 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2341 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2342 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002343 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2344 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2345 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2346 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002347 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2348 //
2349 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2350 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2351 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002352 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2353 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2354 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2355 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002356 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002357 //
2358 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2359 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2360 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002361 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2362 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2363 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2364 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002365 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002366 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2367 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2368 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 1, %{{[^,]+}}
2369
2370 // CK19: call void [[CALL40:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2371 #pragma omp target map(mvlaas[1][:ii][:])
2372 {
2373 mvlaas[1][2][3]++;
2374 }
2375
2376 // Region 41
2377 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE41]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE41]]{{.+}})
2378 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2379 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2380 //
2381 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2382 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002383 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2384 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2385 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2386 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002387 //
2388 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2389 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002390 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2391 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2392 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2393 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002394 //
2395 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2396 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002397 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2398 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2399 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2400 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002401 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2402 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2403 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2404
2405 // CK19: call void [[CALL41:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2406 #pragma omp target map(mvlaas[:1][:2][:13])
2407 {
2408 mvlaas[1][2][3]++;
2409 }
2410
2411 // Region 42
2412 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE42]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE42]]{{.+}})
2413 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2414 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2415
2416 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2417 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002418 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to double****
2419 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double****
2420 // CK19-DAG: store double*** [[VAR0:%.+]], double**** [[CBP0]]
2421 // CK19-DAG: store double*** [[SEC0:%.+]], double**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002422 // CK19-DAG: [[VAR0]] = load double***, double**** [[PTR:%[^,]+]],
2423 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}double*** [[SEC00:[^,]+]], i{{.+}} 0
2424 // CK19-DAG: [[SEC00]] = load double***, double**** [[PTR]],
2425
2426 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2427 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002428 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double****
2429 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double***
2430 // CK19-DAG: store double*** [[SEC0]], double**** [[CBP1]]
2431 // CK19-DAG: store double** [[SEC1:%.+]], double*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002432 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}double** [[SEC11:[^,]+]], i{{.+}} 2
2433 // CK19-DAG: [[SEC11]] = load double**, double*** [[SEC111:%[^,]+]],
2434 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}double*** [[SEC1111:[^,]+]], i{{.+}} 0
2435 // CK19-DAG: [[SEC1111]] = load double***, double**** [[PTR]],
2436
2437 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2438 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002439 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double***
2440 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
2441 // CK19-DAG: store double** [[SEC1]], double*** [[CBP2]]
2442 // CK19-DAG: store double* [[SEC2:%.+]], double** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002443 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}double* [[SEC22:[^,]+]], i{{.+}} 0
2444 // CK19-DAG: [[SEC22]] = load double*, double** [[SEC222:%[^,]+]],
2445 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}double** [[SEC2222:[^,]+]], i{{.+}} 2
2446 // CK19-DAG: [[SEC2222]] = load double**, double*** [[SEC22222:%[^,]+]],
2447 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}double*** [[SEC222222:[^,]+]], i{{.+}} 0
2448 // CK19-DAG: [[SEC222222]] = load double***, double**** [[PTR]],
2449
2450 // CK19: call void [[CALL42:@.+]](double*** {{[^,]+}})
2451 #pragma omp target map(mptras[:1][2][:13])
2452 {
2453 mptras[1][2][3]++;
2454 }
2455
2456 // Region 43 - the memory is not contiguous for this map - will map the whole last dimension.
2457 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE43]]{{.+}})
2458 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2459 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2460 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2461 //
2462 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2463 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2464 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2465
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002466 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2467 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2468 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2469 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002470 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002471 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2472 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2473 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2474
2475 // CK19: call void [[CALL43:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2476 #pragma omp target map(marras[1][:ii][1:])
2477 {
2478 marras[1][2][3]++;
2479 }
2480
2481}
2482
2483// CK19: define {{.+}}[[CALL00]]
Jonas Hahnfeldf7c4d7b2017-07-01 10:40:50 +00002484// CK19: define {{.+}}[[CALL00n]]
Samuel Antao86ace552016-04-27 22:40:57 +00002485// CK19: define {{.+}}[[CALL01]]
2486// CK19: define {{.+}}[[CALL02]]
2487// CK19: define {{.+}}[[CALL03]]
2488// CK19: define {{.+}}[[CALL04]]
2489// CK19: define {{.+}}[[CALL05]]
2490// CK19: define {{.+}}[[CALL06]]
2491// CK19: define {{.+}}[[CALL07]]
2492// CK19: define {{.+}}[[CALL08]]
2493// CK19: define {{.+}}[[CALL09]]
2494// CK19: define {{.+}}[[CALL10]]
2495// CK19: define {{.+}}[[CALL11]]
2496// CK19: define {{.+}}[[CALL12]]
2497// CK19: define {{.+}}[[CALL13]]
2498// CK19: define {{.+}}[[CALL14]]
2499// CK19: define {{.+}}[[CALL15]]
2500// CK19: define {{.+}}[[CALL16]]
2501// CK19: define {{.+}}[[CALL17]]
2502// CK19: define {{.+}}[[CALL18]]
2503// CK19: define {{.+}}[[CALL19]]
2504// CK19: define {{.+}}[[CALL20]]
2505// CK19: define {{.+}}[[CALL21]]
2506// CK19: define {{.+}}[[CALL22]]
2507// CK19: define {{.+}}[[CALL23]]
2508// CK19: define {{.+}}[[CALL24]]
2509// CK19: define {{.+}}[[CALL25]]
2510// CK19: define {{.+}}[[CALL26]]
2511// CK19: define {{.+}}[[CALL27]]
2512// CK19: define {{.+}}[[CALL28]]
2513// CK19: define {{.+}}[[CALL29]]
2514// CK19: define {{.+}}[[CALL30]]
2515// CK19: define {{.+}}[[CALL31]]
2516// CK19: define {{.+}}[[CALL32]]
2517// CK19: define {{.+}}[[CALL33]]
2518// CK19: define {{.+}}[[CALL34]]
2519// CK19: define {{.+}}[[CALL35]]
2520// CK19: define {{.+}}[[CALL36]]
2521// CK19: define {{.+}}[[CALL37]]
2522// CK19: define {{.+}}[[CALL38]]
2523// CK19: define {{.+}}[[CALL39]]
2524// CK19: define {{.+}}[[CALL40]]
2525// CK19: define {{.+}}[[CALL41]]
2526// CK19: define {{.+}}[[CALL42]]
2527// CK19: define {{.+}}[[CALL43]]
2528
2529#endif
2530///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00002531// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-64
2532// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2533// 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 %s --check-prefix CK20 --check-prefix CK20-64
2534// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-32
2535// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2536// 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 %s --check-prefix CK20 --check-prefix CK20-32
Samuel Antao86ace552016-04-27 22:40:57 +00002537#ifdef CK20
2538
2539// CK20: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002540// CK20: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002541
2542// CK20: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002543// CK20: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002544
2545// CK20: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002546// CK20: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002547
2548// CK20: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 12]
Samuel Antao6782e942016-05-26 16:48:10 +00002549// CK20: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002550
2551// CK20-LABEL: explicit_maps_references_and_function_args
2552void explicit_maps_references_and_function_args (int a, float b, int (&c)[10], float *d){
2553
2554 int &aa = a;
2555 float &bb = b;
2556 int (&cc)[10] = c;
2557 float *&dd = d;
2558
2559 // Region 00
2560 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2561 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2562 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2563
2564 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2565 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002566 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2567 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2568 // CK20-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
2569 // CK20-DAG: store i32* [[RVAR00:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002570 // CK20-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2571 // CK20-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2572
2573 // CK20: call void [[CALL00:@.+]](i32* {{[^,]+}})
2574 #pragma omp target map(to:aa)
2575 {
2576 aa += 1;
2577 }
2578
2579 // Region 01
2580 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2581 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2582 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2583
2584 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2585 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002586 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]**
2587 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2588 // CK20-DAG: store [10 x i32]* [[RVAR0:%.+]], [10 x i32]** [[CBP0]]
2589 // CK20-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002590 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[RVAR00:%.+]], i{{.+}} 0, i{{.+}} 0
2591 // CK20-DAG: [[RVAR0]] = load [10 x i32]*, [10 x i32]** [[VAR0:%[^,]+]]
2592 // CK20-DAG: [[RVAR00]] = load [10 x i32]*, [10 x i32]** [[VAR0]]
2593
2594 // CK20: call void [[CALL01:@.+]]([10 x i32]* {{[^,]+}})
2595 #pragma omp target map(to:cc[:5])
2596 {
2597 cc[3] += 1;
2598 }
2599
2600 // Region 02
2601 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
2602 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2603 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2604
2605 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2606 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002607 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
2608 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
2609 // CK20-DAG: store float* [[VAR0:%.+]], float** [[CBP0]]
2610 // CK20-DAG: store float* [[VAR0]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002611
2612 // CK20: call void [[CALL02:@.+]](float* {{[^,]+}})
2613 #pragma omp target map(from:b)
2614 {
2615 b += 1.0f;
2616 }
2617
2618 // Region 03
2619 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2620 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2621 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2622
2623 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2624 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002625 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
2626 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
2627 // CK20-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]]
2628 // CK20-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002629 // CK20-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
2630 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
2631 // CK20-DAG: [[RVAR00]] = load float*, float** [[VAR0]]
2632
2633 // CK20: call void [[CALL03:@.+]](float* {{[^,]+}})
2634 #pragma omp target map(from:d[2:3])
2635 {
2636 d[2] += 1.0f;
2637 }
2638}
2639
2640// CK20: define {{.+}}[[CALL00]]
2641// CK20: define {{.+}}[[CALL01]]
2642// CK20: define {{.+}}[[CALL02]]
2643// CK20: define {{.+}}[[CALL03]]
2644
2645#endif
2646///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00002647// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-64
2648// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2649// 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 %s --check-prefix CK21 --check-prefix CK21-64
2650// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-32
2651// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2652// 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 %s --check-prefix CK21 --check-prefix CK21-32
Samuel Antao86ace552016-04-27 22:40:57 +00002653#ifdef CK21
2654// CK21: [[ST:%.+]] = type { i32, i32, float* }
2655
2656// CK21: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002657// CK21: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002658
2659// CK21: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
Samuel Antao6782e942016-05-26 16:48:10 +00002660// CK21: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002661
2662// CK21: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 500]
Samuel Antao6782e942016-05-26 16:48:10 +00002663// CK21: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i32] [i32 34, i32 18]
Samuel Antao86ace552016-04-27 22:40:57 +00002664
2665// CK21: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
Samuel Antao6782e942016-05-26 16:48:10 +00002666// CK21: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002667
2668// CK21: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002669// CK21: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002670
2671// CK21: [[SIZE05:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] 4, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002672// CK21: [[MTYPE05:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 3]
Samuel Antao86ace552016-04-27 22:40:57 +00002673
2674// CK21-LABEL: explicit_maps_template_args_and_members
2675
2676template <int X, typename T>
2677struct CC {
2678 T A;
2679 int A2;
2680 float *B;
2681
2682 int foo(T arg) {
2683 float la[X];
2684 T *lb;
2685
2686 // Region 00
2687 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2688 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2689 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2690
2691 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2692 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002693 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2694 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2695 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
2696 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002697 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
2698
2699 // CK21: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
2700 #pragma omp target map(A)
2701 {
2702 A += 1;
2703 }
2704
2705 // Region 01
2706 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2707 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2708 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2709
2710 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2711 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002712 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2713 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2714 // CK21-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
2715 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002716 // CK21-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2717 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
2718 // CK21-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2719
2720 // CK21: call void [[CALL01:@.+]](i32* {{[^,]+}})
2721 #pragma omp target map(lb[:X])
2722 {
2723 lb[4] += 1;
2724 }
2725
2726 // Region 02
2727 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
2728 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2729 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2730
2731 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2732 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002733 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2734 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float***
2735 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
2736 // CK21-DAG: store float** [[SEC0:%.+]], float*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002737 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2738
2739 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2740 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002741 // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float***
2742 // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
2743 // CK21-DAG: store float** [[SEC0]], float*** [[CBP1]]
2744 // CK21-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002745 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}float* [[RVAR1:%[^,]+]], i{{.+}} 123
2746 // CK21-DAG: [[RVAR1]] = load float*, float** [[SEC1_:%[^,]+]]
2747 // CK21-DAG: [[SEC1_]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2748
2749 // CK21: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}})
2750 #pragma omp target map(from:B[X:X+2])
2751 {
2752 B[2] += 1.0f;
2753 }
2754
2755 // Region 03
2756 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2757 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2758 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2759
2760 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2761 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002762 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [123 x float]**
2763 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [123 x float]**
2764 // CK21-DAG: store [123 x float]* [[VAR0:%.+]], [123 x float]** [[CBP0]]
2765 // CK21-DAG: store [123 x float]* [[VAR0]], [123 x float]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002766
2767 // CK21: call void [[CALL03:@.+]]([123 x float]* {{[^,]+}})
2768 #pragma omp target map(from:la)
2769 {
2770 la[3] += 1.0f;
2771 }
2772
2773 // Region 04
2774 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
2775 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2776 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2777
2778 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2779 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002780 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2781 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2782 // CK21-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
2783 // CK21-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002784
2785 // CK21: call void [[CALL04:@.+]](i32* {{[^,]+}})
2786 #pragma omp target map(from:arg)
2787 {
2788 arg +=1;
2789 }
2790
2791 // Make sure the extra flag is passed to the second map.
2792 // Region 05
2793 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE05]]{{.+}})
2794 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2795 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2796
2797 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2798 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002799 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2800 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2801 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
2802 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002803 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2804
2805 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2806 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002807 // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
2808 // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
2809 // CK21-DAG: store [[ST]]* [[VAR1:%.+]], [[ST]]** [[CBP1]]
2810 // CK21-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002811 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2812
2813 // CK21: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
2814 #pragma omp target map(A, A2)
2815 {
2816 A += 1;
2817 A2 += 1;
2818 }
2819 return A;
2820 }
2821};
2822
2823int explicit_maps_template_args_and_members(int a){
2824 CC<123,int> c;
2825 return c.foo(a);
2826}
2827
2828// CK21: define {{.+}}[[CALL00]]
2829// CK21: define {{.+}}[[CALL01]]
2830// CK21: define {{.+}}[[CALL02]]
2831// CK21: define {{.+}}[[CALL03]]
2832// CK21: define {{.+}}[[CALL04]]
2833// CK21: define {{.+}}[[CALL05]]
2834#endif
2835///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00002836// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-64
2837// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2838// 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 %s --check-prefix CK22 --check-prefix CK22-64
2839// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-32
2840// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2841// 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 %s --check-prefix CK22 --check-prefix CK22-32
Samuel Antao86ace552016-04-27 22:40:57 +00002842#ifdef CK22
2843
2844// CK22-DAG: [[ST:%.+]] = type { float }
2845// CK22-DAG: [[STT:%.+]] = type { i32 }
2846
2847// CK22: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002848// CK22: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002849
2850// CK22: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002851// CK22: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002852
2853// CK22: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002854// CK22: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002855
2856// CK22: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002857// CK22: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002858
2859// CK22: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002860// CK22: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002861
2862// CK22: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002863// CK22: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002864
2865// CK22: [[SIZE06:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002866// CK22: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002867
2868// CK22: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002869// CK22: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002870
2871// CK22: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002872// CK22: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002873
2874// CK22: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002875// CK22: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002876
2877// CK22: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002878// CK22: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002879
2880// CK22: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002881// CK22: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002882
2883// CK22: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002884// CK22: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002885
2886// CK22: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002887// CK22: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002888
2889// CK22: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002890// CK22: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002891
2892int a;
2893int c[100];
2894int *d;
2895
2896struct ST {
2897 float fa;
2898};
2899
2900ST sa ;
2901ST sc[100];
2902ST *sd;
2903
2904template<typename T>
2905struct STT {
2906 T fa;
2907};
2908
2909STT<int> sta ;
2910STT<int> stc[100];
2911STT<int> *std;
2912
2913// CK22-LABEL: explicit_maps_globals
2914int explicit_maps_globals(void){
2915 // Region 00
2916 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2917 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2918 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2919
2920 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2921 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002922 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2923 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2924 // CK22-DAG: store i32* @a, i32** [[CBP0]]
2925 // CK22-DAG: store i32* @a, i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002926
2927 // CK22: call void [[CALL00:@.+]](i32* {{[^,]+}})
2928 #pragma omp target map(a)
2929 { a+=1; }
2930
2931 // Region 01
2932 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2933 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2934 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2935
2936 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2937 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002938 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
2939 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]**
2940 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]]
2941 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002942
2943 // CK22: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
2944 #pragma omp target map(c)
2945 { c[3]+=1; }
2946
2947 // Region 02
2948 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
2949 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2950 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2951
2952 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2953 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002954 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
2955 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
2956 // CK22-DAG: store i32** @d, i32*** [[CBP0]]
2957 // CK22-DAG: store i32** @d, i32*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002958
2959 // CK22: call void [[CALL02:@.+]](i32** {{[^,]+}})
2960 #pragma omp target map(d)
2961 { d[3]+=1; }
2962
2963 // Region 03
2964 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2965 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2966 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2967
2968 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2969 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002970 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
2971 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2972 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]]
2973 // CK22-DAG: store i32* getelementptr inbounds ([100 x i32], [100 x i32]* @c, i{{.+}} 0, i{{.+}} 1), i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002974
2975 // CK22: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
2976 #pragma omp target map(c[1:4])
2977 { c[3]+=1; }
2978
2979 // Region 04
2980 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
2981 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2982 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2983
2984 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2985 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002986 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2987 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2988 // CK22-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
2989 // CK22-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002990 // CK22-DAG: [[RVAR0]] = load i32*, i32** @d
2991 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 2
2992 // CK22-DAG: [[RVAR00]] = load i32*, i32** @d
2993
2994 // CK22: call void [[CALL04:@.+]](i32* {{[^,]+}})
2995 #pragma omp target map(d[2:5])
2996 { d[3]+=1; }
2997
2998 // Region 05
2999 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
3000 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3001 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3002
3003 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3004 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003005 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
3006 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
3007 // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CBP0]]
3008 // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003009
3010 // CK22: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
3011 #pragma omp target map(sa)
3012 { sa.fa+=1; }
3013
3014 // Region 06
3015 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
3016 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3017 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3018
3019 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3020 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003021 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]**
3022 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[ST]]]**
3023 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]]
3024 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003025
3026 // CK22: call void [[CALL06:@.+]]([100 x [[ST]]]* {{[^,]+}})
3027 #pragma omp target map(sc)
3028 { sc[3].fa+=1; }
3029
3030 // Region 07
3031 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
3032 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3033 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3034
3035 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3036 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003037 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]***
3038 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]***
3039 // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CBP0]]
3040 // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003041
3042 // CK22: call void [[CALL07:@.+]]([[ST]]** {{[^,]+}})
3043 #pragma omp target map(sd)
3044 { sd[3].fa+=1; }
3045
3046 // Region 08
3047 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
3048 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3049 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3050
3051 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3052 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003053 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]**
3054 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
3055 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]]
3056 // CK22-DAG: store [[ST]]* getelementptr inbounds ([100 x [[ST]]], [100 x [[ST]]]* @sc, i{{.+}} 0, i{{.+}} 1), [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003057
3058 // CK22: call void [[CALL08:@.+]]([100 x [[ST]]]* {{[^,]+}})
3059 #pragma omp target map(sc[1:4])
3060 { sc[3].fa+=1; }
3061
3062 // Region 09
3063 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
3064 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3065 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3066
3067 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3068 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003069 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
3070 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
3071 // CK22-DAG: store [[ST]]* [[RVAR0:%.+]], [[ST]]** [[CBP0]]
3072 // CK22-DAG: store [[ST]]* [[SEC0:%.+]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003073 // CK22-DAG: [[RVAR0]] = load [[ST]]*, [[ST]]** @sd
3074 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[RVAR00:%.+]], i{{.+}} 2
3075 // CK22-DAG: [[RVAR00]] = load [[ST]]*, [[ST]]** @sd
3076
3077 // CK22: call void [[CALL09:@.+]]([[ST]]* {{[^,]+}})
3078 #pragma omp target map(sd[2:5])
3079 { sd[3].fa+=1; }
3080
3081 // Region 10
3082 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
3083 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3084 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3085
3086 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3087 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003088 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]**
3089 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
3090 // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CBP0]]
3091 // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003092
3093 // CK22: call void [[CALL10:@.+]]([[STT]]* {{[^,]+}})
3094 #pragma omp target map(sta)
3095 { sta.fa+=1; }
3096
3097 // Region 11
3098 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
3099 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3100 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3101
3102 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3103 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003104 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]**
3105 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[STT]]]**
3106 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]]
3107 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003108
3109 // CK22: call void [[CALL11:@.+]]([100 x [[STT]]]* {{[^,]+}})
3110 #pragma omp target map(stc)
3111 { stc[3].fa+=1; }
3112
3113 // Region 12
3114 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
3115 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3116 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3117
3118 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3119 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003120 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]***
3121 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]***
3122 // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CBP0]]
3123 // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003124
3125 // CK22: call void [[CALL12:@.+]]([[STT]]** {{[^,]+}})
3126 #pragma omp target map(std)
3127 { std[3].fa+=1; }
3128
3129 // Region 13
3130 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
3131 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3132 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3133
3134 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3135 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003136 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]**
3137 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
3138 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]]
3139 // CK22-DAG: store [[STT]]* getelementptr inbounds ([100 x [[STT]]], [100 x [[STT]]]* @stc, i{{.+}} 0, i{{.+}} 1), [[STT]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003140
3141 // CK22: call void [[CALL13:@.+]]([100 x [[STT]]]* {{[^,]+}})
3142 #pragma omp target map(stc[1:4])
3143 { stc[3].fa+=1; }
3144
3145 // Region 14
3146 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
3147 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3148 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3149
3150 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3151 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003152 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]**
3153 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
3154 // CK22-DAG: store [[STT]]* [[RVAR0:%.+]], [[STT]]** [[CBP0]]
3155 // CK22-DAG: store [[STT]]* [[SEC0:%.+]], [[STT]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003156 // CK22-DAG: [[RVAR0]] = load [[STT]]*, [[STT]]** @std
3157 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[STT]]* [[RVAR00:%.+]], i{{.+}} 2
3158 // CK22-DAG: [[RVAR00]] = load [[STT]]*, [[STT]]** @std
3159
3160 // CK22: call void [[CALL14:@.+]]([[STT]]* {{[^,]+}})
3161 #pragma omp target map(std[2:5])
3162 { std[3].fa+=1; }
3163
3164 return 0;
3165}
3166// CK22: define {{.+}}[[CALL00]]
3167// CK22: define {{.+}}[[CALL01]]
3168// CK22: define {{.+}}[[CALL02]]
3169// CK22: define {{.+}}[[CALL03]]
3170// CK22: define {{.+}}[[CALL04]]
3171// CK22: define {{.+}}[[CALL05]]
3172// CK22: define {{.+}}[[CALL06]]
3173// CK22: define {{.+}}[[CALL07]]
3174// CK22: define {{.+}}[[CALL08]]
3175// CK22: define {{.+}}[[CALL09]]
3176// CK22: define {{.+}}[[CALL10]]
3177// CK22: define {{.+}}[[CALL11]]
3178// CK22: define {{.+}}[[CALL12]]
3179// CK22: define {{.+}}[[CALL13]]
3180// CK22: define {{.+}}[[CALL14]]
3181#endif
3182///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00003183// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-64
3184// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3185// RUN: %clang_cc1 -std=c++11 -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 %s --check-prefix CK23 --check-prefix CK23-64
3186// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-32
3187// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3188// RUN: %clang_cc1 -std=c++11 -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 %s --check-prefix CK23 --check-prefix CK23-32
Samuel Antao86ace552016-04-27 22:40:57 +00003189#ifdef CK23
3190
3191// CK23: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003192// CK23: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003193
3194// CK23: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003195// CK23: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003196
3197// CK23: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00003198// CK23: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003199
3200// CK23: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003201// CK23: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003202
3203// CK23: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00003204// CK23: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003205
3206// CK23: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00003207// CK23: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003208
3209// CK23-LABEL: explicit_maps_inside_captured
3210int explicit_maps_inside_captured(int a){
3211 float b;
3212 float c[100];
3213 float *d;
3214
3215 // CK23: call void @{{.*}}explicit_maps_inside_captured{{.*}}([[SA:%.+]]* {{.*}})
3216 // CK23: define {{.*}}explicit_maps_inside_captured{{.*}}
3217 [&](void){
3218 // Region 00
3219 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
3220 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3221 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3222
3223 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3224 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003225 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
3226 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3227 // CK23-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
3228 // CK23-DAG: store i32* [[VAR00:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003229 // CK23-DAG: [[VAR0]] = load i32*, i32** [[CAP0:%[^,]+]]
3230 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3231 // CK23-DAG: [[VAR00]] = load i32*, i32** [[CAP00:%[^,]+]]
3232 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3233
3234 // CK23: call void [[CALL00:@.+]](i32* {{[^,]+}})
3235 #pragma omp target map(a)
3236 { a+=1; }
3237 // Region 01
3238 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
3239 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3240 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3241
3242 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3243 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003244 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
3245 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3246 // CK23-DAG: store float* [[VAR0:%.+]], float** [[CBP0]]
3247 // CK23-DAG: store float* [[VAR00:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003248 // CK23-DAG: [[VAR0]] = load float*, float** [[CAP0:%[^,]+]]
3249 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3250 // CK23-DAG: [[VAR00]] = load float*, float** [[CAP00:%[^,]+]]
3251 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3252
3253 // CK23: call void [[CALL01:@.+]](float* {{[^,]+}})
3254 #pragma omp target map(b)
3255 { b+=1; }
3256 // Region 02
3257 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
3258 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3259 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3260
3261 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3262 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003263 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]**
3264 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x float]**
3265 // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]]
3266 // CK23-DAG: store [100 x float]* [[VAR00:%.+]], [100 x float]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003267 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3268 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3269 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3270 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3271
3272 // CK23: call void [[CALL02:@.+]]([100 x float]* {{[^,]+}})
3273 #pragma omp target map(c)
3274 { c[3]+=1; }
3275
3276 // Region 03
3277 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
3278 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3279 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3280
3281 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3282 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003283 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float***
3284 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float***
3285 // CK23-DAG: store float** [[VAR0:%.+]], float*** [[CBP0]]
3286 // CK23-DAG: store float** [[VAR00:%.+]], float*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003287 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3288 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3289 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3290 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3291
3292 // CK23: call void [[CALL03:@.+]](float** {{[^,]+}})
3293 #pragma omp target map(d)
3294 { d[3]+=1; }
3295 // Region 04
3296 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
3297 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3298 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3299
3300 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3301 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003302 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]**
3303 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3304 // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]]
3305 // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003306 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}[100 x float]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3307 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3308 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3309 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3310 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3311
3312 // CK23: call void [[CALL04:@.+]]([100 x float]* {{[^,]+}})
3313 #pragma omp target map(c[2:4])
3314 { c[3]+=1; }
3315
3316 // Region 05
3317 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
3318 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3319 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3320
3321 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3322 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003323 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
3324 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3325 // CK23-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]]
3326 // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003327 // CK23-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
3328 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
3329 // CK23-DAG: [[RVAR00]] = load float*, float** [[VAR00:%[^,]+]]
3330 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3331 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3332 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3333 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3334
3335 // CK23: call void [[CALL05:@.+]](float* {{[^,]+}})
3336 #pragma omp target map(d[2:4])
3337 { d[3]+=1; }
3338 }();
3339 return b;
3340}
3341
3342// CK23: define {{.+}}[[CALL00]]
3343// CK23: define {{.+}}[[CALL01]]
3344// CK23: define {{.+}}[[CALL02]]
3345// CK23: define {{.+}}[[CALL03]]
3346// CK23: define {{.+}}[[CALL04]]
3347// CK23: define {{.+}}[[CALL05]]
3348#endif
3349///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00003350// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-64
3351// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3352// 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 %s --check-prefix CK24 --check-prefix CK24-64
3353// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-32
3354// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3355// 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 %s --check-prefix CK24 --check-prefix CK24-32
Samuel Antao86ace552016-04-27 22:40:57 +00003356#ifdef CK24
3357
3358// CK24-DAG: [[SC:%.+]] = type { i32, [[SB:%.+]], [[SB:%.+]]*, [10 x i32] }
3359// CK24-DAG: [[SB]] = type { i32, [[SA:%.+]], [10 x [[SA:%.+]]], [10 x [[SA:%.+]]*], [[SA:%.+]]* }
3360// CK24-DAG: [[SA]] = type { i32, [[SA]]*, [10 x i32] }
3361
3362struct SA{
3363 int a;
3364 struct SA *p;
3365 int b[10];
3366};
3367struct SB{
3368 int a;
3369 struct SA s;
3370 struct SA sa[10];
3371 struct SA *sp[10];
3372 struct SA *p;
3373};
3374struct SC{
3375 int a;
3376 struct SB s;
3377 struct SB *p;
3378 int b[10];
3379};
3380
3381// CK24: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003382// CK24: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003383
Samuel Antao86ace552016-04-27 22:40:57 +00003384// CK24: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003385// CK24: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003386
3387// CK24: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{56|48}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003388// CK24: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003389
3390// CK24: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003391// CK24: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003392
3393// CK24: [[SIZE16:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00003394// CK24: [[MTYPE16:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003395
3396// CK24: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{3560|2880}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003397// CK24: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003398
3399// CK24: [[SIZE18:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003400// CK24: [[MTYPE18:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003401
3402// CK24: [[SIZE19:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003403// CK24: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003404
3405// CK24: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003406// CK24: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003407
3408// CK24: [[SIZE21:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003409// CK24: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003410
3411// CK24: [[SIZE22:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003412// CK24: [[MTYPE22:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003413
3414// CK24: [[SIZE23:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003415// CK24: [[MTYPE23:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003416
3417// CK24: [[SIZE24:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003418// CK24: [[MTYPE24:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 19, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003419
3420// CK24-LABEL: explicit_maps_struct_fields
3421int explicit_maps_struct_fields(int a){
3422 SC s;
3423 SC *p;
3424
3425// Region 01
3426// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
3427// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3428// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3429
3430// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3431// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003432// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3433// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3434// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3435// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003436// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
3437
3438// CK24: call void [[CALL01:@.+]]([[SC]]* {{[^,]+}})
3439#pragma omp target map(s.a)
3440 { s.a++; }
3441
Samuel Antao86ace552016-04-27 22:40:57 +00003442//
3443// Same thing but starting from a pointer.
3444//
3445// Region 13
3446// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
3447// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3448// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3449
3450// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3451// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003452// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3453// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3454// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3455// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003456// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 0
3457
3458// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3459// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3460
3461// CK24: call void [[CALL13:@.+]]([[SC]]* {{[^,]+}})
3462#pragma omp target map(p->a)
3463 { p->a++; }
3464
3465// Region 14
3466// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
3467// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3468// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3469
3470// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3471// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003472// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3473// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]**
3474// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3475// CK24-DAG: store [[SA]]* [[SEC0:%.+]], [[SA]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003476// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3477// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3478
3479// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3480// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3481
3482// CK24: call void [[CALL14:@.+]]([[SC]]* {{[^,]+}})
3483#pragma omp target map(p->s.s)
3484 { p->a++; }
3485
3486// Region 15
3487// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
3488// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3489// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3490
3491// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3492// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003493// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3494// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3495// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3496// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003497// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3498// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3499// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3500
3501// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3502// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3503
3504// CK24: call void [[CALL15:@.+]]([[SC]]* {{[^,]+}})
3505#pragma omp target map(p->s.s.a)
3506 { p->a++; }
3507
3508// Region 16
3509// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE16]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE16]]{{.+}})
3510// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3511// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3512
3513// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3514// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003515// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3516// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3517// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3518// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003519// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3520// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 3
3521
3522// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3523// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3524
3525// CK24: call void [[CALL16:@.+]]([[SC]]* {{[^,]+}})
3526#pragma omp target map(p->b[:5])
3527 { p->a++; }
3528
3529// Region 17
3530// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
3531// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3532// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3533
3534// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3535// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003536// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3537// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3538// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3539// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003540// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3541
3542// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3543// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003544// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3545// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SB]]**
3546// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3547// CK24-DAG: store [[SB]]* [[SEC1:%.+]], [[SB]]** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003548// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3549// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3550// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3551
3552// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3553// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3554// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3555
3556// CK24: call void [[CALL17:@.+]]([[SC]]* {{[^,]+}})
3557#pragma omp target map(p->p[:5])
3558 { p->a++; }
3559
3560// Region 18
3561// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE18]]{{.+}})
3562// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3563// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3564
3565// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3566// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003567// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3568// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3569// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3570// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003571// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3572// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3573// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3574// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3575
3576// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3577// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3578
3579// CK24: call void [[CALL18:@.+]]([[SC]]* {{[^,]+}})
3580#pragma omp target map(p->s.sa[3].a)
3581 { p->a++; }
3582
3583// Region 19
3584// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE19]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
3585// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3586// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3587
3588// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3589// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003590// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3591// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3592// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3593// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003594// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3595// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3596// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3597
3598// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3599// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003600// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3601// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3602// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3603// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003604// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3605// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3606// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3607// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3608// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3609
3610// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3611// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3612// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3613
3614// CK24: call void [[CALL19:@.+]]([[SC]]* {{[^,]+}})
3615#pragma omp target map(p->s.sp[3]->a)
3616 { p->a++; }
3617
3618// Region 20
3619// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
3620// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3621// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3622
3623// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3624// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003625// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3626// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3627// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3628// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003629// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3630
3631// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3632// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003633// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3634// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3635// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3636// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003637// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3638// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3639// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3640
3641// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3642// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3643// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3644
3645// CK24: call void [[CALL20:@.+]]([[SC]]* {{[^,]+}})
3646#pragma omp target map(p->p->a)
3647 { p->a++; }
3648
3649// Region 21
3650// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE21]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
3651// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3652// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3653
3654// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3655// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003656// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3657// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3658// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3659// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003660// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4
3661// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3662
3663// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3664// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003665// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3666// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3667// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3668// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003669// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0
3670// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3671// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4
3672// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3673
3674// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3675// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3676// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3677
3678// CK24: call void [[CALL21:@.+]]([[SC]]* {{[^,]+}})
3679#pragma omp target map(p->s.p->a)
3680 { p->a++; }
3681
3682// Region 22
3683// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE22]]{{.+}})
3684// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3685// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3686
3687// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3688// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003689// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3690// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3691// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3692// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003693// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3694// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3695// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3696// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3697
3698// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3699// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3700
3701// CK24: call void [[CALL22:@.+]]([[SC]]* {{[^,]+}})
3702#pragma omp target map(p->s.s.b[:2])
3703 { p->a++; }
3704
3705// Region 23
3706// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE23]]{{.+}})
3707// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3708// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3709
3710// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3711// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003712// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3713// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3714// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3715// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003716// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3717// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3718
3719// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3720// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003721// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3722// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3723// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3724// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003725// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3726// CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3727// CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]],
3728// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3729// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3730
3731// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3732// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3733// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3734
3735// CK24: call void [[CALL23:@.+]]([[SC]]* {{[^,]+}})
3736#pragma omp target map(p->s.p->b[:2])
3737 { p->a++; }
3738
3739// Region 24
3740// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE24]]{{.+}})
3741// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3742// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3743
3744// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3745// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003746// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3747// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3748// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3749// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003750// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3751
3752// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3753// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003754// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3755// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]***
3756// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3757// CK24-DAG: store [[SA]]** [[SEC1:%.+]], [[SA]]*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003758// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3759// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3760// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3761
3762// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
3763// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003764// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]***
3765// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [[SA]]***
3766// CK24-DAG: store [[SA]]** [[SEC1]], [[SA]]*** [[CBP2]]
3767// CK24-DAG: store [[SA]]** [[SEC2:%.+]], [[SA]]*** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00003768// CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3769// CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]],
3770// CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3771// CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]],
3772// CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0000:%.+]], i{{.+}} 0, i{{.+}} 2
3773
3774// CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
3775// CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003776// CK24-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to [[SA]]***
3777// CK24-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32**
3778// CK24-DAG: store [[SA]]** [[SEC2]], [[SA]]*** [[CBP3]]
3779// CK24-DAG: store i32* [[SEC3:%.+]], i32** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00003780// CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3781// CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]],
3782// CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3783// CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]],
3784// CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3785// CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]],
3786// CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR00000:%.+]], i{{.+}} 0, i{{.+}} 2
3787
3788// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3789// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3790// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3791// CK24-DAG: [[VAR0000]] = load [[SC]]*, [[SC]]** %{{.+}}
3792// CK24-DAG: [[VAR00000]] = load [[SC]]*, [[SC]]** %{{.+}}
3793
3794// CK24: call void [[CALL24:@.+]]([[SC]]* {{[^,]+}})
3795#pragma omp target map(p->p->p->p->a)
3796 { p->a++; }
3797
3798 return s.a;
3799}
3800
3801// CK24: define {{.+}}[[CALL01]]
Samuel Antao86ace552016-04-27 22:40:57 +00003802// CK24: define {{.+}}[[CALL13]]
3803// CK24: define {{.+}}[[CALL14]]
3804// CK24: define {{.+}}[[CALL15]]
3805// CK24: define {{.+}}[[CALL16]]
3806// CK24: define {{.+}}[[CALL17]]
3807// CK24: define {{.+}}[[CALL18]]
3808// CK24: define {{.+}}[[CALL19]]
3809// CK24: define {{.+}}[[CALL20]]
3810// CK24: define {{.+}}[[CALL21]]
3811// CK24: define {{.+}}[[CALL22]]
3812// CK24: define {{.+}}[[CALL23]]
3813// CK24: define {{.+}}[[CALL24]]
3814#endif
3815///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00003816// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-64
3817// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3818// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-64
3819// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-32
3820// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3821// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-32
Samuel Antao86ace552016-04-27 22:40:57 +00003822#ifdef CK25
3823// CK25: [[ST:%.+]] = type { i32, float }
3824// CK25: [[CA00:%.+]] = type { [[ST]]* }
3825// CK25: [[CA01:%.+]] = type { i32* }
3826
3827// CK25: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003828// CK25: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00003829
3830// CK25: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003831// CK25: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00003832
3833// CK25-LABEL: explicit_maps_with_inner_lambda
3834
3835template <int X, typename T>
3836struct CC {
3837 T A;
3838 float B;
3839
3840 int foo(T arg) {
3841 // Region 00
3842 // CK25-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
3843 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3844 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3845
3846 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3847 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003848 // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
3849 // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3850 // CK25-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
3851 // CK25-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003852 // CK25-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
3853
3854 // CK25: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
3855 #pragma omp target map(to:A)
3856 {
3857 [&]() {
3858 A += 1;
3859 }();
3860 }
3861
3862 // Region 01
3863 // CK25-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
3864 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3865 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3866
3867 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3868 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003869 // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
3870 // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3871 // CK25-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
3872 // CK25-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003873
3874 // CK25: call void [[CALL01:@.+]](i32* {{[^,]+}})
3875 #pragma omp target map(to:arg)
3876 {
3877 [&]() {
3878 arg += 1;
3879 }();
3880 }
3881
3882 return A+arg;
3883 }
3884};
3885
3886int explicit_maps_with_inner_lambda(int a){
3887 CC<123,int> c;
3888 return c.foo(a);
3889}
3890
3891// CK25: define {{.+}}[[CALL00]]([[ST]]* [[VAL:%.+]])
3892// CK25: store [[ST]]* [[VAL]], [[ST]]** [[VALADDR:%[^,]+]],
3893// CK25: [[VAL1:%.+]] = load [[ST]]*, [[ST]]** [[VALADDR]],
3894// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA00]], [[CA00]]* [[CA:%[^,]+]], i32 0, i32 0
3895// CK25: store [[ST]]* [[VAL1]], [[ST]]** [[VALADDR1]],
3896// CK25: call void {{.*}}[[LAMBDA:@.+]]{{.*}}([[CA00]]* [[CA]])
3897
3898// CK25: define {{.+}}[[LAMBDA]]
3899
3900// CK25: define {{.+}}[[CALL01]](i32* {{.*}}[[VAL:%.+]])
3901// CK25: store i32* [[VAL]], i32** [[VALADDR:%[^,]+]],
3902// CK25: [[VAL1:%.+]] = load i32*, i32** [[VALADDR]],
3903// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA01]], [[CA01]]* [[CA:%[^,]+]], i32 0, i32 0
3904// CK25: store i32* [[VAL1]], i32** [[VALADDR1]],
Alexey Bataevbef6aa62016-10-14 12:43:59 +00003905// CK25: call void {{.*}}[[LAMBDA2:@.+]]{{.*}}([[CA01]]* [[CA]])
3906
3907// CK25: define {{.+}}[[LAMBDA2]]
Samuel Antao86ace552016-04-27 22:40:57 +00003908#endif
3909///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00003910// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
3911// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3912// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
3913// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-32
3914// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3915// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-32
Samuel Antao86ace552016-04-27 22:40:57 +00003916#ifdef CK26
3917// CK26: [[ST:%.+]] = type { i32, float*, i32, float* }
3918
3919// CK26: [[SIZE00:@.+]] = private {{.*}}constant [2 x i[[Z:64|32]]] [i[[Z:64|32]] {{32|16}}, i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003920// CK26: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003921
3922// CK26: [[SIZE01:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003923// CK26: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003924
3925// CK26: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003926// CK26: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003927
3928// CK26: [[SIZE03:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003929// CK26: [[MTYPE03:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003930
3931// CK26-LABEL: explicit_maps_with_private_class_members
3932
3933struct CC {
3934 int fA;
3935 float &fB;
3936 int pA;
3937 float &pB;
3938
3939 CC(float &B) : fB(B), pB(B) {
3940
3941 // CK26: call {{.*}}@__kmpc_fork_call{{.*}} [[OUTCALL:@.+]] to void (i32*, i32*, ...)*
3942 // define {{.*}}void [[OUTCALL]]
3943 #pragma omp parallel firstprivate(fA,fB) private(pA,pB)
3944 {
3945 // Region 00
3946 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}})
3947 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3948 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3949
3950 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3951 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003952 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
3953 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
3954 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
3955 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003956
3957 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3958 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003959 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
3960 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3961 // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
3962 // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003963 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
3964 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
3965
3966 // CK26: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
3967 #pragma omp target map(fA)
3968 {
3969 ++fA;
3970 }
3971
3972 // Region 01
3973 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE01]]{{.+}})
3974 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3975 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3976
3977 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3978 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003979 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
3980 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
3981 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
3982 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003983
3984 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3985 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003986 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float**
3987 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
3988 // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]]
3989 // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003990 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
3991 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
3992
3993 // CK26: call void [[CALL01:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
3994 #pragma omp target map(fB)
3995 {
3996 fB += 1.0;
3997 }
3998
3999 // Region 02
4000 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
4001 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4002 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4003
4004 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4005 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004006 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4007 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4008 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4009 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004010
4011 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4012 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004013 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
4014 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
4015 // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
4016 // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004017 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4018 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4019
4020 // CK26: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4021 #pragma omp target map(pA)
4022 {
4023 ++pA;
4024 }
4025
4026 // Region 01
4027 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE03]]{{.+}})
4028 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4029 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4030
4031 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4032 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004033 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4034 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4035 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4036 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004037
4038 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4039 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004040 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float**
4041 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
4042 // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]]
4043 // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004044 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4045 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4046
4047 // CK26: call void [[CALL03:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4048 #pragma omp target map(pB)
4049 {
4050 pB += 1.0;
4051 }
4052 }
4053 }
4054
4055 int foo() {
4056 return fA + pA;
4057 }
4058};
4059
4060// Make sure the private instance is used in all target regions.
4061// CK26: define {{.+}}[[CALL00]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4062// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4063// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4064// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4065// CK26: add nsw i32 [[VAL]], 1
4066
4067// CK26: define {{.+}}[[CALL01]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4068// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4069// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4070// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4071// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4072// CK26: fadd double [[EXT]], 1.000000e+00
4073
4074// CK26: define {{.+}}[[CALL02]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4075// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4076// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4077// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4078// CK26: add nsw i32 [[VAL]], 1
4079
4080// CK26: define {{.+}}[[CALL03]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4081// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4082// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4083// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4084// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4085// CK26: fadd double [[EXT]], 1.000000e+00
4086
4087int explicit_maps_with_private_class_members(){
4088 float B;
4089 CC c(B);
4090 return c.foo();
4091}
4092#endif
Samuel Antao6782e942016-05-26 16:48:10 +00004093///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00004094// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-64
4095// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4096// 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 %s --check-prefix CK27 --check-prefix CK27-64
4097// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-32
4098// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4099// 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 %s --check-prefix CK27 --check-prefix CK27-32
Samuel Antao6782e942016-05-26 16:48:10 +00004100#ifdef CK27
4101
4102// CK27: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] zeroinitializer
4103// CK27: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
4104
4105// CK27: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4106// CK27: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4107
4108// CK27: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4109// CK27: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4110
4111// CK27: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4112// CK27: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4113
Samuel Antaod486f842016-05-26 16:53:38 +00004114// CK27: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4115// CK27: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
4116
4117// CK27: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
4118// CK27: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 288]
4119
4120// CK27: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 40]
4121// CK27: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 161]
4122
4123// CK27-LABEL: zero_size_section_and_private_maps
4124void zero_size_section_and_private_maps (int ii){
Samuel Antao6782e942016-05-26 16:48:10 +00004125
4126 // Map of a pointer.
4127 int *pa;
4128
4129 // Region 00
4130 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4131 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4132 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4133
4134 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4135 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004136 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4137 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4138 // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4139 // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004140
4141 // CK27: call void [[CALL00:@.+]](i32* {{[^,]+}})
4142 #pragma omp target
4143 {
4144 pa[50]++;
4145 }
4146
4147 // Region 01
4148 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4149 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4150 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4151
4152 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4153 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004154 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4155 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4156 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4157 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004158 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4159 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4160 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4161
4162 // CK27: call void [[CALL01:@.+]](i32* {{[^,]+}})
4163 #pragma omp target map(pa[:0])
4164 {
4165 pa[50]++;
4166 }
4167
4168 // Region 02
4169 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
4170 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4171 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4172
4173 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4174 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004175 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4176 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4177 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4178 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004179 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4180 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4181 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4182
4183 // CK27: call void [[CALL02:@.+]](i32* {{[^,]+}})
4184 #pragma omp target map(pa[0:0])
4185 {
4186 pa[50]++;
4187 }
4188
4189 // Region 03
4190 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
4191 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4192 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4193
4194 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4195 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004196 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4197 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4198 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4199 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004200 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4201 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.+}}
4202 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4203
4204 // CK27: call void [[CALL03:@.+]](i32* {{[^,]+}})
4205 #pragma omp target map(pa[ii:0])
4206 {
4207 pa[50]++;
4208 }
Samuel Antaod486f842016-05-26 16:53:38 +00004209
4210 int *pvtPtr;
4211 int pvtScl;
4212 int pvtArr[10];
4213
4214 // Region 04
4215 // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4216 // CK27: call void [[CALL04:@.+]]()
4217 #pragma omp target private(pvtPtr)
4218 {
4219 pvtPtr[5]++;
4220 }
4221
4222 // Region 05
4223 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
4224 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4225 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4226
4227 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4228 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004229 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4230 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4231 // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4232 // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antaod486f842016-05-26 16:53:38 +00004233
4234 // CK27: call void [[CALL05:@.+]](i32* {{[^,]+}})
4235 #pragma omp target firstprivate(pvtPtr)
4236 {
4237 pvtPtr[5]++;
4238 }
4239
4240 // Region 06
4241 // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4242 // CK27: call void [[CALL06:@.+]]()
4243 #pragma omp target private(pvtScl)
4244 {
4245 pvtScl++;
4246 }
4247
4248 // Region 07
4249 // CK27-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZE07]]{{.+}}, {{.+}}[[MTYPE07]]{{.+}})
4250 // CK27-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
4251 // CK27-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
4252 // CK27-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
4253 // CK27-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004254 // CK27-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
4255 // CK27-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
4256 // CK27-DAG: store i[[Z]] [[VAL:%.+]], i[[Z]]* [[CBP1]]
4257 // CK27-DAG: store i[[Z]] [[VAL]], i[[Z]]* [[CP1]]
Samuel Antaod486f842016-05-26 16:53:38 +00004258 // CK27-DAG: [[VAL]] = load i[[Z]], i[[Z]]* [[ADDR:%.+]],
4259 // CK27-64-DAG: [[CADDR:%.+]] = bitcast i[[Z]]* [[ADDR]] to i32*
4260 // CK27-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
4261
4262 // CK27: call void [[CALL07:@.+]](i[[Z]] [[VAL]])
4263 #pragma omp target firstprivate(pvtScl)
4264 {
4265 pvtScl++;
4266 }
4267
4268 // Region 08
4269 // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4270 // CK27: call void [[CALL08:@.+]]()
4271 #pragma omp target private(pvtArr)
4272 {
4273 pvtArr[5]++;
4274 }
4275
4276 // Region 09
4277 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
4278 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4279 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4280
4281 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4282 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004283 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]**
4284 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [10 x i32]**
4285 // CK27-DAG: store [10 x i32]* [[VAR0:%.+]], [10 x i32]** [[CBP0]]
4286 // CK27-DAG: store [10 x i32]* [[VAR0]], [10 x i32]** [[CP0]]
Samuel Antaod486f842016-05-26 16:53:38 +00004287
4288 // CK27: call void [[CALL09:@.+]]([10 x i32]* {{[^,]+}})
4289 #pragma omp target firstprivate(pvtArr)
4290 {
4291 pvtArr[5]++;
4292 }
Samuel Antao6782e942016-05-26 16:48:10 +00004293}
4294
4295// CK27: define {{.+}}[[CALL00]]
4296// CK27: define {{.+}}[[CALL01]]
4297// CK27: define {{.+}}[[CALL02]]
4298// CK27: define {{.+}}[[CALL03]]
Samuel Antaod486f842016-05-26 16:53:38 +00004299// CK27: define {{.+}}[[CALL04]]
4300// CK27: define {{.+}}[[CALL05]]
4301// CK27: define {{.+}}[[CALL06]]
4302// CK27: define {{.+}}[[CALL07]]
Samuel Antao6782e942016-05-26 16:48:10 +00004303#endif
Samuel Antao403ffd42016-07-27 22:49:49 +00004304///==========================================================================///
4305// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK28 --check-prefix CK28-64
4306// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4307// 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 %s --check-prefix CK28 --check-prefix CK28-64
4308// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK28 --check-prefix CK28-32
4309// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4310// 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 %s --check-prefix CK28 --check-prefix CK28-32
4311#ifdef CK28
4312
4313// CK28: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] {{8|4}}]
4314// CK28: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4315
4316// CK28: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
4317// CK28: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4318
4319// CK28-LABEL: explicit_maps_pointer_references
4320void explicit_maps_pointer_references (int *p){
4321 int *&a = p;
4322
4323 // Region 00
4324 // CK28-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4325 // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4326 // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4327
4328 // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4329 // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004330 // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
4331 // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
4332 // CK28-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]]
4333 // CK28-DAG: store i32** [[VAR1:%.+]], i32*** [[CP0]]
Samuel Antao403ffd42016-07-27 22:49:49 +00004334 // CK28-DAG: [[VAR0]] = load i32**, i32*** [[VAR00:%.+]],
4335 // CK28-DAG: [[VAR1]] = load i32**, i32*** [[VAR11:%.+]],
4336
4337 // CK28: call void [[CALL00:@.+]](i32** {{[^,]+}})
4338 #pragma omp target map(a)
4339 {
4340 ++a;
4341 }
4342
4343 // Region 01
4344 // CK28-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4345 // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4346 // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4347
4348 // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4349 // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004350 // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4351 // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4352 // CK28-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4353 // CK28-DAG: store i32* [[VAR1:%.+]], i32** [[CP0]]
Samuel Antao403ffd42016-07-27 22:49:49 +00004354 // CK28-DAG: [[VAR0]] = load i32*, i32** [[VAR00:%.+]],
4355 // CK28-DAG: [[VAR00]] = load i32**, i32*** [[VAR000:%.+]],
4356 // CK28-DAG: [[VAR1]] = getelementptr inbounds i32, i32* [[VAR11:%.+]], i{{64|32}} 2
4357 // CK28-DAG: [[VAR11]] = load i32*, i32** [[VAR111:%.+]],
4358 // CK28-DAG: [[VAR111]] = load i32**, i32*** [[VAR1111:%.+]],
4359
4360 // CK28: call void [[CALL01:@.+]](i32* {{[^,]+}})
4361 #pragma omp target map(a[2:100])
4362 {
4363 ++a;
4364 }
4365}
4366#endif
Samuel Antao03a3cec2016-07-27 22:52:16 +00004367///==========================================================================///
4368// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK29 --check-prefix CK29-64
4369// 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
4370// 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 %s --check-prefix CK29 --check-prefix CK29-64
4371// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK29 --check-prefix CK29-32
4372// 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
4373// 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 %s --check-prefix CK29 --check-prefix CK29-32
4374#ifdef CK29
4375
4376// CK29: [[SSA:%.+]] = type { double*, double** }
4377// CK29: [[SSB:%.+]] = type { [[SSA]]*, [[SSA]]** }
4378
4379// CK29: [[SIZE00:@.+]] = private {{.*}}constant [4 x i[[Z:64|32]]] [i[[Z:64|32]] {{8|4}}, i[[Z:64|32]] {{8|4}}, i[[Z:64|32]] {{8|4}}, i[[Z:64|32]] 80]
4380// CK29: [[MTYPE00:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 16, i32 19, i32 19]
4381
4382// CK29: [[SIZE01:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 80]
4383// CK29: [[MTYPE01:@.+]] = private {{.*}}constant [4 x i32] [i32 32, i32 19, i32 19, i32 19]
4384
4385// CK29: [[SIZE02:@.+]] = private {{.*}}constant [5 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 80]
4386// CK29: [[MTYPE02:@.+]] = private {{.*}}constant [5 x i32] [i32 32, i32 19, i32 16, i32 19, i32 19]
4387
4388struct SSA{
4389 double *p;
4390 double *&pr;
4391 SSA(double *&pr) : pr(pr) {}
4392};
4393
4394struct SSB{
4395 SSA *p;
4396 SSA *&pr;
4397 SSB(SSA *&pr) : pr(pr) {}
4398
4399 // CK29-LABEL: define {{.+}}foo
4400 void foo() {
4401
4402 // Region 00
4403 // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE00]]{{.+}})
4404
4405 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4406 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4407
4408 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4409 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004410 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
4411 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]**
4412 // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]]
4413 // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004414 // CK29-DAG: [[VAR0]] = load [[SSB]]*, [[SSB]]** %
4415 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 0
4416
4417 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4418 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004419 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]***
4420 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double****
4421 // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]]
4422 // CK29-DAG: store double*** [[VAR1:%.+]], double**** [[CP1]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004423 // CK29-DAG: [[VAR1]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4424
4425 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4426 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004427 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double****
4428 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double***
4429 // CK29-DAG: store double*** [[VAR1]], double**** [[CBP2]]
4430 // CK29-DAG: store double** [[VAR2:%.+]], double*** [[CP2]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004431 // CK29-DAG: [[VAR2]] = load double**, double*** [[VAR22:%.+]],
4432 // CK29-DAG: [[VAR22]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4433
4434 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4435 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004436 // CK29-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double***
4437 // CK29-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
4438 // CK29-DAG: store double** [[VAR2]], double*** [[CBP3]]
4439 // CK29-DAG: store double* [[VAR3:%.+]], double** [[CP3]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004440 // CK29-DAG: [[VAR3]] = getelementptr inbounds double, double* [[VAR33:%.+]], i{{.+}} 0
4441 // CK29-DAG: [[VAR33]] = load double*, double** %{{.+}},
4442
4443 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4444 #pragma omp target map(p->pr[:10])
4445 {
4446 p->pr++;
4447 }
4448
4449 // Region 01
4450 // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE01]]{{.+}})
4451
4452 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4453 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4454
4455 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4456 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004457 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
4458 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]****
4459 // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]]
4460 // CK29-DAG: store [[SSA]]*** [[VAR00:%.+]], [[SSA]]**** [[CP0]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004461 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
4462
4463 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4464 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004465 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]****
4466 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SSA]]***
4467 // CK29-DAG: store [[SSA]]*** [[VAR00]], [[SSA]]**** [[CBP1]]
4468 // CK29-DAG: store [[SSA]]** [[VAR1:%.+]], [[SSA]]*** [[CP1]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004469 // CK29-DAG: [[VAR1]] = load [[SSA]]**, [[SSA]]*** [[VAR00]],
4470
4471 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4472 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004473 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SSA]]***
4474 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double***
4475 // CK29-DAG: store [[SSA]]** [[VAR1]], [[SSA]]*** [[CBP2]]
4476 // CK29-DAG: store double** [[VAR2:%.+]], double*** [[CP2]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004477 // CK29-DAG: [[VAR2]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 0
4478
4479 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4480 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004481 // CK29-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double***
4482 // CK29-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
4483 // CK29-DAG: store double** [[VAR2]], double*** [[CBP3]]
4484 // CK29-DAG: store double* [[VAR3:%.+]], double** [[CP3]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004485 // CK29-DAG: [[VAR3]] = getelementptr inbounds double, double* [[VAR33:%.+]], i{{.+}} 0
4486 // CK29-DAG: [[VAR33]] = load double*, double** %{{.+}},
4487
4488 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4489 #pragma omp target map(pr->p[:10])
4490 {
4491 pr->p++;
4492 }
4493
4494 // Region 02
4495 // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 5, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[5 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[5 x i{{.+}}]* [[MTYPE02]]{{.+}})
4496
4497 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4498 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4499
4500 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4501 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004502 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
4503 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]****
4504 // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]]
4505 // CK29-DAG: store [[SSA]]*** [[VAR00:%.+]], [[SSA]]**** [[CP0]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004506 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
4507
4508 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4509 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004510 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]****
4511 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SSA]]***
4512 // CK29-DAG: store [[SSA]]*** [[VAR00]], [[SSA]]**** [[CBP1]]
4513 // CK29-DAG: store [[SSA]]** [[VAR1:%.+]], [[SSA]]*** [[CP1]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004514 // CK29-DAG: [[VAR1]] = load [[SSA]]**, [[SSA]]*** [[VAR00]],
4515
4516 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4517 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004518 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SSA]]***
4519 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double****
4520 // CK29-DAG: store [[SSA]]** [[VAR1]], [[SSA]]*** [[CBP2]]
4521 // CK29-DAG: store double*** [[VAR2:%.+]], double**** [[CP2]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004522 // CK29-DAG: [[VAR2]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4523
4524 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4525 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004526 // CK29-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double****
4527 // CK29-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double***
4528 // CK29-DAG: store double*** [[VAR2]], double**** [[CBP3]]
4529 // CK29-DAG: store double** [[VAR3:%.+]], double*** [[CP3]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004530 // CK29-DAG: [[VAR3]] = load double**, double*** [[VAR2]],
4531
4532 // CK29-DAG: [[BP4:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 4
4533 // CK29-DAG: [[P4:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 4
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004534 // CK29-DAG: [[CBP4:%.+]] = bitcast i8** [[BP4]] to double***
4535 // CK29-DAG: [[CP4:%.+]] = bitcast i8** [[P4]] to double**
4536 // CK29-DAG: store double** [[VAR3]], double*** [[CBP4]]
4537 // CK29-DAG: store double* [[VAR4:%.+]], double** [[CP4]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004538 // CK29-DAG: [[VAR4]] = getelementptr inbounds double, double* [[VAR44:%.+]], i{{.+}} 0
4539 // CK29-DAG: [[VAR44]] = load double*, double**
4540
4541 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4542 #pragma omp target map(pr->pr[:10])
4543 {
4544 pr->pr++;
4545 }
4546 }
4547};
4548
4549void explicit_maps_member_pointer_references(SSA *sap) {
4550 double *d;
4551 SSA sa(d);
4552 SSB sb(sap);
4553 sb.foo();
4554}
4555#endif
Samuel Antao4af1b7b2015-12-02 17:44:43 +00004556#endif