blob: 6b15473067465bafcb2c48d78115cdcaa1177f0d [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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +000016
17// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
18// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
19// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
20// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
21// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
22// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
23// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +000024#ifdef CK1
25
Alexey Bataev6a71f362017-08-22 17:54:52 +000026class B {
27public:
28 static double VAR;
29 B() {
30 }
31
32 static void modify(int &res) {
33#pragma omp target map(tofrom \
34 : res)
35 {
36 res = B::VAR;
37 }
38 }
39};
40double B::VAR = 1.0;
41
Samuel Antao4af1b7b2015-12-02 17:44:43 +000042// CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +000043// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +000044// CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000045
46// CK1-LABEL: implicit_maps_integer
47void implicit_maps_integer (int a){
Alexey Bataev6a71f362017-08-22 17:54:52 +000048 // CK1: call void{{.*}}modify
49 B::modify(a);
Samuel Antao4af1b7b2015-12-02 17:44:43 +000050 int i = a;
51
George Rokos63bc9d62017-11-21 18:25:12 +000052 // CK1-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +000053 // CK1-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
54 // CK1-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
55 // CK1-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
56 // CK1-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +000057 // CK1-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
58 // CK1-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
59 // CK1-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
60 // CK1-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000061 // CK1-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
62 // CK1-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
63 // CK1-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
64
65 // CK1: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
66 #pragma omp target
67 {
68 ++i;
69 }
70}
71
72// CK1: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
73// CK1: [[ADDR:%.+]] = alloca i[[sz]],
74// CK1: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
75// CK1-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
76// CK1-64: {{.+}} = load i32, i32* [[CADDR]],
77// CK1-32: {{.+}} = load i32, i32* [[ADDR]],
78
79#endif
80///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +000081// 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
82// 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
83// 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
84// 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
85// 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
86// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +000087
88// RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY1 %s
89// RUN: %clang_cc1 -DCK2 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
90// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY1 %s
91// RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY1 %s
92// RUN: %clang_cc1 -DCK2 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
93// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY1 %s
94// SIMD-ONLY1-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +000095#ifdef CK2
96
Samuel Antao403ffd42016-07-27 22:49:49 +000097// CK2: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +000098// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +000099// CK2: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 288]
Samuel Antao403ffd42016-07-27 22:49:49 +0000100// CK2: [[SIZES2:@.+]] = {{.+}}constant [1 x i[[sz]]] zeroinitializer
101// Map types: OMP_MAP_IS_PTR = 32
George Rokos63bc9d62017-11-21 18:25:12 +0000102// CK2: [[TYPES2:@.+]] = {{.+}}constant [1 x i64] [i64 32]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000103
Samuel Antao403ffd42016-07-27 22:49:49 +0000104// CK2-LABEL: implicit_maps_reference
105void implicit_maps_reference (int a, int *b){
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000106 int &i = a;
George Rokos63bc9d62017-11-21 18:25:12 +0000107 // CK2-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000108 // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
109 // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
110 // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
111 // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000112 // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
113 // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
114 // CK2-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
115 // CK2-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000116 // CK2-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
117 // CK2-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
118 // CK2-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
119
120 // CK2: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
121 #pragma omp target
122 {
123 ++i;
124 }
Samuel Antao403ffd42016-07-27 22:49:49 +0000125
126 int *&p = b;
George Rokos63bc9d62017-11-21 18:25:12 +0000127 // CK2-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}})
Samuel Antao403ffd42016-07-27 22:49:49 +0000128 // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
129 // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
130 // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
131 // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000132 // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
133 // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
134 // CK2-DAG: store i32* [[VAL:%[^,]+]], i32** [[CBP1]]
135 // CK2-DAG: store i32* [[VAL]], i32** [[CP1]]
Samuel Antao403ffd42016-07-27 22:49:49 +0000136 // CK2-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]],
137 // CK2-DAG: [[ADDR]] = load i32**, i32*** [[ADDR2:%.+]],
138
139 // CK2: call void [[KERNEL2:@.+]](i32* [[VAL]])
140 #pragma omp target
141 {
142 ++p;
143 }
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000144}
145
146// CK2: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
147// CK2: [[ADDR:%.+]] = alloca i[[sz]],
148// CK2: [[REF:%.+]] = alloca i32*,
149// CK2: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
150// CK2-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
151// CK2-64: store i32* [[CADDR]], i32** [[REF]],
152// CK2-64: [[RVAL:%.+]] = load i32*, i32** [[REF]],
153// CK2-64: {{.+}} = load i32, i32* [[RVAL]],
154// CK2-32: store i32* [[ADDR]], i32** [[REF]],
155// CK2-32: [[RVAL:%.+]] = load i32*, i32** [[REF]],
156// CK2-32: {{.+}} = load i32, i32* [[RVAL]],
157
Samuel Antao403ffd42016-07-27 22:49:49 +0000158// CK2: define internal void [[KERNEL2]](i32* [[ARG:%.+]])
159// CK2: [[ADDR:%.+]] = alloca i32*,
160// CK2: [[REF:%.+]] = alloca i32**,
161// CK2: store i32* [[ARG]], i32** [[ADDR]],
162// CK2: store i32** [[ADDR]], i32*** [[REF]],
163// CK2: [[T:%.+]] = load i32**, i32*** [[REF]],
164// CK2: [[TT:%.+]] = load i32*, i32** [[T]],
165// CK2: getelementptr inbounds i32, i32* [[TT]], i32 1
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000166#endif
167///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000168// 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
169// 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
170// 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
171// 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
172// 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
173// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000174
175// RUN: %clang_cc1 -DCK3 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY2 %s
176// RUN: %clang_cc1 -DCK3 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
177// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY2 %s
178// RUN: %clang_cc1 -DCK3 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY2 %s
179// RUN: %clang_cc1 -DCK3 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
180// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY2 %s
181// SIMD-ONLY2-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000182#ifdef CK3
183
184// CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000185// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +0000186// CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000187
188// CK3-LABEL: implicit_maps_parameter
189void implicit_maps_parameter (int a){
190
George Rokos63bc9d62017-11-21 18:25:12 +0000191 // CK3-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000192 // CK3-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
193 // CK3-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
194 // CK3-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
195 // CK3-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000196 // CK3-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
197 // CK3-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
198 // CK3-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
199 // CK3-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000200 // CK3-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
201 // CK3-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
202 // CK3-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
203
204 // CK3: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
205 #pragma omp target
206 {
207 ++a;
208 }
209}
210
211// CK3: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
212// CK3: [[ADDR:%.+]] = alloca i[[sz]],
213// CK3: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
214// CK3-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
215// CK3-64: {{.+}} = load i32, i32* [[CADDR]],
216// CK3-32: {{.+}} = load i32, i32* [[ADDR]],
217
218#endif
219///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000220// 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
221// 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
222// 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
223// 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
224// 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
225// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000226
227// RUN: %clang_cc1 -DCK4 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY3 %s
228// RUN: %clang_cc1 -DCK4 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
229// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY3 %s
230// RUN: %clang_cc1 -DCK4 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY3 %s
231// RUN: %clang_cc1 -DCK4 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
232// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY3 %s
233// SIMD-ONLY3-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000234#ifdef CK4
235
236// CK4-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000237// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +0000238// CK4-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000239
240// CK4-LABEL: implicit_maps_nested_integer
241void implicit_maps_nested_integer (int a){
242 int i = a;
243
244 // The captures in parallel are by reference. Only the capture in target is by
245 // copy.
246
247 // CK4: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP1:@.+]] to void (i32*, i32*, ...)*), i32* {{.+}})
248 // CK4: define internal void [[KERNELP1]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
249 #pragma omp parallel
250 {
George Rokos63bc9d62017-11-21 18:25:12 +0000251 // CK4-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000252 // CK4-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
253 // CK4-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
254 // CK4-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
255 // CK4-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000256 // CK4-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
257 // CK4-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
258 // CK4-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
259 // CK4-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000260 // CK4-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
261 // CK4-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
262 // CK4-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
263
264 // CK4: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
265 #pragma omp target
266 {
267 #pragma omp parallel
268 {
269 ++i;
270 }
271 }
272 }
273}
274
275// CK4: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
276// CK4: [[ADDR:%.+]] = alloca i[[sz]],
277// CK4: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
278// CK4-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
279// CK4-64: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[CADDR]])
280// CK4-32: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[ADDR]])
281// CK4: define internal void [[KERNELP2]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
282#endif
283///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000284// 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
285// 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
286// 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
287// 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
288// 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
289// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000290
291// RUN: %clang_cc1 -DCK5 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY4 %s
292// RUN: %clang_cc1 -DCK5 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
293// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY4 %s
294// RUN: %clang_cc1 -DCK5 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY4 %s
295// RUN: %clang_cc1 -DCK5 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
296// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY4 %s
297// SIMD-ONLY4-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000298#ifdef CK5
299
300// CK5-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000301// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +0000302// CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000303
304// CK5-LABEL: implicit_maps_nested_integer_and_enum
305void implicit_maps_nested_integer_and_enum (int a){
306 enum Bla {
307 SomeEnum = 0x09
308 };
309
310 // Using an enum should not change the mapping information.
311 int i = a;
312
George Rokos63bc9d62017-11-21 18:25:12 +0000313 // CK5-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000314 // CK5-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
315 // CK5-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
316 // CK5-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
317 // CK5-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000318 // CK5-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
319 // CK5-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
320 // CK5-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
321 // CK5-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000322 // CK5-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
323 // CK5-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
324 // CK5-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
325
326 // CK5: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
327 #pragma omp target
328 {
329 ++i;
330 i += SomeEnum;
331 }
332}
333
334// CK5: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
335// CK5: [[ADDR:%.+]] = alloca i[[sz]],
336// CK5: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
337// CK5-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
338// CK5-64: {{.+}} = load i32, i32* [[CADDR]],
339// CK5-32: {{.+}} = load i32, i32* [[ADDR]],
340
341#endif
342///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000343// 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
344// 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
345// 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
346// 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
347// 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
348// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000349
350// RUN: %clang_cc1 -DCK6 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY5 %s
351// RUN: %clang_cc1 -DCK6 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
352// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY5 %s
353// RUN: %clang_cc1 -DCK6 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY5 %s
354// RUN: %clang_cc1 -DCK6 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
355// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY5 %s
356// SIMD-ONLY5-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000357#ifdef CK6
358// CK6-DAG: [[GBL:@Gi]] = global i32 0
359// CK6-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000360// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +0000361// CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000362
363// CK6-LABEL: implicit_maps_host_global
364int Gi;
365void implicit_maps_host_global (int a){
George Rokos63bc9d62017-11-21 18:25:12 +0000366 // CK6-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000367 // CK6-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
368 // CK6-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
369 // CK6-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
370 // CK6-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000371 // CK6-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
372 // CK6-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
373 // CK6-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
374 // CK6-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000375 // CK6-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
376 // CK6-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
377 // CK6-64-DAG: store i32 [[GBLVAL:%.+]], i32* [[CADDR]],
378 // CK6-64-DAG: [[GBLVAL]] = load i32, i32* [[GBL]],
379 // CK6-32-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[GBLVAL:%.+]],
380
381 // CK6: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
382 #pragma omp target
383 {
384 ++Gi;
385 }
386}
387
388// CK6: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
389// CK6: [[ADDR:%.+]] = alloca i[[sz]],
390// CK6: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
391// CK6-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
392// CK6-64: {{.+}} = load i32, i32* [[CADDR]],
393// CK6-32: {{.+}} = load i32, i32* [[ADDR]],
394
395#endif
396///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000397// 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
398// 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
399// 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
400// 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
401// 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
402// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000403
404// RUN: %clang_cc1 -DCK7 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY6 %s
405// RUN: %clang_cc1 -DCK7 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
406// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY6 %s
407// RUN: %clang_cc1 -DCK7 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY6 %s
408// RUN: %clang_cc1 -DCK7 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
409// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY6 %s
410// SIMD-ONLY6-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000411#ifdef CK7
412
413// For a 32-bit targets, the value doesn't fit the size of the pointer,
414// therefore it is passed by reference with a map 'to' specification.
415
416// CK7-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Samuel Antao6782e942016-05-26 16:48:10 +0000417// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +0000418// CK7-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 288]
Alexey Bataev2fd0cb22017-10-05 17:51:39 +0000419// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE_PTR | OMP_MAP_FIRST_REF = 161
George Rokos63bc9d62017-11-21 18:25:12 +0000420// CK7-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 161]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000421
422// CK7-LABEL: implicit_maps_double
423void implicit_maps_double (int a){
424 double d = (double)a;
425
George Rokos63bc9d62017-11-21 18:25:12 +0000426 // CK7-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000427 // CK7-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
428 // CK7-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
429 // CK7-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
430 // CK7-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
431
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000432 // CK7-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
433 // CK7-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
434 // CK7-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
435 // CK7-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000436 // CK7-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
437 // CK7-64-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to double*
438 // CK7-64-64-DAG: store double {{.+}}, double* [[CADDR]],
439
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000440 // CK7-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double**
441 // CK7-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
442 // CK7-32-DAG: store double* [[DECL:%[^,]+]], double** [[CBP1]]
443 // CK7-32-DAG: store double* [[DECL]], double** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000444
445 // CK7-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
446 // CK7-32: call void [[KERNEL:@.+]](double* [[DECL]])
447 #pragma omp target
448 {
449 d += 1.0;
450 }
451}
452
453// CK7-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
454// CK7-64: [[ADDR:%.+]] = alloca i[[sz]],
455// CK7-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
456// CK7-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to double*
457// CK7-64: {{.+}} = load double, double* [[CADDR]],
458
459// CK7-32: define internal void [[KERNEL]](double* {{.+}}[[ARG:%.+]])
460// CK7-32: [[ADDR:%.+]] = alloca double*,
461// CK7-32: store double* [[ARG]], double** [[ADDR]],
462// CK7-32: [[REF:%.+]] = load double*, double** [[ADDR]],
463// CK7-32: {{.+}} = load double, double* [[REF]],
464
465#endif
466///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000467// 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
468// 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
469// 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
470// 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
471// 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
472// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000473
474// RUN: %clang_cc1 -DCK8 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY7 %s
475// RUN: %clang_cc1 -DCK8 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
476// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY7 %s
477// RUN: %clang_cc1 -DCK8 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY7 %s
478// RUN: %clang_cc1 -DCK8 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
479// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY7 %s
480// SIMD-ONLY7-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000481#ifdef CK8
482
483// CK8-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000484// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +0000485// CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000486
487// CK8-LABEL: implicit_maps_float
488void implicit_maps_float (int a){
489 float f = (float)a;
490
George Rokos63bc9d62017-11-21 18:25:12 +0000491 // CK8-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000492 // CK8-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
493 // CK8-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
494 // CK8-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
495 // CK8-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000496 // CK8-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
497 // CK8-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
498 // CK8-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
499 // CK8-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000500 // CK8-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
501 // CK8-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
502 // CK8-DAG: store float {{.+}}, float* [[CADDR]],
503
504 // CK8: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
505 #pragma omp target
506 {
507 f += 1.0;
508 }
509}
510
511// CK8: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
512// CK8: [[ADDR:%.+]] = alloca i[[sz]],
513// CK8: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
514// CK8: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
515// CK8: {{.+}} = load float, float* [[CADDR]],
516
517#endif
518///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000519// 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
520// 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
521// 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
522// 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
523// 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
524// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000525
526// RUN: %clang_cc1 -DCK9 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY8 %s
527// RUN: %clang_cc1 -DCK9 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
528// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY8 %s
529// RUN: %clang_cc1 -DCK9 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY8 %s
530// RUN: %clang_cc1 -DCK9 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
531// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY8 %s
532// SIMD-ONLY8-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000533#ifdef CK9
534
535// CK9-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000536// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_MAP_IMPLICIT = 547
George Rokos63bc9d62017-11-21 18:25:12 +0000537// CK9-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000538
539// CK9-LABEL: implicit_maps_array
540void implicit_maps_array (int a){
541 double darr[2] = {(double)a, (double)a};
542
George Rokos63bc9d62017-11-21 18:25:12 +0000543 // CK9-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000544 // CK9-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
545 // CK9-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
546 // CK9-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
547 // CK9-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000548 // CK9-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [2 x double]**
549 // CK9-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [2 x double]**
550 // CK9-DAG: store [2 x double]* [[DECL:%[^,]+]], [2 x double]** [[CBP1]]
551 // CK9-DAG: store [2 x double]* [[DECL]], [2 x double]** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000552
553 // CK9: call void [[KERNEL:@.+]]([2 x double]* [[DECL]])
554 #pragma omp target
555 {
556 darr[0] += 1.0;
557 darr[1] += 1.0;
558 }
559}
560
561// CK9: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]])
562// CK9: [[ADDR:%.+]] = alloca [2 x double]*,
563// CK9: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]],
564// CK9: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]],
565// CK9: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i[[sz]] 0, i[[sz]] 0
566#endif
567///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000568// 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
569// 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
570// 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
571// 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
572// 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
573// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000574
575// RUN: %clang_cc1 -DCK10 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY9 %s
576// RUN: %clang_cc1 -DCK10 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
577// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY9 %s
578// RUN: %clang_cc1 -DCK10 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY9 %s
579// RUN: %clang_cc1 -DCK10 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
580// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY9 %s
581// SIMD-ONLY9-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000582#ifdef CK10
583
Samuel Antao6782e942016-05-26 16:48:10 +0000584// CK10-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] zeroinitializer
585// Map types: OMP_MAP_IS_FIRST = 32
George Rokos63bc9d62017-11-21 18:25:12 +0000586// CK10-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 32]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000587
588// CK10-LABEL: implicit_maps_pointer
589void implicit_maps_pointer (){
590 double *ddyn;
591
George Rokos63bc9d62017-11-21 18:25:12 +0000592 // CK10-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000593 // CK10-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
594 // CK10-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
595 // CK10-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
596 // CK10-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000597 // CK10-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double**
598 // CK10-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
599 // CK10-DAG: store double* [[PTR:%[^,]+]], double** [[CBP1]]
600 // CK10-DAG: store double* [[PTR]], double** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000601
602 // CK10: call void [[KERNEL:@.+]](double* [[PTR]])
603 #pragma omp target
604 {
605 ddyn[0] += 1.0;
606 ddyn[1] += 1.0;
607 }
608}
609
610// CK10: define internal void [[KERNEL]](double* {{.*}}[[ARG:%.+]])
611// CK10: [[ADDR:%.+]] = alloca double*,
612// CK10: store double* [[ARG]], double** [[ADDR]],
613// CK10: [[REF:%.+]] = load double*, double** [[ADDR]],
614// CK10: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] 0
615
616#endif
617///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000618// 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
619// 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
620// 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
621// 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
622// 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
623// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000624
625// RUN: %clang_cc1 -DCK11 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY10 %s
626// RUN: %clang_cc1 -DCK11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
627// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY10 %s
628// RUN: %clang_cc1 -DCK11 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY10 %s
629// RUN: %clang_cc1 -DCK11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
630// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY10 %s
631// SIMD-ONLY10-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000632#ifdef CK11
633
634// CK11-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000635// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_MAP_IMPLICIT = 547
George Rokos63bc9d62017-11-21 18:25:12 +0000636// CK11-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000637
638// CK11-LABEL: implicit_maps_double_complex
639void implicit_maps_double_complex (int a){
640 double _Complex dc = (double)a;
641
George Rokos63bc9d62017-11-21 18:25:12 +0000642 // CK11-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000643 // CK11-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
644 // CK11-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
645 // CK11-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
646 // CK11-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000647 // CK11-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { double, double }**
648 // CK11-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { double, double }**
649 // CK11-DAG: store { double, double }* [[PTR:%[^,]+]], { double, double }** [[CBP1]]
650 // CK11-DAG: store { double, double }* [[PTR]], { double, double }** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000651
652 // CK11: call void [[KERNEL:@.+]]({ double, double }* [[PTR]])
Alexey Bataev2fd0cb22017-10-05 17:51:39 +0000653 #pragma omp target defaultmap(tofrom:scalar)
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000654 {
655 dc *= dc;
656 }
657}
658
659// CK11: define internal void [[KERNEL]]({ double, double }* {{.*}}[[ARG:%.+]])
660// CK11: [[ADDR:%.+]] = alloca { double, double }*,
661// CK11: store { double, double }* [[ARG]], { double, double }** [[ADDR]],
662// CK11: [[REF:%.+]] = load { double, double }*, { double, double }** [[ADDR]],
663// CK11: {{.+}} = getelementptr inbounds { double, double }, { double, double }* [[REF]], i32 0, i32 0
664#endif
665///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000666// 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
667// 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
668// 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
669// 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
670// 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
671// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000672
673// RUN: %clang_cc1 -DCK12 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY11 %s
674// RUN: %clang_cc1 -DCK12 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
675// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY11 %s
676// RUN: %clang_cc1 -DCK12 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY11 %s
677// RUN: %clang_cc1 -DCK12 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
678// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY11 %s
679// SIMD-ONLY11-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000680#ifdef CK12
681
682// For a 32-bit targets, the value doesn't fit the size of the pointer,
683// therefore it is passed by reference with a map 'to' specification.
684
685// CK12-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Samuel Antao6782e942016-05-26 16:48:10 +0000686// Map types: OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +0000687// CK12-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 288]
Alexey Bataev2fd0cb22017-10-05 17:51:39 +0000688// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE_PTR | OMP_MAP_FIRST_REF = 161
George Rokos63bc9d62017-11-21 18:25:12 +0000689// CK12-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 161]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000690
691// CK12-LABEL: implicit_maps_float_complex
692void implicit_maps_float_complex (int a){
693 float _Complex fc = (float)a;
694
George Rokos63bc9d62017-11-21 18:25:12 +0000695 // CK12-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000696 // CK12-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
697 // CK12-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
698 // CK12-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
699 // CK12-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
700
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000701 // CK12-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
702 // CK12-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
703 // CK12-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
704 // CK12-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000705 // CK12-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
706 // CK12-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
707 // CK12-64-DAG: store { float, float } {{.+}}, { float, float }* [[CADDR]],
708
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000709 // CK12-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { float, float }**
710 // CK12-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { float, float }**
711 // CK12-32-DAG: store { float, float }* [[DECL:%[^,]+]], { float, float }** [[CBP1]]
712 // CK12-32-DAG: store { float, float }* [[DECL]], { float, float }** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000713
714 // CK12-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
715 // CK12-32: call void [[KERNEL:@.+]]({ float, float }* [[DECL]])
716 #pragma omp target
717 {
718 fc *= fc;
719 }
720}
721
722// CK12-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
723// CK12-64: [[ADDR:%.+]] = alloca i[[sz]],
724// CK12-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
725// CK12-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
726// CK12-64: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[CADDR]], i32 0, i32 0
727
728// CK12-32: define internal void [[KERNEL]]({ float, float }* {{.+}}[[ARG:%.+]])
729// CK12-32: [[ADDR:%.+]] = alloca { float, float }*,
730// CK12-32: store { float, float }* [[ARG]], { float, float }** [[ADDR]],
731// CK12-32: [[REF:%.+]] = load { float, float }*, { float, float }** [[ADDR]],
732// CK12-32: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[REF]], i32 0, i32 0
733#endif
734///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000735// 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
736// 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
737// 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
738// 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
739// 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
740// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000741
742// RUN: %clang_cc1 -DCK13 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY12 %s
743// RUN: %clang_cc1 -DCK13 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
744// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY12 %s
745// RUN: %clang_cc1 -DCK13 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY12 %s
746// RUN: %clang_cc1 -DCK13 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
747// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY12 %s
748// SIMD-ONLY12-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000749#ifdef CK13
750
751// We don't have a constant map size for VLAs.
752// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000753// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288 (vla size)
754// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288 (vla size)
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000755// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_IMPICIT_MAP = 547
George Rokos63bc9d62017-11-21 18:25:12 +0000756// CK13-DAG: [[TYPES:@.+]] = {{.+}}constant [3 x i64] [i64 288, i64 288, i64 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000757
758// CK13-LABEL: implicit_maps_variable_length_array
759void implicit_maps_variable_length_array (int a){
760 double vla[2][a];
761
George Rokos63bc9d62017-11-21 18:25:12 +0000762 // CK13-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 3, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i[[sz:64|32]]* [[SGEP:%[^,]+]], {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000763 // CK13-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
764 // CK13-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
765 // CK13-DAG: [[SGEP]] = getelementptr inbounds {{.+}}[[SS:%[^,]+]], i32 0, i32 0
766
767 // CK13-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
768 // CK13-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
769 // CK13-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000770 // CK13-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[sz]]*
771 // CK13-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[sz]]*
772 // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CBP0]]
773 // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000774 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S0]],
775
776 // CK13-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
777 // CK13-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
778 // CK13-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000779 // CK13-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
780 // CK13-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
781 // CK13-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
782 // CK13-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000783 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S1]],
784
785 // CK13-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
786 // CK13-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
787 // CK13-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000788 // CK13-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double**
789 // CK13-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
790 // CK13-DAG: store double* [[DECL:%.+]], double** [[CBP2]]
791 // CK13-DAG: store double* [[DECL]], double** [[CP2]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000792 // CK13-DAG: store i[[sz]] [[VALS2:%.+]], i[[sz]]* [[S2]],
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000793 // CK13-DAG: [[VALS2]] = mul nuw i[[sz]] %{{.+}}, 8
794
795 // CK13: call void [[KERNEL:@.+]](i[[sz]] {{.+}}, i[[sz]] {{.+}}, double* [[DECL]])
796 #pragma omp target
797 {
798 vla[1][3] += 1.0;
799 }
800}
801
Alexey Bataev2f5ed342016-10-13 09:52:46 +0000802// CK13: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.*}}[[ARG:%.+]])
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000803// CK13: [[ADDR0:%.+]] = alloca i[[sz]],
804// CK13: [[ADDR1:%.+]] = alloca i[[sz]],
805// CK13: [[ADDR2:%.+]] = alloca double*,
806// CK13: store i[[sz]] [[VLA0]], i[[sz]]* [[ADDR0]],
807// CK13: store i[[sz]] [[VLA1]], i[[sz]]* [[ADDR1]],
808// CK13: store double* [[ARG]], double** [[ADDR2]],
809// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR0]],
810// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR1]],
811// CK13: [[REF:%.+]] = load double*, double** [[ADDR2]],
812// CK13: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] %{{.+}}
813#endif
814///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000815// 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
816// 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
817// 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
818// 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
819// 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
820// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000821
822// RUN: %clang_cc1 -DCK14 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY13 %s
823// RUN: %clang_cc1 -DCK14 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
824// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY13 %s
825// RUN: %clang_cc1 -DCK14 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY13 %s
826// RUN: %clang_cc1 -DCK14 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
827// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY13 %s
828// SIMD-ONLY13-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000829#ifdef CK14
830
831// CK14-DAG: [[ST:%.+]] = type { i32, double }
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000832// 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 +0000833// Map types:
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000834// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_IMPLICIT_MAP = 547
835// - OMP_MAP_TO + OMP_MAP_FROM + OMP_IMPLICIT_MAP = 515
Samuel Antao6782e942016-05-26 16:48:10 +0000836// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +0000837// CK14-DAG: [[TYPES:@.+]] = {{.+}}constant [3 x i64] [i64 547, i64 515, i64 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000838
839class SSS {
840public:
841 int a;
842 double b;
843
844 void foo(int c) {
845 #pragma omp target
846 {
847 a += c;
848 b += (double)c;
849 }
850 }
851
852 SSS(int a, double b) : a(a), b(b) {}
853};
854
855// CK14-LABEL: implicit_maps_class
856void implicit_maps_class (int a){
857 SSS sss(a, (double)a);
858
859 // CK14: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
George Rokos63bc9d62017-11-21 18:25:12 +0000860 // CK14-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 3, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000861 // CK14-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
862 // CK14-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
863
864 // CK14-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
865 // CK14-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000866 // CK14-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000867 // CK14-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000868 // CK14-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]]
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000869 // CK14-DAG: store i32* %{{.+}}, i32** [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000870
871 // CK14-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
872 // CK14-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000873 // CK14-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
874 // CK14-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
875 // CK14-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]]
876 // CK14-DAG: store double* %{{.+}}, double** [[CP1]]
877
878 // CK14-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
879 // CK14-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000880 // CK14-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
881 // CK14-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
882 // CK14-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
883 // CK14-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000884 // CK14-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
885 // CK14-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
886 // CK14-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
887
888 // CK14: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
889 sss.foo(123);
890}
891
892// CK14: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
893// CK14: [[ADDR0:%.+]] = alloca [[ST]]*,
894// CK14: [[ADDR1:%.+]] = alloca i[[sz]],
895// CK14: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
896// CK14: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
897// CK14: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
898// CK14-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
899// CK14-64: {{.+}} = load i32, i32* [[CADDR1]],
900// CK14-32: {{.+}} = load i32, i32* [[ADDR1]],
901// CK14: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
902
903#endif
904///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000905// 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
906// 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
907// 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
908// 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
909// 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
910// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000911
912// RUN: %clang_cc1 -DCK15 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY14 %s
913// RUN: %clang_cc1 -DCK15 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
914// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY14 %s
915// RUN: %clang_cc1 -DCK15 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY14 %s
916// RUN: %clang_cc1 -DCK15 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
917// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY14 %s
918// SIMD-ONLY14-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000919#ifdef CK15
920
921// CK15: [[ST:%.+]] = type { i32, double, i32* }
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000922// 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 +0000923// Map types:
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000924// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_MAP_IMPLICIT = 547
Samuel Antao6782e942016-05-26 16:48:10 +0000925// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +0000926// CK15: [[TYPES:@.+]] = {{.+}}constant [5 x i64] [i64 547, i64 515, i64 512, i64 531, i64 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000927
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000928// 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 +0000929// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000930// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
931// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +0000932// CK15: [[TYPES2:@.+]] = {{.+}}constant [5 x i64] [i64 547, i64 515, i64 512, i64 531, i64 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000933
934template<int x>
935class SSST {
936public:
937 int a;
938 double b;
939 int &r;
940
941 void foo(int c) {
942 #pragma omp target
943 {
944 a += c + x;
945 b += (double)(c + x);
946 r += x;
947 }
948 }
949 template<int y>
950 void bar(int c) {
951 #pragma omp target
952 {
953 a += c + x + y;
954 b += (double)(c + x + y);
955 r += x + y;
956 }
957 }
958
959 SSST(int a, double b, int &r) : a(a), b(b), r(r) {}
960};
961
962// CK15-LABEL: implicit_maps_templated_class
963void implicit_maps_templated_class (int a){
964 SSST<123> ssst(a, (double)a, a);
965
966 // CK15: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
George Rokos63bc9d62017-11-21 18:25:12 +0000967 // CK15-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 5, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000968 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
969 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
970
971 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
972 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000973 // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000974 // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000975 // CK15-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]]
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000976 // CK15-DAG: store i32* %{{.+}}, i32** [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000977
978 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
979 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000980 // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
981 // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
982 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]]
983 // CK15-DAG: store double* %{{.+}}, double** [[CP1]]
984
985 // CK15-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
986 // CK15-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
987 // CK15-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]**
988 // CK15-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32***
989 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]]
990 // CK15-DAG: store i32** %{{.+}}, i32*** [[CP2]]
991
992 // CK15-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3
993 // CK15-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3
994 // CK15-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i32***
995 // CK15-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32**
996 // CK15-DAG: store i32** %{{.+}}, i32*** [[CBP3]]
997 // CK15-DAG: store i32* %{{.+}}, i32** [[CP3]]
998
999 // CK15-DAG: [[BP4:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 4
1000 // CK15-DAG: [[P4:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 4
1001 // CK15-DAG: [[CBP4:%.+]] = bitcast i8** [[BP4]] to i[[sz]]*
1002 // CK15-DAG: [[CP4:%.+]] = bitcast i8** [[P4]] to i[[sz]]*
1003 // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP4]]
1004 // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP4]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001005 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1006 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1007 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1008
1009 // CK15: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
1010 ssst.foo(456);
1011
1012 // CK15: define {{.*}}void @{{.+}}bar{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
George Rokos63bc9d62017-11-21 18:25:12 +00001013 // CK15-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 5, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001014 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1015 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1016
1017 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1018 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001019 // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001020 // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1021 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP0]]
1022 // CK15-DAG: store i32* %{{.+}}, i32** [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001023
1024 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
1025 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001026 // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
1027 // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
1028 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]]
1029 // CK15-DAG: store double* %{{.+}}, double** [[CP1]]
1030
1031 // CK15-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
1032 // CK15-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
1033 // CK15-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]**
1034 // CK15-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32***
1035 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]]
1036 // CK15-DAG: store i32** %{{.+}}, i32*** [[CP2]]
1037
1038 // CK15-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3
1039 // CK15-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3
1040 // CK15-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i32***
1041 // CK15-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32**
1042 // CK15-DAG: store i32** %{{.+}}, i32*** [[CBP3]]
1043 // CK15-DAG: store i32* %{{.+}}, i32** [[CP3]]
1044
1045 // CK15-DAG: [[BP4:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 4
1046 // CK15-DAG: [[P4:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 4
1047 // CK15-DAG: [[CBP4:%.+]] = bitcast i8** [[BP4]] to i[[sz]]*
1048 // CK15-DAG: [[CP4:%.+]] = bitcast i8** [[P4]] to i[[sz]]*
1049 // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP4]]
1050 // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP4]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001051 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1052 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1053 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1054
1055 // CK15: call void [[KERNEL2:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
1056 ssst.bar<210>(789);
1057}
1058
1059// CK15: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
1060// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
1061// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
1062// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
1063// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
1064// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
1065// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
1066// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
1067// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
1068// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
1069
1070// CK15: define internal void [[KERNEL2]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
1071// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
1072// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
1073// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
1074// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
1075// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
1076// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
1077// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
1078// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
1079// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
1080
1081#endif
1082///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00001083// 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
1084// 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
1085// 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
1086// 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
1087// 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
1088// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001089
1090// RUN: %clang_cc1 -DCK16 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY15 %s
1091// RUN: %clang_cc1 -DCK16 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1092// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY15 %s
1093// RUN: %clang_cc1 -DCK16 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY15 %s
1094// RUN: %clang_cc1 -DCK16 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1095// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY15 %s
1096// SIMD-ONLY15-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001097#ifdef CK16
1098
1099// CK16-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
1100// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +00001101// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +00001102// CK16-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001103
1104template<int y>
1105int foo(int d) {
1106 int res = d;
1107 #pragma omp target
1108 {
1109 res += y;
1110 }
1111 return res;
1112}
1113// CK16-LABEL: implicit_maps_templated_function
1114void implicit_maps_templated_function (int a){
1115 int i = a;
1116
1117 // CK16: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
George Rokos63bc9d62017-11-21 18:25:12 +00001118 // CK16-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001119 // CK16-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1120 // CK16-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1121
1122 // CK16-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1123 // CK16-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001124 // CK16-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
1125 // CK16-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
1126 // CK16-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
1127 // CK16-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001128 // CK16-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1129 // CK16-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1130 // CK16-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1131
1132 // CK16: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
1133 i = foo<543>(i);
1134}
1135// CK16: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
1136// CK16: [[ADDR:%.+]] = alloca i[[sz]],
1137// CK16: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
1138// CK16-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
1139// CK16-64: {{.+}} = load i32, i32* [[CADDR]],
1140// CK16-32: {{.+}} = load i32, i32* [[ADDR]],
1141
1142#endif
1143///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00001144// 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
1145// 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
1146// 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
1147// 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
1148// 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
1149// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001150
1151// RUN: %clang_cc1 -DCK17 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY16 %s
1152// RUN: %clang_cc1 -DCK17 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1153// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY16 %s
1154// RUN: %clang_cc1 -DCK17 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY16 %s
1155// RUN: %clang_cc1 -DCK17 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1156// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY16 %s
1157// SIMD-ONLY16-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001158#ifdef CK17
1159
1160// CK17-DAG: [[ST:%.+]] = type { i32, double }
1161// CK17-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} {{16|12}}]
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001162// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST + OMP_MAP_IMPLICIT = 547
George Rokos63bc9d62017-11-21 18:25:12 +00001163// CK17-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001164
1165class SSS {
1166public:
1167 int a;
1168 double b;
1169};
1170
1171// CK17-LABEL: implicit_maps_struct
1172void implicit_maps_struct (int a){
1173 SSS s = {a, (double)a};
1174
George Rokos63bc9d62017-11-21 18:25:12 +00001175 // CK17-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001176 // CK17-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1177 // CK17-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1178 // CK17-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1179 // CK17-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001180 // CK17-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
1181 // CK17-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[ST]]**
1182 // CK17-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP1]]
1183 // CK17-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001184
1185 // CK17: call void [[KERNEL:@.+]]([[ST]]* [[DECL]])
1186 #pragma omp target
1187 {
1188 s.a += 1;
1189 s.b += 1.0;
1190 }
1191}
1192
1193// CK17: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]])
1194// CK17: [[ADDR:%.+]] = alloca [[ST]]*,
1195// CK17: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]],
1196// CK17: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]],
1197// CK17: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0
1198#endif
1199///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00001200// 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
1201// 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
1202// 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
1203// 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
1204// 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
1205// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001206
1207// RUN: %clang_cc1 -DCK18 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY17 %s
1208// RUN: %clang_cc1 -DCK18 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1209// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY17 %s
1210// RUN: %clang_cc1 -DCK18 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY17 %s
1211// RUN: %clang_cc1 -DCK18 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1212// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY17 %s
1213// SIMD-ONLY17-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001214#ifdef CK18
1215
1216// CK18-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
1217// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +00001218// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
George Rokos63bc9d62017-11-21 18:25:12 +00001219// CK18-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001220
1221template<typename T>
1222int foo(T d) {
1223 #pragma omp target
1224 {
1225 d += (T)1;
1226 }
1227 return d;
1228}
1229// CK18-LABEL: implicit_maps_template_type_capture
1230void implicit_maps_template_type_capture (int a){
1231 int i = a;
1232
1233 // CK18: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
George Rokos63bc9d62017-11-21 18:25:12 +00001234 // CK18-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001235 // CK18-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1236 // CK18-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1237
1238 // CK18-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1239 // CK18-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001240 // CK18-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
1241 // CK18-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
1242 // CK18-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
1243 // CK18-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001244 // CK18-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1245 // CK18-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1246 // CK18-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1247
1248 // CK18: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
1249 i = foo(i);
1250}
1251// CK18: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
1252// CK18: [[ADDR:%.+]] = alloca i[[sz]],
1253// CK18: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
1254// CK18-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
1255// CK18-64: {{.+}} = load i32, i32* [[CADDR]],
1256// CK18-32: {{.+}} = load i32, i32* [[ADDR]],
1257
1258#endif
Samuel Antao86ace552016-04-27 22:40:57 +00001259///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00001260// 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
1261// 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
1262// 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
1263// 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
1264// 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
1265// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001266
1267// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY18 %s
1268// RUN: %clang_cc1 -DCK19 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1269// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY18 %s
1270// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY18 %s
1271// RUN: %clang_cc1 -DCK19 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1272// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY18 %s
1273// SIMD-ONLY18-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00001274#ifdef CK19
1275
1276// CK19: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001277// CK19: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001278
Jonas Hahnfeldf7c4d7b2017-07-01 10:40:50 +00001279// CK19: [[SIZE00n:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001280// CK19: [[MTYPE00n:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Jonas Hahnfeldf7c4d7b2017-07-01 10:40:50 +00001281
Samuel Antao86ace552016-04-27 22:40:57 +00001282// CK19: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00001283// CK19: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001284
1285// CK19: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001286// CK19: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001287
1288// CK19: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001289// CK19: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001290
1291// CK19: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00001292// CK19: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001293
1294// CK19: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001295// CK19: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001296
George Rokos63bc9d62017-11-21 18:25:12 +00001297// CK19: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001298
George Rokos63bc9d62017-11-21 18:25:12 +00001299// CK19: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001300
1301// CK19: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001302// CK19: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001303
1304// CK19: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00001305// CK19: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001306
1307// CK19: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001308// CK19: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001309
1310// CK19: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001311// CK19: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001312
1313// CK19: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001314// CK19: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001315
George Rokos63bc9d62017-11-21 18:25:12 +00001316// CK19: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001317
George Rokos63bc9d62017-11-21 18:25:12 +00001318// CK19: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001319
1320// CK19: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001321// CK19: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001322
George Rokos63bc9d62017-11-21 18:25:12 +00001323// CK19: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001324
1325// CK19: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001326// CK19: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001327
1328// CK19: [[SIZE18:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001329// CK19: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001330
George Rokos63bc9d62017-11-21 18:25:12 +00001331// CK19: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001332
1333// CK19: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001334// CK19: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001335
George Rokos63bc9d62017-11-21 18:25:12 +00001336// CK19: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001337
1338// CK19: [[SIZE22:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001339// CK19: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001340
1341// CK19: [[SIZE23:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001342// CK19: [[MTYPE23:@.+]] = private {{.*}}constant [1 x i64] [i64 39]
Samuel Antao86ace552016-04-27 22:40:57 +00001343
1344// CK19: [[SIZE24:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 480]
George Rokos63bc9d62017-11-21 18:25:12 +00001345// CK19: [[MTYPE24:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001346
1347// CK19: [[SIZE25:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00001348// CK19: [[MTYPE25:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001349
1350// CK19: [[SIZE26:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 24]
George Rokos63bc9d62017-11-21 18:25:12 +00001351// CK19: [[MTYPE26:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001352
1353// CK19: [[SIZE27:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001354// CK19: [[MTYPE27:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001355
1356// CK19: [[SIZE28:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00001357// CK19: [[MTYPE28:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 19, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001358
1359// CK19: [[SIZE29:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001360// CK19: [[MTYPE29:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 19, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001361
George Rokos63bc9d62017-11-21 18:25:12 +00001362// CK19: [[MTYPE30:@.+]] = private {{.*}}constant [4 x i64] [i64 288, i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001363
1364// CK19: [[SIZE31:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 40]
George Rokos63bc9d62017-11-21 18:25:12 +00001365// CK19: [[MTYPE31:@.+]] = private {{.*}}constant [4 x i64] [i64 288, i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001366
1367// CK19: [[SIZE32:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
George Rokos63bc9d62017-11-21 18:25:12 +00001368// CK19: [[MTYPE32:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001369
1370// CK19: [[SIZE33:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
George Rokos63bc9d62017-11-21 18:25:12 +00001371// CK19: [[MTYPE33:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001372
1373// CK19: [[SIZE34:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
George Rokos63bc9d62017-11-21 18:25:12 +00001374// CK19: [[MTYPE34:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001375
George Rokos63bc9d62017-11-21 18:25:12 +00001376// CK19: [[MTYPE35:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001377
1378// CK19: [[SIZE36:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 208]
George Rokos63bc9d62017-11-21 18:25:12 +00001379// CK19: [[MTYPE36:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001380
George Rokos63bc9d62017-11-21 18:25:12 +00001381// CK19: [[MTYPE37:@.+]] = private {{.*}}constant [3 x i64] [i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001382
George Rokos63bc9d62017-11-21 18:25:12 +00001383// CK19: [[MTYPE38:@.+]] = private {{.*}}constant [3 x i64] [i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001384
George Rokos63bc9d62017-11-21 18:25:12 +00001385// CK19: [[MTYPE39:@.+]] = private {{.*}}constant [3 x i64] [i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001386
George Rokos63bc9d62017-11-21 18:25:12 +00001387// CK19: [[MTYPE40:@.+]] = private {{.*}}constant [3 x i64] [i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001388
1389// CK19: [[SIZE41:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 208]
George Rokos63bc9d62017-11-21 18:25:12 +00001390// CK19: [[MTYPE41:@.+]] = private {{.*}}constant [3 x i64] [i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001391
1392// CK19: [[SIZE42:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 104]
George Rokos63bc9d62017-11-21 18:25:12 +00001393// CK19: [[MTYPE42:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 19, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001394
George Rokos63bc9d62017-11-21 18:25:12 +00001395// CK19: [[MTYPE43:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001396
1397// CK19-LABEL: explicit_maps_single
1398void explicit_maps_single (int ii){
1399 // Map of a scalar.
1400 int a = ii;
1401
1402 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00001403 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001404 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1405 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1406
1407 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1408 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001409 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1410 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1411 // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
1412 // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001413
1414 // CK19: call void [[CALL00:@.+]](i32* {{[^,]+}})
1415 #pragma omp target map(alloc:a)
1416 {
1417 ++a;
1418 }
1419
Jonas Hahnfeldf7c4d7b2017-07-01 10:40:50 +00001420 // Map of a scalar in nested region.
1421 int b = a;
1422
1423 // Region 00n
George Rokos63bc9d62017-11-21 18:25:12 +00001424 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00n]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00n]]{{.+}})
Jonas Hahnfeldf7c4d7b2017-07-01 10:40:50 +00001425 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1426 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1427
1428 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1429 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1430 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1431 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1432 // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
1433 // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
1434
1435 // CK19: call void [[CALL00n:@.+]](i32* {{[^,]+}})
1436 #pragma omp target map(alloc:b)
1437 #pragma omp parallel
1438 {
1439 ++b;
1440 }
1441
Samuel Antao86ace552016-04-27 22:40:57 +00001442 // Map of an array.
1443 int arra[100];
1444
1445 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00001446 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001447 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1448 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1449
1450 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1451 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001452 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1453 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]**
1454 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1455 // CK19-DAG: store [100 x i32]* [[VAR0]], [100 x i32]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001456
1457 // CK19: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
1458 #pragma omp target map(to:arra)
1459 {
1460 arra[50]++;
1461 }
1462
1463 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00001464 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001465 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1466 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1467
1468 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1469 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001470 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1471 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1472 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1473 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001474 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 20
1475
1476 // CK19: call void [[CALL02:@.+]]([100 x i32]* {{[^,]+}})
1477 #pragma omp target map(from:arra[20:60])
1478 {
1479 arra[50]++;
1480 }
1481
1482 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00001483 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001484 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1485 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1486
1487 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1488 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001489 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1490 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1491 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1492 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001493 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1494
1495 // CK19: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
1496 #pragma omp target map(tofrom:arra[:60])
1497 {
1498 arra[50]++;
1499 }
1500
1501 // Region 04
George Rokos63bc9d62017-11-21 18:25:12 +00001502 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001503 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1504 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1505
1506 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1507 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001508 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1509 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1510 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1511 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001512 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1513
1514 // CK19: call void [[CALL04:@.+]]([100 x i32]* {{[^,]+}})
1515 #pragma omp target map(alloc:arra[:])
1516 {
1517 arra[50]++;
1518 }
1519
1520 // Region 05
George Rokos63bc9d62017-11-21 18:25:12 +00001521 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001522 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1523 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1524
1525 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1526 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001527 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1528 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1529 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1530 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001531 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 15
1532
1533 // CK19: call void [[CALL05:@.+]]([100 x i32]* {{[^,]+}})
1534 #pragma omp target map(to:arra[15])
1535 {
1536 arra[15]++;
1537 }
1538
1539 // Region 06
George Rokos63bc9d62017-11-21 18:25:12 +00001540 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001541 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1542 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1543 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1544
1545 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1546 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1547 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001548 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1549 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1550 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1551 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001552 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001553 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1554 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1555
1556 // CK19: call void [[CALL06:@.+]]([100 x i32]* {{[^,]+}})
1557 #pragma omp target map(tofrom:arra[ii:ii+23])
1558 {
1559 arra[50]++;
1560 }
1561
1562 // Region 07
George Rokos63bc9d62017-11-21 18:25:12 +00001563 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001564 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1565 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1566 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1567
1568 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1569 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1570 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001571 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1572 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1573 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1574 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001575 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001576 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1577 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1578
1579 // CK19: call void [[CALL07:@.+]]([100 x i32]* {{[^,]+}})
1580 #pragma omp target map(alloc:arra[:ii])
1581 {
1582 arra[50]++;
1583 }
1584
1585 // Region 08
George Rokos63bc9d62017-11-21 18:25:12 +00001586 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001587 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1588 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1589
1590 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1591 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001592 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1593 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1594 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1595 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001596 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1597
1598 // CK19: call void [[CALL08:@.+]]([100 x i32]* {{[^,]+}})
1599 #pragma omp target map(tofrom:arra[ii])
1600 {
1601 arra[15]++;
1602 }
1603
1604 // Map of a pointer.
1605 int *pa;
1606
1607 // Region 09
George Rokos63bc9d62017-11-21 18:25:12 +00001608 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001609 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1610 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1611
1612 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1613 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001614 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
1615 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
1616 // CK19-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]]
1617 // CK19-DAG: store i32** [[VAR0]], i32*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001618
1619 // CK19: call void [[CALL09:@.+]](i32** {{[^,]+}})
1620 #pragma omp target map(from:pa)
1621 {
1622 pa[50]++;
1623 }
1624
1625 // Region 10
George Rokos63bc9d62017-11-21 18:25:12 +00001626 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001627 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1628 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1629
1630 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1631 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001632 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1633 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1634 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1635 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001636 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1637 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 20
1638 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1639
1640 // CK19: call void [[CALL10:@.+]](i32* {{[^,]+}})
1641 #pragma omp target map(tofrom:pa[20:60])
1642 {
1643 pa[50]++;
1644 }
1645
1646 // Region 11
George Rokos63bc9d62017-11-21 18:25:12 +00001647 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001648 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1649 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1650
1651 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1652 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001653 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1654 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1655 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1656 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001657 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1658 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1659 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1660
1661 // CK19: call void [[CALL11:@.+]](i32* {{[^,]+}})
1662 #pragma omp target map(alloc:pa[:60])
1663 {
1664 pa[50]++;
1665 }
1666
1667 // Region 12
George Rokos63bc9d62017-11-21 18:25:12 +00001668 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001669 // 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 i32**
1675 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1676 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1677 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001678 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1679 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 15
1680 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1681
1682 // CK19: call void [[CALL12:@.+]](i32* {{[^,]+}})
1683 #pragma omp target map(to:pa[15])
1684 {
1685 pa[15]++;
1686 }
1687
1688 // Region 13
George Rokos63bc9d62017-11-21 18:25:12 +00001689 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001690 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1691 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1692 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1693
1694 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1695 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1696 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001697 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1698 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1699 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1700 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001701 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001702 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1703 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1704 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1705 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1706
1707 // CK19: call void [[CALL13:@.+]](i32* {{[^,]+}})
1708 #pragma omp target map(alloc:pa[ii-23:ii])
1709 {
1710 pa[50]++;
1711 }
1712
1713 // Region 14
George Rokos63bc9d62017-11-21 18:25:12 +00001714 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001715 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1716 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1717 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1718
1719 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1720 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1721 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001722 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1723 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1724 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1725 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001726 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001727 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1728 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1729 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1730 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1731
1732 // CK19: call void [[CALL14:@.+]](i32* {{[^,]+}})
1733 #pragma omp target map(to:pa[:ii])
1734 {
1735 pa[50]++;
1736 }
1737
1738 // Region 15
George Rokos63bc9d62017-11-21 18:25:12 +00001739 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001740 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1741 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1742
1743 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1744 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001745 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1746 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1747 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1748 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001749 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1750 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1751 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1752
1753 // CK19: call void [[CALL15:@.+]](i32* {{[^,]+}})
1754 #pragma omp target map(from:pa[ii+12])
1755 {
1756 pa[15]++;
1757 }
1758
1759 // Map of a variable-size array.
1760 int va[ii];
1761
1762 // Region 16
George Rokos63bc9d62017-11-21 18:25:12 +00001763 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE16]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001764 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1765 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1766 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1767
1768 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1769 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1770 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001771 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1772 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1773 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1774 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001775 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001776
1777 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1778 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1779 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001780 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1781 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1782 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1783 // CK19-DAG: store i32* [[VAR1]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001784 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001785 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1786
1787 // CK19: call void [[CALL16:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1788 #pragma omp target map(to:va)
1789 {
1790 va[50]++;
1791 }
1792
1793 // Region 17
George Rokos63bc9d62017-11-21 18:25:12 +00001794 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001795 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1796 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1797
1798 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1799 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001800 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1801 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1802 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1803 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001804
1805 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1806 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001807 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1808 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1809 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1810 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001811 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 20
1812
1813 // CK19: call void [[CALL17:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1814 #pragma omp target map(from:va[20:60])
1815 {
1816 va[50]++;
1817 }
1818
1819 // Region 18
George Rokos63bc9d62017-11-21 18:25:12 +00001820 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE18]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001821 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1822 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1823
1824 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1825 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001826 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1827 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1828 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1829 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001830
1831 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1832 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001833 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1834 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1835 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1836 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001837 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1838
1839 // CK19: call void [[CALL18:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1840 #pragma omp target map(tofrom:va[:60])
1841 {
1842 va[50]++;
1843 }
1844
1845 // Region 19
George Rokos63bc9d62017-11-21 18:25:12 +00001846 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001847 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1848 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1849 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1850
1851 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1852 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1853 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001854 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1855 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1856 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1857 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001858 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001859
1860 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1861 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1862 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001863 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1864 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1865 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1866 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001867 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001868 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1869 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1870
1871 // CK19: call void [[CALL19:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1872 #pragma omp target map(alloc:va[:])
1873 {
1874 va[50]++;
1875 }
1876
1877 // Region 20
George Rokos63bc9d62017-11-21 18:25:12 +00001878 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001879 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1880 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1881
1882 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1883 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001884 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1885 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1886 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1887 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001888
1889 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1890 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001891 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1892 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1893 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1894 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001895 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 15
1896
1897 // CK19: call void [[CALL20:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1898 #pragma omp target map(to:va[15])
1899 {
1900 va[15]++;
1901 }
1902
1903 // Region 21
George Rokos63bc9d62017-11-21 18:25:12 +00001904 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001905 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1906 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1907 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1908
1909 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1910 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1911 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001912 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1913 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1914 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1915 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001916 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001917
1918 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1919 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1920 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001921 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1922 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1923 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1924 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001925 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001926 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1927 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1928
1929 // CK19: call void [[CALL21:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1930 #pragma omp target map(tofrom:va[ii:ii+23])
1931 {
1932 va[50]++;
1933 }
1934
1935 // Region 22
George Rokos63bc9d62017-11-21 18:25:12 +00001936 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE22]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001937 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1938 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1939
1940 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1941 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001942 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1943 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1944 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1945 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001946
1947 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1948 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001949 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1950 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1951 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1952 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001953 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1954
1955 // CK19: call void [[CALL22:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1956 #pragma omp target map(tofrom:va[ii])
1957 {
1958 va[15]++;
1959 }
1960
1961 // Always.
1962 // Region 23
George Rokos63bc9d62017-11-21 18:25:12 +00001963 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE23]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001964 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1965 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1966
1967 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1968 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001969 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1970 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1971 // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
1972 // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001973
1974 // CK19: call void [[CALL23:@.+]](i32* {{[^,]+}})
1975 #pragma omp target map(always, tofrom: a)
1976 {
1977 a++;
1978 }
1979
1980 // Multidimensional arrays.
1981 int marr[4][5][6];
1982 int ***mptr;
1983
1984 // Region 24
George Rokos63bc9d62017-11-21 18:25:12 +00001985 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE24]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00001986 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1987 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1988
1989 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1990 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001991 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
1992 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [4 x [5 x [6 x i32]]]**
1993 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
1994 // 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 +00001995
1996 // CK19: call void [[CALL24:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1997 #pragma omp target map(tofrom: marr)
1998 {
1999 marr[1][2][3]++;
2000 }
2001
2002 // Region 25
George Rokos63bc9d62017-11-21 18:25:12 +00002003 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE25]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE25]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002004 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2005 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2006
2007 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2008 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002009 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
2010 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2011 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
2012 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002013 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 2
2014 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
2015 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2016
2017 // CK19: call void [[CALL25:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
2018 #pragma omp target map(tofrom: marr[1][2][2:4])
2019 {
2020 marr[1][2][3]++;
2021 }
2022
2023 // Region 26
George Rokos63bc9d62017-11-21 18:25:12 +00002024 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE26]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE26]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002025 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2026 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2027
2028 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2029 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002030 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
2031 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2032 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
2033 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002034 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 0
2035 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
2036 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2037
2038 // CK19: call void [[CALL26:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
2039 #pragma omp target map(tofrom: marr[1][2][:])
2040 {
2041 marr[1][2][3]++;
2042 }
2043
2044 // Region 27
George Rokos63bc9d62017-11-21 18:25:12 +00002045 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE27]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE27]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002046 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2047 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2048
2049 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2050 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002051 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
2052 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2053 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
2054 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002055 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 3
2056 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
2057 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2058
2059 // CK19: call void [[CALL27:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
2060 #pragma omp target map(tofrom: marr[1][2][3])
2061 {
2062 marr[1][2][3]++;
2063 }
2064
2065 // Region 28
George Rokos63bc9d62017-11-21 18:25:12 +00002066 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE28]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE28]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002067 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2068 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2069
2070 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2071 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002072 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32****
2073 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32****
2074 // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]]
2075 // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002076 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
2077 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
2078 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
2079
2080 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2081 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002082 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32****
2083 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32***
2084 // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]]
2085 // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002086 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
2087 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
2088 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
2089 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
2090
2091 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2092 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002093 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32***
2094 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
2095 // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]]
2096 // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002097 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 2
2098 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
2099 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
2100 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
2101 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
2102 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
2103
2104 // CK19: call void [[CALL28:@.+]](i32*** {{[^,]+}})
2105 #pragma omp target map(tofrom: mptr[1][2][2:4])
2106 {
2107 mptr[1][2][3]++;
2108 }
2109
2110 // Region 29
George Rokos63bc9d62017-11-21 18:25:12 +00002111 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE29]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE29]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002112 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2113 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2114
2115 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2116 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002117 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32****
2118 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32****
2119 // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]]
2120 // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002121 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
2122 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
2123 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
2124
2125 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2126 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002127 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32****
2128 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32***
2129 // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]]
2130 // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002131 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
2132 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
2133 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
2134 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
2135
2136 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2137 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002138 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32***
2139 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
2140 // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]]
2141 // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002142 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 3
2143 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
2144 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
2145 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
2146 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
2147 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
2148
2149 // CK19: call void [[CALL29:@.+]](i32*** {{[^,]+}})
2150 #pragma omp target map(tofrom: mptr[1][2][3])
2151 {
2152 mptr[1][2][3]++;
2153 }
2154
2155 // Multidimensional VLA.
2156 double mva[23][ii][ii+5];
2157
2158 // Region 30
George Rokos63bc9d62017-11-21 18:25:12 +00002159 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE30]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002160 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2161 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2162 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2163 //
2164 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2165 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2166 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002167 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2168 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2169 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]]
2170 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002171 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2172 //
2173 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2174 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2175 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002176 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2177 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2178 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2179 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002180 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002181 // CK19-64-DAG: [[VAR1]] = zext i32 %{{[^,]+}} to i64
2182 // CK19-64-DAG: [[VAR11]] = zext i32 %{{[^,]+}} to i64
2183 //
2184 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2185 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2186 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002187 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]*
2188 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]*
2189 // CK19-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]]
2190 // CK19-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002191 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002192 // CK19-64-DAG: [[VAR2]] = zext i32 %{{[^,]+}} to i64
2193 // CK19-64-DAG: [[VAR22]] = zext i32 %{{[^,]+}} to i64
2194 //
2195 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
2196 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
2197 // CK19-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002198 // CK19-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double**
2199 // CK19-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
2200 // CK19-DAG: store double* [[VAR3:%.+]], double** [[CBP3]]
2201 // CK19-DAG: store double* [[VAR3]], double** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00002202 // CK19-DAG: store i[[Z]] [[CSVAL3:%[^,]+]], i[[Z]]* [[S3]]
Samuel Antao86ace552016-04-27 22:40:57 +00002203 // CK19-DAG: [[CSVAL3]] = mul nuw i[[Z]] %{{[^,]+}}, {{8|4}}
2204
2205 // CK19: call void [[CALL30:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
2206 #pragma omp target map(tofrom: mva)
2207 {
2208 mva[1][2][3]++;
2209 }
2210
2211 // Region 31
George Rokos63bc9d62017-11-21 18:25:12 +00002212 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE31]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE31]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002213 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2214 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2215 //
2216 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2217 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002218 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2219 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2220 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]]
2221 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002222 //
2223 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2224 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002225 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2226 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2227 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2228 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002229 //
2230 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2231 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002232 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]*
2233 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]*
2234 // CK19-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]]
2235 // CK19-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002236 //
2237 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
2238 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002239 // CK19-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double**
2240 // CK19-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
2241 // CK19-DAG: store double* [[VAR3:%.+]], double** [[CBP3]]
2242 // CK19-DAG: store double* [[SEC3:%.+]], double** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00002243 // CK19-DAG: [[SEC3]] = getelementptr {{.*}}double* [[SEC33:%.+]], i[[Z]] 0
2244 // CK19-DAG: [[SEC33]] = getelementptr {{.*}}double* [[SEC333:%.+]], i[[Z]] [[IDX3:%.+]]
2245 // CK19-DAG: [[IDX3]] = mul nsw i[[Z]] %{{[^,]+}}, %{{[^,]+}}
2246 // CK19-DAG: [[SEC333]] = getelementptr {{.*}}double* [[VAR3]], i[[Z]] [[IDX33:%.+]]
2247 // CK19-DAG: [[IDX33]] = mul nsw i[[Z]] 1, %{{[^,]+}}
2248
2249 // CK19: call void [[CALL31:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
2250 #pragma omp target map(tofrom: mva[1][ii-2][:5])
2251 {
2252 mva[1][2][3]++;
2253 }
2254
2255 // Multidimensional array sections.
2256 double marras[11][12][13];
2257 double mvlaas[11][ii][13];
2258 double ***mptras;
2259
2260 // Region 32
George Rokos63bc9d62017-11-21 18:25:12 +00002261 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE32]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE32]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002262 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2263 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2264
2265 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2266 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002267 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2268 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [11 x [12 x [13 x double]]]**
2269 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2270 // 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 +00002271
2272 // CK19: call void [[CALL32:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2273 #pragma omp target map(marras)
2274 {
2275 marras[1][2][3]++;
2276 }
2277
2278 // Region 33
George Rokos63bc9d62017-11-21 18:25:12 +00002279 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE33]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE33]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002280 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2281 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2282
2283 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2284 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002285 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2286 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]**
2287 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2288 // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002289 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2290
2291 // CK19: call void [[CALL33:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2292 #pragma omp target map(marras[:])
2293 {
2294 marras[1][2][3]++;
2295 }
2296
2297 // Region 34
George Rokos63bc9d62017-11-21 18:25:12 +00002298 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE34]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE34]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002299 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2300 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2301
2302 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2303 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002304 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2305 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]**
2306 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2307 // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002308 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2309
2310 // CK19: call void [[CALL34:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2311 #pragma omp target map(marras[:][:][:])
2312 {
2313 marras[1][2][3]++;
2314 }
2315
2316 // Region 35
George Rokos63bc9d62017-11-21 18:25:12 +00002317 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE35]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002318 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2319 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2320 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2321 //
2322 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2323 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2324 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2325
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002326 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2327 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2328 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2329 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002330 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002331 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2332 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2333 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2334
2335 // CK19: call void [[CALL35:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2336 #pragma omp target map(marras[1][:ii][:])
2337 {
2338 marras[1][2][3]++;
2339 }
2340
2341 // Region 36
George Rokos63bc9d62017-11-21 18:25:12 +00002342 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE36]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE36]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002343 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2344 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2345
2346 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2347 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002348 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2349 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2350 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2351 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002352 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i{{.+}} 0
2353 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 0
2354 // CK19-DAG: [[SEC000]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2355
2356 // CK19: call void [[CALL36:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2357 #pragma omp target map(marras[:1][:2][:13])
2358 {
2359 marras[1][2][3]++;
2360 }
2361
2362 // Region 37
George Rokos63bc9d62017-11-21 18:25:12 +00002363 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE37]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002364 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2365 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2366 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2367 //
2368 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2369 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2370 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002371 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2372 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2373 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2374 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002375 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2376 //
2377 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2378 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2379 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002380 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2381 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2382 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2383 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002384 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002385 //
2386 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2387 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2388 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002389 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2390 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2391 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2392 // CK19-DAG: store [13 x double]* [[VAR2]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002393 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002394 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2395
2396 // CK19: call void [[CALL37:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2397 #pragma omp target map(mvlaas)
2398 {
2399 mvlaas[1][2][3]++;
2400 }
2401
2402 // Region 38
George Rokos63bc9d62017-11-21 18:25:12 +00002403 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE38]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002404 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2405 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2406 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2407 //
2408 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2409 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2410 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002411 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2412 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2413 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2414 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002415 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2416 //
2417 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2418 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2419 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002420 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2421 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2422 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2423 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002424 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002425 //
2426 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2427 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2428 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002429 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2430 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2431 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2432 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002433 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002434 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2435 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2436 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2437
2438 // CK19: call void [[CALL38:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2439 #pragma omp target map(mvlaas[:])
2440 {
2441 mvlaas[1][2][3]++;
2442 }
2443
2444 // Region 39
George Rokos63bc9d62017-11-21 18:25:12 +00002445 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE39]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002446 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2447 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2448 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2449 //
2450 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2451 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2452 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002453 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2454 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2455 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2456 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002457 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2458 //
2459 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2460 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2461 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002462 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2463 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2464 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2465 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002466 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002467 //
2468 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2469 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2470 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002471 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2472 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2473 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2474 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002475 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002476 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2477 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2478 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2479
2480 // CK19: call void [[CALL39:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2481 #pragma omp target map(mvlaas[:][:][:])
2482 {
2483 mvlaas[1][2][3]++;
2484 }
2485
2486 // Region 40
George Rokos63bc9d62017-11-21 18:25:12 +00002487 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE40]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002488 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2489 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2490 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2491 //
2492 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2493 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2494 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002495 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2496 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2497 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2498 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002499 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2500 //
2501 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2502 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2503 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002504 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2505 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2506 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2507 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002508 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002509 //
2510 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2511 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2512 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002513 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2514 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2515 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2516 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002517 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002518 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2519 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2520 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 1, %{{[^,]+}}
2521
2522 // CK19: call void [[CALL40:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2523 #pragma omp target map(mvlaas[1][:ii][:])
2524 {
2525 mvlaas[1][2][3]++;
2526 }
2527
2528 // Region 41
George Rokos63bc9d62017-11-21 18:25:12 +00002529 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE41]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE41]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002530 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2531 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2532 //
2533 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2534 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002535 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2536 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2537 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2538 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002539 //
2540 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2541 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002542 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2543 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2544 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2545 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002546 //
2547 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2548 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002549 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2550 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2551 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2552 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002553 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2554 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2555 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2556
2557 // CK19: call void [[CALL41:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2558 #pragma omp target map(mvlaas[:1][:2][:13])
2559 {
2560 mvlaas[1][2][3]++;
2561 }
2562
2563 // Region 42
George Rokos63bc9d62017-11-21 18:25:12 +00002564 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE42]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE42]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002565 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2566 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2567
2568 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2569 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002570 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to double****
2571 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double****
2572 // CK19-DAG: store double*** [[VAR0:%.+]], double**** [[CBP0]]
2573 // CK19-DAG: store double*** [[SEC0:%.+]], double**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002574 // CK19-DAG: [[VAR0]] = load double***, double**** [[PTR:%[^,]+]],
2575 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}double*** [[SEC00:[^,]+]], i{{.+}} 0
2576 // CK19-DAG: [[SEC00]] = load double***, double**** [[PTR]],
2577
2578 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2579 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002580 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double****
2581 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double***
2582 // CK19-DAG: store double*** [[SEC0]], double**** [[CBP1]]
2583 // CK19-DAG: store double** [[SEC1:%.+]], double*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002584 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}double** [[SEC11:[^,]+]], i{{.+}} 2
2585 // CK19-DAG: [[SEC11]] = load double**, double*** [[SEC111:%[^,]+]],
2586 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}double*** [[SEC1111:[^,]+]], i{{.+}} 0
2587 // CK19-DAG: [[SEC1111]] = load double***, double**** [[PTR]],
2588
2589 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2590 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002591 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double***
2592 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
2593 // CK19-DAG: store double** [[SEC1]], double*** [[CBP2]]
2594 // CK19-DAG: store double* [[SEC2:%.+]], double** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002595 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}double* [[SEC22:[^,]+]], i{{.+}} 0
2596 // CK19-DAG: [[SEC22]] = load double*, double** [[SEC222:%[^,]+]],
2597 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}double** [[SEC2222:[^,]+]], i{{.+}} 2
2598 // CK19-DAG: [[SEC2222]] = load double**, double*** [[SEC22222:%[^,]+]],
2599 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}double*** [[SEC222222:[^,]+]], i{{.+}} 0
2600 // CK19-DAG: [[SEC222222]] = load double***, double**** [[PTR]],
2601
2602 // CK19: call void [[CALL42:@.+]](double*** {{[^,]+}})
2603 #pragma omp target map(mptras[:1][2][:13])
2604 {
2605 mptras[1][2][3]++;
2606 }
2607
2608 // Region 43 - the memory is not contiguous for this map - will map the whole last dimension.
George Rokos63bc9d62017-11-21 18:25:12 +00002609 // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE43]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002610 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2611 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2612 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2613 //
2614 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2615 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2616 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2617
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002618 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2619 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2620 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2621 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002622 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002623 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2624 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2625 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2626
2627 // CK19: call void [[CALL43:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2628 #pragma omp target map(marras[1][:ii][1:])
2629 {
2630 marras[1][2][3]++;
2631 }
2632
2633}
2634
2635// CK19: define {{.+}}[[CALL00]]
Jonas Hahnfeldf7c4d7b2017-07-01 10:40:50 +00002636// CK19: define {{.+}}[[CALL00n]]
Samuel Antao86ace552016-04-27 22:40:57 +00002637// CK19: define {{.+}}[[CALL01]]
2638// CK19: define {{.+}}[[CALL02]]
2639// CK19: define {{.+}}[[CALL03]]
2640// CK19: define {{.+}}[[CALL04]]
2641// CK19: define {{.+}}[[CALL05]]
2642// CK19: define {{.+}}[[CALL06]]
2643// CK19: define {{.+}}[[CALL07]]
2644// CK19: define {{.+}}[[CALL08]]
2645// CK19: define {{.+}}[[CALL09]]
2646// CK19: define {{.+}}[[CALL10]]
2647// CK19: define {{.+}}[[CALL11]]
2648// CK19: define {{.+}}[[CALL12]]
2649// CK19: define {{.+}}[[CALL13]]
2650// CK19: define {{.+}}[[CALL14]]
2651// CK19: define {{.+}}[[CALL15]]
2652// CK19: define {{.+}}[[CALL16]]
2653// CK19: define {{.+}}[[CALL17]]
2654// CK19: define {{.+}}[[CALL18]]
2655// CK19: define {{.+}}[[CALL19]]
2656// CK19: define {{.+}}[[CALL20]]
2657// CK19: define {{.+}}[[CALL21]]
2658// CK19: define {{.+}}[[CALL22]]
2659// CK19: define {{.+}}[[CALL23]]
2660// CK19: define {{.+}}[[CALL24]]
2661// CK19: define {{.+}}[[CALL25]]
2662// CK19: define {{.+}}[[CALL26]]
2663// CK19: define {{.+}}[[CALL27]]
2664// CK19: define {{.+}}[[CALL28]]
2665// CK19: define {{.+}}[[CALL29]]
2666// CK19: define {{.+}}[[CALL30]]
2667// CK19: define {{.+}}[[CALL31]]
2668// CK19: define {{.+}}[[CALL32]]
2669// CK19: define {{.+}}[[CALL33]]
2670// CK19: define {{.+}}[[CALL34]]
2671// CK19: define {{.+}}[[CALL35]]
2672// CK19: define {{.+}}[[CALL36]]
2673// CK19: define {{.+}}[[CALL37]]
2674// CK19: define {{.+}}[[CALL38]]
2675// CK19: define {{.+}}[[CALL39]]
2676// CK19: define {{.+}}[[CALL40]]
2677// CK19: define {{.+}}[[CALL41]]
2678// CK19: define {{.+}}[[CALL42]]
2679// CK19: define {{.+}}[[CALL43]]
2680
2681#endif
2682///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00002683// 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
2684// 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
2685// 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
2686// 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
2687// 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
2688// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00002689
2690// RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY19 %s
2691// RUN: %clang_cc1 -DCK20 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2692// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY19 %s
2693// RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY19 %s
2694// RUN: %clang_cc1 -DCK20 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2695// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY19 %s
2696// SIMD-ONLY19-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00002697#ifdef CK20
2698
2699// CK20: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00002700// CK20: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002701
2702// CK20: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
George Rokos63bc9d62017-11-21 18:25:12 +00002703// CK20: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002704
2705// CK20: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00002706// CK20: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002707
2708// CK20: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 12]
George Rokos63bc9d62017-11-21 18:25:12 +00002709// CK20: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002710
2711// CK20-LABEL: explicit_maps_references_and_function_args
2712void explicit_maps_references_and_function_args (int a, float b, int (&c)[10], float *d){
2713
2714 int &aa = a;
2715 float &bb = b;
2716 int (&cc)[10] = c;
2717 float *&dd = d;
2718
2719 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00002720 // CK20-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002721 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2722 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2723
2724 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2725 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002726 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2727 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2728 // CK20-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
2729 // CK20-DAG: store i32* [[RVAR00:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002730 // CK20-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2731 // CK20-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2732
2733 // CK20: call void [[CALL00:@.+]](i32* {{[^,]+}})
2734 #pragma omp target map(to:aa)
2735 {
2736 aa += 1;
2737 }
2738
2739 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00002740 // CK20-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002741 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2742 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2743
2744 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2745 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002746 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]**
2747 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2748 // CK20-DAG: store [10 x i32]* [[RVAR0:%.+]], [10 x i32]** [[CBP0]]
2749 // CK20-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002750 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[RVAR00:%.+]], i{{.+}} 0, i{{.+}} 0
2751 // CK20-DAG: [[RVAR0]] = load [10 x i32]*, [10 x i32]** [[VAR0:%[^,]+]]
2752 // CK20-DAG: [[RVAR00]] = load [10 x i32]*, [10 x i32]** [[VAR0]]
2753
2754 // CK20: call void [[CALL01:@.+]]([10 x i32]* {{[^,]+}})
2755 #pragma omp target map(to:cc[:5])
2756 {
2757 cc[3] += 1;
2758 }
2759
2760 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00002761 // CK20-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002762 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2763 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2764
2765 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2766 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002767 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
2768 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
2769 // CK20-DAG: store float* [[VAR0:%.+]], float** [[CBP0]]
2770 // CK20-DAG: store float* [[VAR0]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002771
2772 // CK20: call void [[CALL02:@.+]](float* {{[^,]+}})
2773 #pragma omp target map(from:b)
2774 {
2775 b += 1.0f;
2776 }
2777
2778 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00002779 // CK20-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002780 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2781 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2782
2783 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2784 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002785 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
2786 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
2787 // CK20-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]]
2788 // CK20-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002789 // CK20-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
2790 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
2791 // CK20-DAG: [[RVAR00]] = load float*, float** [[VAR0]]
2792
2793 // CK20: call void [[CALL03:@.+]](float* {{[^,]+}})
2794 #pragma omp target map(from:d[2:3])
2795 {
2796 d[2] += 1.0f;
2797 }
2798}
2799
2800// CK20: define {{.+}}[[CALL00]]
2801// CK20: define {{.+}}[[CALL01]]
2802// CK20: define {{.+}}[[CALL02]]
2803// CK20: define {{.+}}[[CALL03]]
2804
2805#endif
2806///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00002807// 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
2808// 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
2809// 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
2810// 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
2811// 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
2812// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00002813
2814// RUN: %clang_cc1 -DCK21 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY20 %s
2815// RUN: %clang_cc1 -DCK21 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2816// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY20 %s
2817// RUN: %clang_cc1 -DCK21 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY20 %s
2818// RUN: %clang_cc1 -DCK21 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2819// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY20 %s
2820// SIMD-ONLY20-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00002821#ifdef CK21
2822// CK21: [[ST:%.+]] = type { i32, i32, float* }
2823
2824// CK21: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00002825// CK21: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002826
2827// CK21: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
George Rokos63bc9d62017-11-21 18:25:12 +00002828// CK21: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002829
2830// CK21: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 500]
George Rokos63bc9d62017-11-21 18:25:12 +00002831// CK21: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i64] [i64 34, i64 18]
Samuel Antao86ace552016-04-27 22:40:57 +00002832
2833// CK21: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
George Rokos63bc9d62017-11-21 18:25:12 +00002834// CK21: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002835
2836// CK21: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00002837// CK21: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002838
2839// CK21: [[SIZE05:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] 4, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00002840// CK21: [[MTYPE05:@.+]] = private {{.*}}constant [2 x i64] [i64 35, i64 3]
Samuel Antao86ace552016-04-27 22:40:57 +00002841
2842// CK21-LABEL: explicit_maps_template_args_and_members
2843
2844template <int X, typename T>
2845struct CC {
2846 T A;
2847 int A2;
2848 float *B;
2849
2850 int foo(T arg) {
2851 float la[X];
2852 T *lb;
2853
2854 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00002855 // CK21-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002856 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2857 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2858
2859 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2860 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002861 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2862 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2863 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
2864 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002865 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
2866
2867 // CK21: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
2868 #pragma omp target map(A)
2869 {
2870 A += 1;
2871 }
2872
2873 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00002874 // CK21-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002875 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2876 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2877
2878 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2879 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002880 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2881 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2882 // CK21-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
2883 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002884 // CK21-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2885 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
2886 // CK21-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2887
2888 // CK21: call void [[CALL01:@.+]](i32* {{[^,]+}})
2889 #pragma omp target map(lb[:X])
2890 {
2891 lb[4] += 1;
2892 }
2893
2894 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00002895 // CK21-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002896 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2897 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2898
2899 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2900 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002901 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2902 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float***
2903 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
2904 // CK21-DAG: store float** [[SEC0:%.+]], float*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002905 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2906
2907 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2908 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002909 // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float***
2910 // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
2911 // CK21-DAG: store float** [[SEC0]], float*** [[CBP1]]
2912 // CK21-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002913 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}float* [[RVAR1:%[^,]+]], i{{.+}} 123
2914 // CK21-DAG: [[RVAR1]] = load float*, float** [[SEC1_:%[^,]+]]
2915 // CK21-DAG: [[SEC1_]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2916
2917 // CK21: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}})
2918 #pragma omp target map(from:B[X:X+2])
2919 {
2920 B[2] += 1.0f;
2921 }
2922
2923 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00002924 // CK21-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002925 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2926 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2927
2928 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2929 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002930 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [123 x float]**
2931 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [123 x float]**
2932 // CK21-DAG: store [123 x float]* [[VAR0:%.+]], [123 x float]** [[CBP0]]
2933 // CK21-DAG: store [123 x float]* [[VAR0]], [123 x float]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002934
2935 // CK21: call void [[CALL03:@.+]]([123 x float]* {{[^,]+}})
2936 #pragma omp target map(from:la)
2937 {
2938 la[3] += 1.0f;
2939 }
2940
2941 // Region 04
George Rokos63bc9d62017-11-21 18:25:12 +00002942 // CK21-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002943 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2944 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2945
2946 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2947 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002948 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2949 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2950 // CK21-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
2951 // CK21-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002952
2953 // CK21: call void [[CALL04:@.+]](i32* {{[^,]+}})
2954 #pragma omp target map(from:arg)
2955 {
2956 arg +=1;
2957 }
2958
2959 // Make sure the extra flag is passed to the second map.
2960 // Region 05
George Rokos63bc9d62017-11-21 18:25:12 +00002961 // CK21-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE05]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002962 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2963 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2964
2965 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2966 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002967 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2968 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2969 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
2970 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002971 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2972
2973 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2974 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002975 // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
2976 // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
2977 // CK21-DAG: store [[ST]]* [[VAR1:%.+]], [[ST]]** [[CBP1]]
2978 // CK21-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002979 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2980
2981 // CK21: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
2982 #pragma omp target map(A, A2)
2983 {
2984 A += 1;
2985 A2 += 1;
2986 }
2987 return A;
2988 }
2989};
2990
2991int explicit_maps_template_args_and_members(int a){
2992 CC<123,int> c;
2993 return c.foo(a);
2994}
2995
2996// CK21: define {{.+}}[[CALL00]]
2997// CK21: define {{.+}}[[CALL01]]
2998// CK21: define {{.+}}[[CALL02]]
2999// CK21: define {{.+}}[[CALL03]]
3000// CK21: define {{.+}}[[CALL04]]
3001// CK21: define {{.+}}[[CALL05]]
3002#endif
3003///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00003004// 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
3005// 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
3006// 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
3007// 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
3008// 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
3009// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003010
3011// RUN: %clang_cc1 -DCK22 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY21 %s
3012// RUN: %clang_cc1 -DCK22 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3013// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY21 %s
3014// RUN: %clang_cc1 -DCK22 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY21 %s
3015// RUN: %clang_cc1 -DCK22 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3016// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY21 %s
3017// SIMD-ONLY21-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00003018#ifdef CK22
3019
3020// CK22-DAG: [[ST:%.+]] = type { float }
3021// CK22-DAG: [[STT:%.+]] = type { i32 }
3022
3023// CK22: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003024// CK22: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003025
3026// CK22: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00003027// CK22: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003028
3029// CK22: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003030// CK22: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003031
3032// CK22: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00003033// CK22: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003034
3035// CK22: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
George Rokos63bc9d62017-11-21 18:25:12 +00003036// CK22: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003037
3038// CK22: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003039// CK22: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003040
3041// CK22: [[SIZE06:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00003042// CK22: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003043
3044// CK22: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003045// CK22: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003046
3047// CK22: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00003048// CK22: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003049
3050// CK22: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
George Rokos63bc9d62017-11-21 18:25:12 +00003051// CK22: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003052
3053// CK22: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003054// CK22: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003055
3056// CK22: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00003057// CK22: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003058
3059// CK22: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003060// CK22: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003061
3062// CK22: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00003063// CK22: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003064
3065// CK22: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
George Rokos63bc9d62017-11-21 18:25:12 +00003066// CK22: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003067
3068int a;
3069int c[100];
3070int *d;
3071
3072struct ST {
3073 float fa;
3074};
3075
3076ST sa ;
3077ST sc[100];
3078ST *sd;
3079
3080template<typename T>
3081struct STT {
3082 T fa;
3083};
3084
3085STT<int> sta ;
3086STT<int> stc[100];
3087STT<int> *std;
3088
3089// CK22-LABEL: explicit_maps_globals
3090int explicit_maps_globals(void){
3091 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00003092 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003093 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3094 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3095
3096 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3097 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003098 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
3099 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3100 // CK22-DAG: store i32* @a, i32** [[CBP0]]
3101 // CK22-DAG: store i32* @a, i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003102
3103 // CK22: call void [[CALL00:@.+]](i32* {{[^,]+}})
3104 #pragma omp target map(a)
3105 { a+=1; }
3106
3107 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00003108 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003109 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3110 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3111
3112 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3113 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003114 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
3115 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]**
3116 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]]
3117 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003118
3119 // CK22: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
3120 #pragma omp target map(c)
3121 { c[3]+=1; }
3122
3123 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00003124 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003125 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3126 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3127
3128 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3129 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003130 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
3131 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
3132 // CK22-DAG: store i32** @d, i32*** [[CBP0]]
3133 // CK22-DAG: store i32** @d, i32*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003134
3135 // CK22: call void [[CALL02:@.+]](i32** {{[^,]+}})
3136 #pragma omp target map(d)
3137 { d[3]+=1; }
3138
3139 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00003140 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003141 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3142 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3143
3144 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3145 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003146 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
3147 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3148 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]]
3149 // 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 +00003150
3151 // CK22: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
3152 #pragma omp target map(c[1:4])
3153 { c[3]+=1; }
3154
3155 // Region 04
George Rokos63bc9d62017-11-21 18:25:12 +00003156 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003157 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3158 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3159
3160 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3161 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003162 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
3163 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3164 // CK22-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
3165 // CK22-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003166 // CK22-DAG: [[RVAR0]] = load i32*, i32** @d
3167 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 2
3168 // CK22-DAG: [[RVAR00]] = load i32*, i32** @d
3169
3170 // CK22: call void [[CALL04:@.+]](i32* {{[^,]+}})
3171 #pragma omp target map(d[2:5])
3172 { d[3]+=1; }
3173
3174 // Region 05
George Rokos63bc9d62017-11-21 18:25:12 +00003175 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003176 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3177 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3178
3179 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3180 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003181 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
3182 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
3183 // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CBP0]]
3184 // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003185
3186 // CK22: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
3187 #pragma omp target map(sa)
3188 { sa.fa+=1; }
3189
3190 // Region 06
George Rokos63bc9d62017-11-21 18:25:12 +00003191 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003192 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3193 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3194
3195 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3196 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003197 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]**
3198 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[ST]]]**
3199 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]]
3200 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003201
3202 // CK22: call void [[CALL06:@.+]]([100 x [[ST]]]* {{[^,]+}})
3203 #pragma omp target map(sc)
3204 { sc[3].fa+=1; }
3205
3206 // Region 07
George Rokos63bc9d62017-11-21 18:25:12 +00003207 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003208 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3209 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3210
3211 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3212 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003213 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]***
3214 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]***
3215 // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CBP0]]
3216 // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003217
3218 // CK22: call void [[CALL07:@.+]]([[ST]]** {{[^,]+}})
3219 #pragma omp target map(sd)
3220 { sd[3].fa+=1; }
3221
3222 // Region 08
George Rokos63bc9d62017-11-21 18:25:12 +00003223 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003224 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3225 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3226
3227 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3228 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003229 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]**
3230 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
3231 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]]
3232 // 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 +00003233
3234 // CK22: call void [[CALL08:@.+]]([100 x [[ST]]]* {{[^,]+}})
3235 #pragma omp target map(sc[1:4])
3236 { sc[3].fa+=1; }
3237
3238 // Region 09
George Rokos63bc9d62017-11-21 18:25:12 +00003239 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003240 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3241 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3242
3243 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3244 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003245 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
3246 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
3247 // CK22-DAG: store [[ST]]* [[RVAR0:%.+]], [[ST]]** [[CBP0]]
3248 // CK22-DAG: store [[ST]]* [[SEC0:%.+]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003249 // CK22-DAG: [[RVAR0]] = load [[ST]]*, [[ST]]** @sd
3250 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[RVAR00:%.+]], i{{.+}} 2
3251 // CK22-DAG: [[RVAR00]] = load [[ST]]*, [[ST]]** @sd
3252
3253 // CK22: call void [[CALL09:@.+]]([[ST]]* {{[^,]+}})
3254 #pragma omp target map(sd[2:5])
3255 { sd[3].fa+=1; }
3256
3257 // Region 10
George Rokos63bc9d62017-11-21 18:25:12 +00003258 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003259 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3260 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3261
3262 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3263 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003264 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]**
3265 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
3266 // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CBP0]]
3267 // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003268
3269 // CK22: call void [[CALL10:@.+]]([[STT]]* {{[^,]+}})
3270 #pragma omp target map(sta)
3271 { sta.fa+=1; }
3272
3273 // Region 11
George Rokos63bc9d62017-11-21 18:25:12 +00003274 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003275 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3276 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3277
3278 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3279 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003280 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]**
3281 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[STT]]]**
3282 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]]
3283 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003284
3285 // CK22: call void [[CALL11:@.+]]([100 x [[STT]]]* {{[^,]+}})
3286 #pragma omp target map(stc)
3287 { stc[3].fa+=1; }
3288
3289 // Region 12
George Rokos63bc9d62017-11-21 18:25:12 +00003290 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003291 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3292 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3293
3294 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3295 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003296 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]***
3297 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]***
3298 // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CBP0]]
3299 // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003300
3301 // CK22: call void [[CALL12:@.+]]([[STT]]** {{[^,]+}})
3302 #pragma omp target map(std)
3303 { std[3].fa+=1; }
3304
3305 // Region 13
George Rokos63bc9d62017-11-21 18:25:12 +00003306 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003307 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3308 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3309
3310 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3311 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003312 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]**
3313 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
3314 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]]
3315 // 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 +00003316
3317 // CK22: call void [[CALL13:@.+]]([100 x [[STT]]]* {{[^,]+}})
3318 #pragma omp target map(stc[1:4])
3319 { stc[3].fa+=1; }
3320
3321 // Region 14
George Rokos63bc9d62017-11-21 18:25:12 +00003322 // CK22-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003323 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3324 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3325
3326 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3327 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003328 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]**
3329 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
3330 // CK22-DAG: store [[STT]]* [[RVAR0:%.+]], [[STT]]** [[CBP0]]
3331 // CK22-DAG: store [[STT]]* [[SEC0:%.+]], [[STT]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003332 // CK22-DAG: [[RVAR0]] = load [[STT]]*, [[STT]]** @std
3333 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[STT]]* [[RVAR00:%.+]], i{{.+}} 2
3334 // CK22-DAG: [[RVAR00]] = load [[STT]]*, [[STT]]** @std
3335
3336 // CK22: call void [[CALL14:@.+]]([[STT]]* {{[^,]+}})
3337 #pragma omp target map(std[2:5])
3338 { std[3].fa+=1; }
3339
3340 return 0;
3341}
3342// CK22: define {{.+}}[[CALL00]]
3343// CK22: define {{.+}}[[CALL01]]
3344// CK22: define {{.+}}[[CALL02]]
3345// CK22: define {{.+}}[[CALL03]]
3346// CK22: define {{.+}}[[CALL04]]
3347// CK22: define {{.+}}[[CALL05]]
3348// CK22: define {{.+}}[[CALL06]]
3349// CK22: define {{.+}}[[CALL07]]
3350// CK22: define {{.+}}[[CALL08]]
3351// CK22: define {{.+}}[[CALL09]]
3352// CK22: define {{.+}}[[CALL10]]
3353// CK22: define {{.+}}[[CALL11]]
3354// CK22: define {{.+}}[[CALL12]]
3355// CK22: define {{.+}}[[CALL13]]
3356// CK22: define {{.+}}[[CALL14]]
3357#endif
3358///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00003359// 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
3360// 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
3361// 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
3362// 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
3363// 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
3364// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003365
3366// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY22 %s
3367// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3368// RUN: %clang_cc1 -std=c++11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY22 %s
3369// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY22 %s
3370// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3371// RUN: %clang_cc1 -std=c++11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY22 %s
3372// SIMD-ONLY22-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00003373#ifdef CK23
3374
3375// CK23: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003376// CK23: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003377
3378// CK23: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003379// CK23: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003380
3381// CK23: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00003382// CK23: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003383
3384// CK23: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003385// CK23: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003386
3387// CK23: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00003388// CK23: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003389
3390// CK23: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00003391// CK23: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003392
3393// CK23-LABEL: explicit_maps_inside_captured
3394int explicit_maps_inside_captured(int a){
3395 float b;
3396 float c[100];
3397 float *d;
3398
3399 // CK23: call void @{{.*}}explicit_maps_inside_captured{{.*}}([[SA:%.+]]* {{.*}})
3400 // CK23: define {{.*}}explicit_maps_inside_captured{{.*}}
3401 [&](void){
3402 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00003403 // CK23-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003404 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3405 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3406
3407 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3408 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003409 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
3410 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3411 // CK23-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
3412 // CK23-DAG: store i32* [[VAR00:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003413 // CK23-DAG: [[VAR0]] = load i32*, i32** [[CAP0:%[^,]+]]
3414 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3415 // CK23-DAG: [[VAR00]] = load i32*, i32** [[CAP00:%[^,]+]]
3416 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3417
3418 // CK23: call void [[CALL00:@.+]](i32* {{[^,]+}})
3419 #pragma omp target map(a)
3420 { a+=1; }
3421 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00003422 // CK23-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003423 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3424 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3425
3426 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3427 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003428 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
3429 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3430 // CK23-DAG: store float* [[VAR0:%.+]], float** [[CBP0]]
3431 // CK23-DAG: store float* [[VAR00:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003432 // CK23-DAG: [[VAR0]] = load float*, float** [[CAP0:%[^,]+]]
3433 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3434 // CK23-DAG: [[VAR00]] = load float*, float** [[CAP00:%[^,]+]]
3435 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3436
3437 // CK23: call void [[CALL01:@.+]](float* {{[^,]+}})
3438 #pragma omp target map(b)
3439 { b+=1; }
3440 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00003441 // CK23-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003442 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3443 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3444
3445 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3446 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003447 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]**
3448 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x float]**
3449 // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]]
3450 // CK23-DAG: store [100 x float]* [[VAR00:%.+]], [100 x float]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003451 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3452 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3453 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3454 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3455
3456 // CK23: call void [[CALL02:@.+]]([100 x float]* {{[^,]+}})
3457 #pragma omp target map(c)
3458 { c[3]+=1; }
3459
3460 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00003461 // CK23-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003462 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3463 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3464
3465 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3466 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003467 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float***
3468 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float***
3469 // CK23-DAG: store float** [[VAR0:%.+]], float*** [[CBP0]]
3470 // CK23-DAG: store float** [[VAR00:%.+]], float*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003471 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3472 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3473 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3474 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3475
3476 // CK23: call void [[CALL03:@.+]](float** {{[^,]+}})
3477 #pragma omp target map(d)
3478 { d[3]+=1; }
3479 // Region 04
George Rokos63bc9d62017-11-21 18:25:12 +00003480 // CK23-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003481 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3482 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3483
3484 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3485 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003486 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]**
3487 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3488 // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]]
3489 // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003490 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}[100 x float]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3491 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3492 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3493 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3494 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3495
3496 // CK23: call void [[CALL04:@.+]]([100 x float]* {{[^,]+}})
3497 #pragma omp target map(c[2:4])
3498 { c[3]+=1; }
3499
3500 // Region 05
George Rokos63bc9d62017-11-21 18:25:12 +00003501 // CK23-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003502 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3503 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3504
3505 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3506 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003507 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
3508 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3509 // CK23-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]]
3510 // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003511 // CK23-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
3512 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
3513 // CK23-DAG: [[RVAR00]] = load float*, float** [[VAR00:%[^,]+]]
3514 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3515 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3516 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3517 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3518
3519 // CK23: call void [[CALL05:@.+]](float* {{[^,]+}})
3520 #pragma omp target map(d[2:4])
3521 { d[3]+=1; }
3522 }();
3523 return b;
3524}
3525
3526// CK23: define {{.+}}[[CALL00]]
3527// CK23: define {{.+}}[[CALL01]]
3528// CK23: define {{.+}}[[CALL02]]
3529// CK23: define {{.+}}[[CALL03]]
3530// CK23: define {{.+}}[[CALL04]]
3531// CK23: define {{.+}}[[CALL05]]
3532#endif
3533///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00003534// 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
3535// 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
3536// 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
3537// 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
3538// 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
3539// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003540
3541// RUN: %clang_cc1 -DCK24 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY23 %s
3542// RUN: %clang_cc1 -DCK24 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3543// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY23 %s
3544// RUN: %clang_cc1 -DCK24 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY23 %s
3545// RUN: %clang_cc1 -DCK24 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3546// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY23 %s
3547// SIMD-ONLY23-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00003548#ifdef CK24
3549
3550// CK24-DAG: [[SC:%.+]] = type { i32, [[SB:%.+]], [[SB:%.+]]*, [10 x i32] }
3551// CK24-DAG: [[SB]] = type { i32, [[SA:%.+]], [10 x [[SA:%.+]]], [10 x [[SA:%.+]]*], [[SA:%.+]]* }
3552// CK24-DAG: [[SA]] = type { i32, [[SA]]*, [10 x i32] }
3553
3554struct SA{
3555 int a;
3556 struct SA *p;
3557 int b[10];
3558};
3559struct SB{
3560 int a;
3561 struct SA s;
3562 struct SA sa[10];
3563 struct SA *sp[10];
3564 struct SA *p;
3565};
3566struct SC{
3567 int a;
3568 struct SB s;
3569 struct SB *p;
3570 int b[10];
3571};
3572
3573// CK24: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003574// CK24: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003575
Samuel Antao86ace552016-04-27 22:40:57 +00003576// CK24: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003577// CK24: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003578
3579// CK24: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{56|48}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003580// CK24: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003581
3582// CK24: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003583// CK24: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003584
3585// CK24: [[SIZE16:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
George Rokos63bc9d62017-11-21 18:25:12 +00003586// CK24: [[MTYPE16:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003587
3588// CK24: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{3560|2880}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003589// CK24: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i64] [i64 35, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003590
3591// CK24: [[SIZE18:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003592// CK24: [[MTYPE18:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003593
3594// CK24: [[SIZE19:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003595// CK24: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i64] [i64 35, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003596
3597// CK24: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003598// CK24: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i64] [i64 35, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003599
3600// CK24: [[SIZE21:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003601// CK24: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i64] [i64 35, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003602
3603// CK24: [[SIZE22:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003604// CK24: [[MTYPE22:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003605
3606// CK24: [[SIZE23:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003607// CK24: [[MTYPE23:@.+]] = private {{.*}}constant [2 x i64] [i64 35, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003608
3609// CK24: [[SIZE24:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003610// CK24: [[MTYPE24:@.+]] = private {{.*}}constant [4 x i64] [i64 35, i64 19, i64 19, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003611
3612// CK24-LABEL: explicit_maps_struct_fields
3613int explicit_maps_struct_fields(int a){
3614 SC s;
3615 SC *p;
3616
3617// Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00003618// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003619// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3620// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3621
3622// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3623// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003624// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3625// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3626// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3627// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003628// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
3629
3630// CK24: call void [[CALL01:@.+]]([[SC]]* {{[^,]+}})
3631#pragma omp target map(s.a)
3632 { s.a++; }
3633
Samuel Antao86ace552016-04-27 22:40:57 +00003634//
3635// Same thing but starting from a pointer.
3636//
3637// Region 13
George Rokos63bc9d62017-11-21 18:25:12 +00003638// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003639// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3640// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3641
3642// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3643// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003644// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3645// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3646// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3647// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003648// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 0
3649
3650// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3651// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3652
3653// CK24: call void [[CALL13:@.+]]([[SC]]* {{[^,]+}})
3654#pragma omp target map(p->a)
3655 { p->a++; }
3656
3657// Region 14
George Rokos63bc9d62017-11-21 18:25:12 +00003658// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003659// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3660// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3661
3662// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3663// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003664// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3665// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]**
3666// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3667// CK24-DAG: store [[SA]]* [[SEC0:%.+]], [[SA]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003668// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3669// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3670
3671// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3672// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3673
3674// CK24: call void [[CALL14:@.+]]([[SC]]* {{[^,]+}})
3675#pragma omp target map(p->s.s)
3676 { p->a++; }
3677
3678// Region 15
George Rokos63bc9d62017-11-21 18:25:12 +00003679// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003680// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3681// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3682
3683// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3684// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003685// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3686// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3687// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3688// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003689// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3690// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3691// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3692
3693// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3694// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3695
3696// CK24: call void [[CALL15:@.+]]([[SC]]* {{[^,]+}})
3697#pragma omp target map(p->s.s.a)
3698 { p->a++; }
3699
3700// Region 16
George Rokos63bc9d62017-11-21 18:25:12 +00003701// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE16]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE16]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003702// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3703// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3704
3705// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3706// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003707// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3708// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3709// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3710// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003711// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3712// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 3
3713
3714// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3715// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3716
3717// CK24: call void [[CALL16:@.+]]([[SC]]* {{[^,]+}})
3718#pragma omp target map(p->b[:5])
3719 { p->a++; }
3720
3721// Region 17
George Rokos63bc9d62017-11-21 18:25:12 +00003722// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003723// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3724// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3725
3726// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3727// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003728// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3729// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3730// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3731// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003732// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3733
3734// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3735// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003736// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3737// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SB]]**
3738// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3739// CK24-DAG: store [[SB]]* [[SEC1:%.+]], [[SB]]** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003740// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3741// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3742// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3743
3744// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3745// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3746// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3747
3748// CK24: call void [[CALL17:@.+]]([[SC]]* {{[^,]+}})
3749#pragma omp target map(p->p[:5])
3750 { p->a++; }
3751
3752// Region 18
George Rokos63bc9d62017-11-21 18:25:12 +00003753// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE18]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003754// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3755// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3756
3757// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3758// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003759// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3760// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3761// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3762// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003763// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3764// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3765// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3766// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3767
3768// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3769// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3770
3771// CK24: call void [[CALL18:@.+]]([[SC]]* {{[^,]+}})
3772#pragma omp target map(p->s.sa[3].a)
3773 { p->a++; }
3774
3775// Region 19
George Rokos63bc9d62017-11-21 18:25:12 +00003776// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE19]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003777// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3778// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3779
3780// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3781// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003782// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3783// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3784// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3785// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003786// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3787// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3788// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3789
3790// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3791// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003792// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3793// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3794// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3795// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003796// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3797// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3798// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3799// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3800// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3801
3802// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3803// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3804// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3805
3806// CK24: call void [[CALL19:@.+]]([[SC]]* {{[^,]+}})
3807#pragma omp target map(p->s.sp[3]->a)
3808 { p->a++; }
3809
3810// Region 20
George Rokos63bc9d62017-11-21 18:25:12 +00003811// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003812// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3813// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3814
3815// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3816// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003817// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3818// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3819// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3820// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003821// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3822
3823// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3824// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003825// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3826// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3827// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3828// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003829// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3830// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3831// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3832
3833// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3834// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3835// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3836
3837// CK24: call void [[CALL20:@.+]]([[SC]]* {{[^,]+}})
3838#pragma omp target map(p->p->a)
3839 { p->a++; }
3840
3841// Region 21
George Rokos63bc9d62017-11-21 18:25:12 +00003842// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE21]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003843// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3844// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3845
3846// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3847// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003848// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3849// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3850// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3851// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003852// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4
3853// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3854
3855// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3856// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003857// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3858// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3859// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3860// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003861// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0
3862// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3863// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4
3864// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3865
3866// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3867// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3868// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3869
3870// CK24: call void [[CALL21:@.+]]([[SC]]* {{[^,]+}})
3871#pragma omp target map(p->s.p->a)
3872 { p->a++; }
3873
3874// Region 22
George Rokos63bc9d62017-11-21 18:25:12 +00003875// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE22]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003876// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3877// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3878
3879// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3880// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003881// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3882// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3883// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3884// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003885// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3886// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3887// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3888// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3889
3890// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3891// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3892
3893// CK24: call void [[CALL22:@.+]]([[SC]]* {{[^,]+}})
3894#pragma omp target map(p->s.s.b[:2])
3895 { p->a++; }
3896
3897// Region 23
George Rokos63bc9d62017-11-21 18:25:12 +00003898// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE23]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003899// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3900// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3901
3902// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3903// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003904// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3905// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3906// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3907// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003908// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3909// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3910
3911// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3912// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003913// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3914// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3915// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3916// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003917// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3918// CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3919// CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]],
3920// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3921// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3922
3923// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3924// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3925// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3926
3927// CK24: call void [[CALL23:@.+]]([[SC]]* {{[^,]+}})
3928#pragma omp target map(p->s.p->b[:2])
3929 { p->a++; }
3930
3931// Region 24
George Rokos63bc9d62017-11-21 18:25:12 +00003932// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE24]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003933// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3934// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3935
3936// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3937// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003938// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3939// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3940// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3941// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003942// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3943
3944// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3945// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003946// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3947// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]***
3948// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3949// CK24-DAG: store [[SA]]** [[SEC1:%.+]], [[SA]]*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003950// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3951// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3952// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3953
3954// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
3955// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003956// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]***
3957// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [[SA]]***
3958// CK24-DAG: store [[SA]]** [[SEC1]], [[SA]]*** [[CBP2]]
3959// CK24-DAG: store [[SA]]** [[SEC2:%.+]], [[SA]]*** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00003960// CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3961// CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]],
3962// CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3963// CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]],
3964// CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0000:%.+]], i{{.+}} 0, i{{.+}} 2
3965
3966// CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
3967// CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003968// CK24-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to [[SA]]***
3969// CK24-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32**
3970// CK24-DAG: store [[SA]]** [[SEC2]], [[SA]]*** [[CBP3]]
3971// CK24-DAG: store i32* [[SEC3:%.+]], i32** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00003972// CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3973// CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]],
3974// CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3975// CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]],
3976// CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3977// CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]],
3978// CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR00000:%.+]], i{{.+}} 0, i{{.+}} 2
3979
3980// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3981// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3982// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3983// CK24-DAG: [[VAR0000]] = load [[SC]]*, [[SC]]** %{{.+}}
3984// CK24-DAG: [[VAR00000]] = load [[SC]]*, [[SC]]** %{{.+}}
3985
3986// CK24: call void [[CALL24:@.+]]([[SC]]* {{[^,]+}})
3987#pragma omp target map(p->p->p->p->a)
3988 { p->a++; }
3989
3990 return s.a;
3991}
3992
3993// CK24: define {{.+}}[[CALL01]]
Samuel Antao86ace552016-04-27 22:40:57 +00003994// CK24: define {{.+}}[[CALL13]]
3995// CK24: define {{.+}}[[CALL14]]
3996// CK24: define {{.+}}[[CALL15]]
3997// CK24: define {{.+}}[[CALL16]]
3998// CK24: define {{.+}}[[CALL17]]
3999// CK24: define {{.+}}[[CALL18]]
4000// CK24: define {{.+}}[[CALL19]]
4001// CK24: define {{.+}}[[CALL20]]
4002// CK24: define {{.+}}[[CALL21]]
4003// CK24: define {{.+}}[[CALL22]]
4004// CK24: define {{.+}}[[CALL23]]
4005// CK24: define {{.+}}[[CALL24]]
4006#endif
4007///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00004008// 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
4009// 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
4010// 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
4011// 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
4012// 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
4013// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004014
4015// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY24 %s
4016// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4017// RUN: %clang_cc1 -fopenmp-simd -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 --check-prefix SIMD-ONLY24 %s
4018// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY24 %s
4019// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4020// RUN: %clang_cc1 -fopenmp-simd -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 --check-prefix SIMD-ONLY24 %s
4021// SIMD-ONLY24-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00004022#ifdef CK25
4023// CK25: [[ST:%.+]] = type { i32, float }
4024// CK25: [[CA00:%.+]] = type { [[ST]]* }
4025// CK25: [[CA01:%.+]] = type { i32* }
4026
4027// CK25: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00004028// CK25: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00004029
4030// CK25: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00004031// CK25: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00004032
4033// CK25-LABEL: explicit_maps_with_inner_lambda
4034
4035template <int X, typename T>
4036struct CC {
4037 T A;
4038 float B;
4039
4040 int foo(T arg) {
4041 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00004042 // CK25-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004043 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4044 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4045
4046 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4047 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004048 // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4049 // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4050 // CK25-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4051 // CK25-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004052 // CK25-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
4053
4054 // CK25: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
4055 #pragma omp target map(to:A)
4056 {
4057 [&]() {
4058 A += 1;
4059 }();
4060 }
4061
4062 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00004063 // CK25-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004064 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4065 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4066
4067 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4068 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004069 // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4070 // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4071 // CK25-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4072 // CK25-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004073
4074 // CK25: call void [[CALL01:@.+]](i32* {{[^,]+}})
4075 #pragma omp target map(to:arg)
4076 {
4077 [&]() {
4078 arg += 1;
4079 }();
4080 }
4081
4082 return A+arg;
4083 }
4084};
4085
4086int explicit_maps_with_inner_lambda(int a){
4087 CC<123,int> c;
4088 return c.foo(a);
4089}
4090
4091// CK25: define {{.+}}[[CALL00]]([[ST]]* [[VAL:%.+]])
4092// CK25: store [[ST]]* [[VAL]], [[ST]]** [[VALADDR:%[^,]+]],
4093// CK25: [[VAL1:%.+]] = load [[ST]]*, [[ST]]** [[VALADDR]],
4094// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA00]], [[CA00]]* [[CA:%[^,]+]], i32 0, i32 0
4095// CK25: store [[ST]]* [[VAL1]], [[ST]]** [[VALADDR1]],
4096// CK25: call void {{.*}}[[LAMBDA:@.+]]{{.*}}([[CA00]]* [[CA]])
4097
4098// CK25: define {{.+}}[[LAMBDA]]
4099
4100// CK25: define {{.+}}[[CALL01]](i32* {{.*}}[[VAL:%.+]])
4101// CK25: store i32* [[VAL]], i32** [[VALADDR:%[^,]+]],
4102// CK25: [[VAL1:%.+]] = load i32*, i32** [[VALADDR]],
4103// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA01]], [[CA01]]* [[CA:%[^,]+]], i32 0, i32 0
4104// CK25: store i32* [[VAL1]], i32** [[VALADDR1]],
Alexey Bataevbef6aa62016-10-14 12:43:59 +00004105// CK25: call void {{.*}}[[LAMBDA2:@.+]]{{.*}}([[CA01]]* [[CA]])
4106
4107// CK25: define {{.+}}[[LAMBDA2]]
Samuel Antao86ace552016-04-27 22:40:57 +00004108#endif
4109///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00004110// 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
4111// 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
4112// 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
4113// 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
4114// 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
4115// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004116
4117// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY25 %s
4118// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4119// RUN: %clang_cc1 -fopenmp-simd -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 --check-prefix SIMD-ONLY25 %s
4120// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY25 %s
4121// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4122// RUN: %clang_cc1 -fopenmp-simd -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 --check-prefix SIMD-ONLY25 %s
4123// SIMD-ONLY25-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00004124#ifdef CK26
4125// CK26: [[ST:%.+]] = type { i32, float*, i32, float* }
4126
4127// CK26: [[SIZE00:@.+]] = private {{.*}}constant [2 x i[[Z:64|32]]] [i[[Z:64|32]] {{32|16}}, i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00004128// CK26: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i64] [i64 35, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004129
4130// CK26: [[SIZE01:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00004131// CK26: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i64] [i64 35, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004132
4133// CK26: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00004134// CK26: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i64] [i64 35, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004135
4136// CK26: [[SIZE03:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00004137// CK26: [[MTYPE03:@.+]] = private {{.*}}constant [2 x i64] [i64 35, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004138
4139// CK26-LABEL: explicit_maps_with_private_class_members
4140
4141struct CC {
4142 int fA;
4143 float &fB;
4144 int pA;
4145 float &pB;
4146
4147 CC(float &B) : fB(B), pB(B) {
4148
4149 // CK26: call {{.*}}@__kmpc_fork_call{{.*}} [[OUTCALL:@.+]] to void (i32*, i32*, ...)*
4150 // define {{.*}}void [[OUTCALL]]
4151 #pragma omp parallel firstprivate(fA,fB) private(pA,pB)
4152 {
4153 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00004154 // CK26-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004155 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4156 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4157
4158 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4159 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004160 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4161 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4162 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4163 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004164
4165 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4166 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004167 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
4168 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
4169 // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
4170 // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004171 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4172 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4173
4174 // CK26: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4175 #pragma omp target map(fA)
4176 {
4177 ++fA;
4178 }
4179
4180 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00004181 // CK26-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004182 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4183 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4184
4185 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4186 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004187 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4188 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4189 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4190 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004191
4192 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4193 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004194 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float**
4195 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
4196 // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]]
4197 // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004198 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4199 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4200
4201 // CK26: call void [[CALL01:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4202 #pragma omp target map(fB)
4203 {
4204 fB += 1.0;
4205 }
4206
4207 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00004208 // CK26-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004209 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4210 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4211
4212 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4213 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004214 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4215 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4216 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4217 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004218
4219 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4220 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004221 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
4222 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
4223 // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
4224 // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004225 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4226 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4227
4228 // CK26: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4229 #pragma omp target map(pA)
4230 {
4231 ++pA;
4232 }
4233
4234 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00004235 // CK26-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE03]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004236 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4237 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4238
4239 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4240 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004241 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4242 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4243 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4244 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004245
4246 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4247 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004248 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float**
4249 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
4250 // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]]
4251 // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004252 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4253 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4254
4255 // CK26: call void [[CALL03:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4256 #pragma omp target map(pB)
4257 {
4258 pB += 1.0;
4259 }
4260 }
4261 }
4262
4263 int foo() {
4264 return fA + pA;
4265 }
4266};
4267
4268// Make sure the private instance is used in all target regions.
4269// CK26: define {{.+}}[[CALL00]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4270// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4271// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4272// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4273// CK26: add nsw i32 [[VAL]], 1
4274
4275// CK26: define {{.+}}[[CALL01]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4276// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4277// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4278// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4279// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4280// CK26: fadd double [[EXT]], 1.000000e+00
4281
4282// CK26: define {{.+}}[[CALL02]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4283// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4284// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4285// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4286// CK26: add nsw i32 [[VAL]], 1
4287
4288// CK26: define {{.+}}[[CALL03]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4289// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4290// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4291// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4292// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4293// CK26: fadd double [[EXT]], 1.000000e+00
4294
4295int explicit_maps_with_private_class_members(){
4296 float B;
4297 CC c(B);
4298 return c.foo();
4299}
4300#endif
Samuel Antao6782e942016-05-26 16:48:10 +00004301///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00004302// 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
4303// 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
4304// 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
4305// 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
4306// 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
4307// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004308
4309// RUN: %clang_cc1 -DCK27 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY26 %s
4310// RUN: %clang_cc1 -DCK27 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4311// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY26 %s
4312// RUN: %clang_cc1 -DCK27 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY26 %s
4313// RUN: %clang_cc1 -DCK27 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4314// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY26 %s
4315// SIMD-ONLY26-NOT: {{__kmpc|__tgt}}
Samuel Antao6782e942016-05-26 16:48:10 +00004316#ifdef CK27
4317
4318// CK27: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] zeroinitializer
George Rokos63bc9d62017-11-21 18:25:12 +00004319// CK27: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antao6782e942016-05-26 16:48:10 +00004320
4321// CK27: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
George Rokos63bc9d62017-11-21 18:25:12 +00004322// CK27: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao6782e942016-05-26 16:48:10 +00004323
4324// CK27: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
George Rokos63bc9d62017-11-21 18:25:12 +00004325// CK27: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao6782e942016-05-26 16:48:10 +00004326
4327// CK27: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
George Rokos63bc9d62017-11-21 18:25:12 +00004328// CK27: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao6782e942016-05-26 16:48:10 +00004329
Samuel Antaod486f842016-05-26 16:53:38 +00004330// CK27: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
George Rokos63bc9d62017-11-21 18:25:12 +00004331// CK27: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antaod486f842016-05-26 16:53:38 +00004332
4333// CK27: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00004334// CK27: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 288]
Samuel Antaod486f842016-05-26 16:53:38 +00004335
4336// CK27: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 40]
George Rokos63bc9d62017-11-21 18:25:12 +00004337// CK27: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 161]
Samuel Antaod486f842016-05-26 16:53:38 +00004338
4339// CK27-LABEL: zero_size_section_and_private_maps
4340void zero_size_section_and_private_maps (int ii){
Samuel Antao6782e942016-05-26 16:48:10 +00004341
4342 // Map of a pointer.
4343 int *pa;
4344
4345 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00004346 // CK27-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao6782e942016-05-26 16:48:10 +00004347 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4348 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4349
4350 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4351 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004352 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4353 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4354 // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4355 // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004356
4357 // CK27: call void [[CALL00:@.+]](i32* {{[^,]+}})
4358 #pragma omp target
4359 {
4360 pa[50]++;
4361 }
4362
4363 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00004364 // CK27-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao6782e942016-05-26 16:48:10 +00004365 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4366 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4367
4368 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4369 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004370 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4371 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4372 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4373 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004374 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4375 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4376 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4377
4378 // CK27: call void [[CALL01:@.+]](i32* {{[^,]+}})
4379 #pragma omp target map(pa[:0])
4380 {
4381 pa[50]++;
4382 }
4383
4384 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00004385 // CK27-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
Samuel Antao6782e942016-05-26 16:48:10 +00004386 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4387 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4388
4389 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4390 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004391 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4392 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4393 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4394 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004395 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4396 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4397 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4398
4399 // CK27: call void [[CALL02:@.+]](i32* {{[^,]+}})
4400 #pragma omp target map(pa[0:0])
4401 {
4402 pa[50]++;
4403 }
4404
4405 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00004406 // CK27-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
Samuel Antao6782e942016-05-26 16:48:10 +00004407 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4408 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4409
4410 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4411 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004412 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4413 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4414 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4415 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004416 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4417 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.+}}
4418 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4419
4420 // CK27: call void [[CALL03:@.+]](i32* {{[^,]+}})
4421 #pragma omp target map(pa[ii:0])
4422 {
4423 pa[50]++;
4424 }
Samuel Antaod486f842016-05-26 16:53:38 +00004425
4426 int *pvtPtr;
4427 int pvtScl;
4428 int pvtArr[10];
4429
4430 // Region 04
George Rokos63bc9d62017-11-21 18:25:12 +00004431 // CK27: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null)
Samuel Antaod486f842016-05-26 16:53:38 +00004432 // CK27: call void [[CALL04:@.+]]()
4433 #pragma omp target private(pvtPtr)
4434 {
4435 pvtPtr[5]++;
4436 }
4437
4438 // Region 05
George Rokos63bc9d62017-11-21 18:25:12 +00004439 // CK27-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
Samuel Antaod486f842016-05-26 16:53:38 +00004440 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4441 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4442
4443 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4444 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004445 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4446 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4447 // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4448 // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antaod486f842016-05-26 16:53:38 +00004449
4450 // CK27: call void [[CALL05:@.+]](i32* {{[^,]+}})
4451 #pragma omp target firstprivate(pvtPtr)
4452 {
4453 pvtPtr[5]++;
4454 }
4455
4456 // Region 06
George Rokos63bc9d62017-11-21 18:25:12 +00004457 // CK27: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null)
Samuel Antaod486f842016-05-26 16:53:38 +00004458 // CK27: call void [[CALL06:@.+]]()
4459 #pragma omp target private(pvtScl)
4460 {
4461 pvtScl++;
4462 }
4463
4464 // Region 07
George Rokos63bc9d62017-11-21 18:25:12 +00004465 // CK27-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZE07]]{{.+}}, {{.+}}[[MTYPE07]]{{.+}})
Samuel Antaod486f842016-05-26 16:53:38 +00004466 // CK27-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
4467 // CK27-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
4468 // CK27-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
4469 // CK27-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004470 // CK27-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
4471 // CK27-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
4472 // CK27-DAG: store i[[Z]] [[VAL:%.+]], i[[Z]]* [[CBP1]]
4473 // CK27-DAG: store i[[Z]] [[VAL]], i[[Z]]* [[CP1]]
Samuel Antaod486f842016-05-26 16:53:38 +00004474 // CK27-DAG: [[VAL]] = load i[[Z]], i[[Z]]* [[ADDR:%.+]],
4475 // CK27-64-DAG: [[CADDR:%.+]] = bitcast i[[Z]]* [[ADDR]] to i32*
4476 // CK27-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
4477
4478 // CK27: call void [[CALL07:@.+]](i[[Z]] [[VAL]])
4479 #pragma omp target firstprivate(pvtScl)
4480 {
4481 pvtScl++;
4482 }
4483
4484 // Region 08
George Rokos63bc9d62017-11-21 18:25:12 +00004485 // CK27: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null)
Samuel Antaod486f842016-05-26 16:53:38 +00004486 // CK27: call void [[CALL08:@.+]]()
4487 #pragma omp target private(pvtArr)
4488 {
4489 pvtArr[5]++;
4490 }
4491
4492 // Region 09
George Rokos63bc9d62017-11-21 18:25:12 +00004493 // CK27-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
Samuel Antaod486f842016-05-26 16:53:38 +00004494 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4495 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4496
4497 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4498 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004499 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]**
4500 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [10 x i32]**
4501 // CK27-DAG: store [10 x i32]* [[VAR0:%.+]], [10 x i32]** [[CBP0]]
4502 // CK27-DAG: store [10 x i32]* [[VAR0]], [10 x i32]** [[CP0]]
Samuel Antaod486f842016-05-26 16:53:38 +00004503
4504 // CK27: call void [[CALL09:@.+]]([10 x i32]* {{[^,]+}})
4505 #pragma omp target firstprivate(pvtArr)
4506 {
4507 pvtArr[5]++;
4508 }
Samuel Antao6782e942016-05-26 16:48:10 +00004509}
4510
4511// CK27: define {{.+}}[[CALL00]]
4512// CK27: define {{.+}}[[CALL01]]
4513// CK27: define {{.+}}[[CALL02]]
4514// CK27: define {{.+}}[[CALL03]]
Samuel Antaod486f842016-05-26 16:53:38 +00004515// CK27: define {{.+}}[[CALL04]]
4516// CK27: define {{.+}}[[CALL05]]
4517// CK27: define {{.+}}[[CALL06]]
4518// CK27: define {{.+}}[[CALL07]]
Samuel Antao6782e942016-05-26 16:48:10 +00004519#endif
Samuel Antao403ffd42016-07-27 22:49:49 +00004520///==========================================================================///
4521// 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
4522// 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
4523// 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
4524// 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
4525// 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
4526// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004527
4528// RUN: %clang_cc1 -DCK28 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY27 %s
4529// RUN: %clang_cc1 -DCK28 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4530// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY27 %s
4531// RUN: %clang_cc1 -DCK28 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY27 %s
4532// RUN: %clang_cc1 -DCK28 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4533// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY27 %s
4534// SIMD-ONLY27-NOT: {{__kmpc|__tgt}}
Samuel Antao403ffd42016-07-27 22:49:49 +00004535#ifdef CK28
4536
4537// CK28: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00004538// CK28: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao403ffd42016-07-27 22:49:49 +00004539
4540// CK28: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00004541// CK28: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao403ffd42016-07-27 22:49:49 +00004542
4543// CK28-LABEL: explicit_maps_pointer_references
4544void explicit_maps_pointer_references (int *p){
4545 int *&a = p;
4546
4547 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00004548 // CK28-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao403ffd42016-07-27 22:49:49 +00004549 // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4550 // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4551
4552 // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4553 // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004554 // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
4555 // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
4556 // CK28-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]]
4557 // CK28-DAG: store i32** [[VAR1:%.+]], i32*** [[CP0]]
Samuel Antao403ffd42016-07-27 22:49:49 +00004558 // CK28-DAG: [[VAR0]] = load i32**, i32*** [[VAR00:%.+]],
4559 // CK28-DAG: [[VAR1]] = load i32**, i32*** [[VAR11:%.+]],
4560
4561 // CK28: call void [[CALL00:@.+]](i32** {{[^,]+}})
4562 #pragma omp target map(a)
4563 {
4564 ++a;
4565 }
4566
4567 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00004568 // CK28-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao403ffd42016-07-27 22:49:49 +00004569 // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4570 // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4571
4572 // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4573 // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004574 // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4575 // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4576 // CK28-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4577 // CK28-DAG: store i32* [[VAR1:%.+]], i32** [[CP0]]
Samuel Antao403ffd42016-07-27 22:49:49 +00004578 // CK28-DAG: [[VAR0]] = load i32*, i32** [[VAR00:%.+]],
4579 // CK28-DAG: [[VAR00]] = load i32**, i32*** [[VAR000:%.+]],
4580 // CK28-DAG: [[VAR1]] = getelementptr inbounds i32, i32* [[VAR11:%.+]], i{{64|32}} 2
4581 // CK28-DAG: [[VAR11]] = load i32*, i32** [[VAR111:%.+]],
4582 // CK28-DAG: [[VAR111]] = load i32**, i32*** [[VAR1111:%.+]],
4583
4584 // CK28: call void [[CALL01:@.+]](i32* {{[^,]+}})
4585 #pragma omp target map(a[2:100])
4586 {
4587 ++a;
4588 }
4589}
4590#endif
Samuel Antao03a3cec2016-07-27 22:52:16 +00004591///==========================================================================///
4592// 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
4593// 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
4594// 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
4595// 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
4596// 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
4597// 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
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004598
4599// RUN: %clang_cc1 -DCK29 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY28 %s
4600// RUN: %clang_cc1 -DCK29 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4601// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY28 %s
4602// RUN: %clang_cc1 -DCK29 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY28 %s
4603// RUN: %clang_cc1 -DCK29 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4604// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY28 %s
4605// SIMD-ONLY28-NOT: {{__kmpc|__tgt}}
Samuel Antao03a3cec2016-07-27 22:52:16 +00004606#ifdef CK29
4607
4608// CK29: [[SSA:%.+]] = type { double*, double** }
4609// CK29: [[SSB:%.+]] = type { [[SSA]]*, [[SSA]]** }
4610
4611// 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]
George Rokos63bc9d62017-11-21 18:25:12 +00004612// CK29: [[MTYPE00:@.+]] = private {{.*}}constant [4 x i64] [i64 35, i64 16, i64 19, i64 19]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004613
4614// CK29: [[SIZE01:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 80]
George Rokos63bc9d62017-11-21 18:25:12 +00004615// CK29: [[MTYPE01:@.+]] = private {{.*}}constant [4 x i64] [i64 32, i64 19, i64 19, i64 19]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004616
4617// 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]
George Rokos63bc9d62017-11-21 18:25:12 +00004618// CK29: [[MTYPE02:@.+]] = private {{.*}}constant [5 x i64] [i64 32, i64 19, i64 16, i64 19, i64 19]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004619
4620struct SSA{
4621 double *p;
4622 double *&pr;
4623 SSA(double *&pr) : pr(pr) {}
4624};
4625
4626struct SSB{
4627 SSA *p;
4628 SSA *&pr;
4629 SSB(SSA *&pr) : pr(pr) {}
4630
4631 // CK29-LABEL: define {{.+}}foo
4632 void foo() {
4633
4634 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00004635 // CK29-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao03a3cec2016-07-27 22:52:16 +00004636
4637 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4638 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4639
4640 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4641 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004642 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
4643 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]**
4644 // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]]
4645 // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004646 // CK29-DAG: [[VAR0]] = load [[SSB]]*, [[SSB]]** %
4647 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 0
4648
4649 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4650 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004651 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]***
4652 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double****
4653 // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]]
4654 // CK29-DAG: store double*** [[VAR1:%.+]], double**** [[CP1]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004655 // CK29-DAG: [[VAR1]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4656
4657 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4658 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004659 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double****
4660 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double***
4661 // CK29-DAG: store double*** [[VAR1]], double**** [[CBP2]]
4662 // CK29-DAG: store double** [[VAR2:%.+]], double*** [[CP2]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004663 // CK29-DAG: [[VAR2]] = load double**, double*** [[VAR22:%.+]],
4664 // CK29-DAG: [[VAR22]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4665
4666 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4667 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004668 // CK29-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double***
4669 // CK29-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
4670 // CK29-DAG: store double** [[VAR2]], double*** [[CBP3]]
4671 // CK29-DAG: store double* [[VAR3:%.+]], double** [[CP3]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004672 // CK29-DAG: [[VAR3]] = getelementptr inbounds double, double* [[VAR33:%.+]], i{{.+}} 0
4673 // CK29-DAG: [[VAR33]] = load double*, double** %{{.+}},
4674
4675 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4676 #pragma omp target map(p->pr[:10])
4677 {
4678 p->pr++;
4679 }
4680
4681 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00004682 // CK29-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao03a3cec2016-07-27 22:52:16 +00004683
4684 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4685 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4686
4687 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4688 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004689 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
4690 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]****
4691 // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]]
4692 // CK29-DAG: store [[SSA]]*** [[VAR00:%.+]], [[SSA]]**** [[CP0]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004693 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
4694
4695 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4696 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004697 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]****
4698 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SSA]]***
4699 // CK29-DAG: store [[SSA]]*** [[VAR00]], [[SSA]]**** [[CBP1]]
4700 // CK29-DAG: store [[SSA]]** [[VAR1:%.+]], [[SSA]]*** [[CP1]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004701 // CK29-DAG: [[VAR1]] = load [[SSA]]**, [[SSA]]*** [[VAR00]],
4702
4703 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4704 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004705 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SSA]]***
4706 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double***
4707 // CK29-DAG: store [[SSA]]** [[VAR1]], [[SSA]]*** [[CBP2]]
4708 // CK29-DAG: store double** [[VAR2:%.+]], double*** [[CP2]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004709 // CK29-DAG: [[VAR2]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 0
4710
4711 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4712 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004713 // CK29-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double***
4714 // CK29-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
4715 // CK29-DAG: store double** [[VAR2]], double*** [[CBP3]]
4716 // CK29-DAG: store double* [[VAR3:%.+]], double** [[CP3]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004717 // CK29-DAG: [[VAR3]] = getelementptr inbounds double, double* [[VAR33:%.+]], i{{.+}} 0
4718 // CK29-DAG: [[VAR33]] = load double*, double** %{{.+}},
4719
4720 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4721 #pragma omp target map(pr->p[:10])
4722 {
4723 pr->p++;
4724 }
4725
4726 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00004727 // CK29-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 5, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[5 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[5 x i{{.+}}]* [[MTYPE02]]{{.+}})
Samuel Antao03a3cec2016-07-27 22:52:16 +00004728
4729 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4730 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4731
4732 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4733 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004734 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
4735 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]****
4736 // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]]
4737 // CK29-DAG: store [[SSA]]*** [[VAR00:%.+]], [[SSA]]**** [[CP0]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004738 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
4739
4740 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4741 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004742 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]****
4743 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SSA]]***
4744 // CK29-DAG: store [[SSA]]*** [[VAR00]], [[SSA]]**** [[CBP1]]
4745 // CK29-DAG: store [[SSA]]** [[VAR1:%.+]], [[SSA]]*** [[CP1]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004746 // CK29-DAG: [[VAR1]] = load [[SSA]]**, [[SSA]]*** [[VAR00]],
4747
4748 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4749 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004750 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SSA]]***
4751 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double****
4752 // CK29-DAG: store [[SSA]]** [[VAR1]], [[SSA]]*** [[CBP2]]
4753 // CK29-DAG: store double*** [[VAR2:%.+]], double**** [[CP2]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004754 // CK29-DAG: [[VAR2]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4755
4756 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4757 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004758 // CK29-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double****
4759 // CK29-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double***
4760 // CK29-DAG: store double*** [[VAR2]], double**** [[CBP3]]
4761 // CK29-DAG: store double** [[VAR3:%.+]], double*** [[CP3]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004762 // CK29-DAG: [[VAR3]] = load double**, double*** [[VAR2]],
4763
4764 // CK29-DAG: [[BP4:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 4
4765 // CK29-DAG: [[P4:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 4
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004766 // CK29-DAG: [[CBP4:%.+]] = bitcast i8** [[BP4]] to double***
4767 // CK29-DAG: [[CP4:%.+]] = bitcast i8** [[P4]] to double**
4768 // CK29-DAG: store double** [[VAR3]], double*** [[CBP4]]
4769 // CK29-DAG: store double* [[VAR4:%.+]], double** [[CP4]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004770 // CK29-DAG: [[VAR4]] = getelementptr inbounds double, double* [[VAR44:%.+]], i{{.+}} 0
4771 // CK29-DAG: [[VAR44]] = load double*, double**
4772
4773 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4774 #pragma omp target map(pr->pr[:10])
4775 {
4776 pr->pr++;
4777 }
4778 }
4779};
4780
4781void explicit_maps_member_pointer_references(SSA *sap) {
4782 double *d;
4783 SSA sa(d);
4784 SSB sb(sap);
4785 sb.foo();
4786}
4787#endif
Samuel Antao4af1b7b2015-12-02 17:44:43 +00004788#endif