blob: b267a72b4ce6856c3ccbdecf304e252470d80f08 [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///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +000010// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-64
Samuel Antao1168d63c2016-06-30 21:22:08 +000011// 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
Joel E. Denny72c27832018-07-11 20:26:20 +000012// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix 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 -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32
Samuel Antao1168d63c2016-06-30 21:22:08 +000014// 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
Joel E. Denny72c27832018-07-11 20:26:20 +000015// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 --check-prefix CK1-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +000016
Joel E. Denny72c27832018-07-11 20:26:20 +000017// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +000018// 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
Joel E. Denny72c27832018-07-11 20:26:20 +000019// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +000021// 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
Joel E. Denny72c27832018-07-11 20:26:20 +000022// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +000023// 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
Alexey Bataevc15ea702018-05-09 18:02:37 +000042// CK1-LABEL: @.__omp_offloading_{{.*}}implicit_maps_integer{{.*}}_l68.region_id = weak constant i8 0
43
Samuel Antao4af1b7b2015-12-02 17:44:43 +000044// CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Alexey Bataevb3638132018-07-19 16:34:13 +000045// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
46// CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000047
Alexey Bataevb3638132018-07-19 16:34:13 +000048// CK1-LABEL: implicit_maps_integer{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +000049void implicit_maps_integer (int a){
Alexey Bataev6a71f362017-08-22 17:54:52 +000050 // CK1: call void{{.*}}modify
51 B::modify(a);
Samuel Antao4af1b7b2015-12-02 17:44:43 +000052 int i = a;
53
George Rokos63bc9d62017-11-21 18:25:12 +000054 // 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 +000055 // CK1-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
56 // CK1-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
57 // CK1-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
58 // CK1-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +000059 // CK1-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
60 // CK1-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
61 // CK1-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
62 // CK1-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000063 // CK1-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
64 // CK1-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
65 // CK1-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
66
67 // CK1: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
68 #pragma omp target
69 {
70 ++i;
71 }
72}
73
74// CK1: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
75// CK1: [[ADDR:%.+]] = alloca i[[sz]],
76// CK1: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
77// CK1-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
78// CK1-64: {{.+}} = load i32, i32* [[CADDR]],
79// CK1-32: {{.+}} = load i32, i32* [[ADDR]],
80
81#endif
Alexey Bataevb3638132018-07-19 16:34:13 +000082
83
Samuel Antao4af1b7b2015-12-02 17:44:43 +000084///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +000085// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64
Samuel Antao1168d63c2016-06-30 21:22:08 +000086// 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
Joel E. Denny72c27832018-07-11 20:26:20 +000087// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-64
88// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32
Samuel Antao1168d63c2016-06-30 21:22:08 +000089// 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
Joel E. Denny72c27832018-07-11 20:26:20 +000090// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 --check-prefix CK2-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +000091
Joel E. Denny72c27832018-07-11 20:26:20 +000092// RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +000093// 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
Joel E. Denny72c27832018-07-11 20:26:20 +000094// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s
95// RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +000096// 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
Joel E. Denny72c27832018-07-11 20:26:20 +000097// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY1 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +000098// SIMD-ONLY1-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +000099#ifdef CK2
100
Alexey Bataevc15ea702018-05-09 18:02:37 +0000101// CK2-LABEL: @.__omp_offloading_{{.*}}implicit_maps_reference{{.*}}_l128.region_id = weak constant i8 0
102
Samuel Antao403ffd42016-07-27 22:49:49 +0000103// CK2: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Alexey Bataevb3638132018-07-19 16:34:13 +0000104// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
105// CK2: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
Alexey Bataevc15ea702018-05-09 18:02:37 +0000106// CK2-LABEL: @.__omp_offloading_{{.*}}implicit_maps_reference{{.*}}_l147.region_id = weak constant i8 0
Samuel Antao403ffd42016-07-27 22:49:49 +0000107// CK2: [[SIZES2:@.+]] = {{.+}}constant [1 x i[[sz]]] zeroinitializer
Alexey Bataevb3638132018-07-19 16:34:13 +0000108// Map types: OMP_MAP_IS_PTR | OMP_MAP_IMPLICIT = 544
109// CK2: [[TYPES2:@.+]] = {{.+}}constant [1 x i64] [i64 544]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000110
Alexey Bataevb3638132018-07-19 16:34:13 +0000111// CK2-LABEL: implicit_maps_reference{{.*}}(
Samuel Antao403ffd42016-07-27 22:49:49 +0000112void implicit_maps_reference (int a, int *b){
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000113 int &i = a;
George Rokos63bc9d62017-11-21 18:25:12 +0000114 // 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 +0000115 // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
116 // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
117 // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
118 // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000119 // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
120 // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
121 // CK2-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
122 // CK2-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000123 // CK2-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
124 // CK2-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
125 // CK2-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
126
127 // CK2: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
128 #pragma omp target
129 {
130 ++i;
131 }
Samuel Antao403ffd42016-07-27 22:49:49 +0000132
133 int *&p = b;
George Rokos63bc9d62017-11-21 18:25:12 +0000134 // 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 +0000135 // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
136 // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
137 // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
138 // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000139 // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
140 // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
141 // CK2-DAG: store i32* [[VAL:%[^,]+]], i32** [[CBP1]]
142 // CK2-DAG: store i32* [[VAL]], i32** [[CP1]]
Samuel Antao403ffd42016-07-27 22:49:49 +0000143 // CK2-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]],
144 // CK2-DAG: [[ADDR]] = load i32**, i32*** [[ADDR2:%.+]],
145
146 // CK2: call void [[KERNEL2:@.+]](i32* [[VAL]])
147 #pragma omp target
148 {
149 ++p;
150 }
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000151}
152
153// CK2: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
154// CK2: [[ADDR:%.+]] = alloca i[[sz]],
155// CK2: [[REF:%.+]] = alloca i32*,
156// CK2: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
157// CK2-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
158// CK2-64: store i32* [[CADDR]], i32** [[REF]],
159// CK2-64: [[RVAL:%.+]] = load i32*, i32** [[REF]],
160// CK2-64: {{.+}} = load i32, i32* [[RVAL]],
161// CK2-32: store i32* [[ADDR]], i32** [[REF]],
162// CK2-32: [[RVAL:%.+]] = load i32*, i32** [[REF]],
163// CK2-32: {{.+}} = load i32, i32* [[RVAL]],
164
Samuel Antao403ffd42016-07-27 22:49:49 +0000165// CK2: define internal void [[KERNEL2]](i32* [[ARG:%.+]])
166// CK2: [[ADDR:%.+]] = alloca i32*,
167// CK2: [[REF:%.+]] = alloca i32**,
168// CK2: store i32* [[ARG]], i32** [[ADDR]],
169// CK2: store i32** [[ADDR]], i32*** [[REF]],
170// CK2: [[T:%.+]] = load i32**, i32*** [[REF]],
171// CK2: [[TT:%.+]] = load i32*, i32** [[T]],
172// CK2: getelementptr inbounds i32, i32* [[TT]], i32 1
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000173#endif
174///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000175// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64
Samuel Antao1168d63c2016-06-30 21:22:08 +0000176// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000177// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-64
178// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32
Samuel Antao1168d63c2016-06-30 21:22:08 +0000179// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000180// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 --check-prefix CK3-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000181
Joel E. Denny72c27832018-07-11 20:26:20 +0000182// RUN: %clang_cc1 -DCK3 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000183// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000184// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s
185// RUN: %clang_cc1 -DCK3 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000186// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000187// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY2 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000188// SIMD-ONLY2-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000189#ifdef CK3
190
Alexey Bataevc15ea702018-05-09 18:02:37 +0000191// CK3-LABEL: @.__omp_offloading_{{.*}}implicit_maps_parameter{{.*}}_l214.region_id = weak constant i8 0
192
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000193// CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Alexey Bataevb3638132018-07-19 16:34:13 +0000194// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
195// CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000196
Alexey Bataevb3638132018-07-19 16:34:13 +0000197// CK3-LABEL: implicit_maps_parameter{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000198void implicit_maps_parameter (int a){
199
George Rokos63bc9d62017-11-21 18:25:12 +0000200 // 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 +0000201 // CK3-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
202 // CK3-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
203 // CK3-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
204 // CK3-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000205 // CK3-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
206 // CK3-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
207 // CK3-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
208 // CK3-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000209 // CK3-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
210 // CK3-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
211 // CK3-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
212
213 // CK3: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
214 #pragma omp target
215 {
216 ++a;
217 }
218}
219
220// CK3: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
221// CK3: [[ADDR:%.+]] = alloca i[[sz]],
222// CK3: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
223// CK3-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
224// CK3-64: {{.+}} = load i32, i32* [[CADDR]],
225// CK3-32: {{.+}} = load i32, i32* [[ADDR]],
226
227#endif
228///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000229// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64
Samuel Antao1168d63c2016-06-30 21:22:08 +0000230// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000231// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64
232// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32
Samuel Antao1168d63c2016-06-30 21:22:08 +0000233// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000234// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000235
Joel E. Denny72c27832018-07-11 20:26:20 +0000236// RUN: %clang_cc1 -DCK4 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000237// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000238// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s
239// RUN: %clang_cc1 -DCK4 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000240// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000241// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY3 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000242// SIMD-ONLY3-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000243#ifdef CK4
244
Alexey Bataevc15ea702018-05-09 18:02:37 +0000245// CK4-LABEL: @.__omp_offloading_{{.*}}implicit_maps_nested_integer{{.*}}_l276.region_id = weak constant i8 0
246
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000247// CK4-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Alexey Bataevb3638132018-07-19 16:34:13 +0000248// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
249// CK4-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000250
Alexey Bataevb3638132018-07-19 16:34:13 +0000251// CK4-LABEL: implicit_maps_nested_integer{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000252void implicit_maps_nested_integer (int a){
253 int i = a;
254
255 // The captures in parallel are by reference. Only the capture in target is by
256 // copy.
257
258 // CK4: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP1:@.+]] to void (i32*, i32*, ...)*), i32* {{.+}})
259 // CK4: define internal void [[KERNELP1]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
260 #pragma omp parallel
261 {
George Rokos63bc9d62017-11-21 18:25:12 +0000262 // 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 +0000263 // CK4-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
264 // CK4-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
265 // CK4-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
266 // CK4-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000267 // CK4-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
268 // CK4-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
269 // CK4-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
270 // CK4-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000271 // CK4-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
272 // CK4-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
273 // CK4-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
274
275 // CK4: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
276 #pragma omp target
277 {
278 #pragma omp parallel
279 {
280 ++i;
281 }
282 }
283 }
284}
285
286// CK4: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
287// CK4: [[ADDR:%.+]] = alloca i[[sz]],
288// CK4: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
289// CK4-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
290// CK4-64: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[CADDR]])
291// CK4-32: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[ADDR]])
292// CK4: define internal void [[KERNELP2]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
293#endif
294///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000295// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64
Samuel Antao1168d63c2016-06-30 21:22:08 +0000296// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000297// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-64
298// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32
Samuel Antao1168d63c2016-06-30 21:22:08 +0000299// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000300// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 --check-prefix CK5-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000301
Joel E. Denny72c27832018-07-11 20:26:20 +0000302// RUN: %clang_cc1 -DCK5 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000303// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000304// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s
305// RUN: %clang_cc1 -DCK5 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000306// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000307// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY4 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000308// SIMD-ONLY4-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000309#ifdef CK5
310
Alexey Bataevc15ea702018-05-09 18:02:37 +0000311// CK5-LABEL: @.__omp_offloading_{{.*}}implicit_maps_nested_integer_and_enum{{.*}}_l340.region_id = weak constant i8 0
312
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000313// CK5-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Alexey Bataevb3638132018-07-19 16:34:13 +0000314// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
315// CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000316
Alexey Bataevb3638132018-07-19 16:34:13 +0000317// CK5-LABEL: implicit_maps_nested_integer_and_enum{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000318void implicit_maps_nested_integer_and_enum (int a){
319 enum Bla {
320 SomeEnum = 0x09
321 };
322
323 // Using an enum should not change the mapping information.
324 int i = a;
325
George Rokos63bc9d62017-11-21 18:25:12 +0000326 // 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 +0000327 // CK5-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
328 // CK5-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
329 // CK5-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
330 // CK5-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000331 // CK5-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
332 // CK5-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
333 // CK5-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
334 // CK5-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000335 // CK5-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
336 // CK5-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
337 // CK5-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
338
339 // CK5: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
340 #pragma omp target
341 {
342 ++i;
343 i += SomeEnum;
344 }
345}
346
347// CK5: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
348// CK5: [[ADDR:%.+]] = alloca i[[sz]],
349// CK5: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
350// CK5-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
351// CK5-64: {{.+}} = load i32, i32* [[CADDR]],
352// CK5-32: {{.+}} = load i32, i32* [[ADDR]],
353
354#endif
355///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000356// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64
Samuel Antao1168d63c2016-06-30 21:22:08 +0000357// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000358// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-64
359// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32
Samuel Antao1168d63c2016-06-30 21:22:08 +0000360// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000361// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 --check-prefix CK6-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000362
Joel E. Denny72c27832018-07-11 20:26:20 +0000363// RUN: %clang_cc1 -DCK6 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000364// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000365// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s
366// RUN: %clang_cc1 -DCK6 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000367// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000368// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY5 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000369// SIMD-ONLY5-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000370#ifdef CK6
Alexey Bataevc15ea702018-05-09 18:02:37 +0000371// CK6-LABEL: @.__omp_offloading_{{.*}}implicit_maps_host_global{{.*}}_l397.region_id = weak constant i8 0
372
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000373// CK6-DAG: [[GBL:@Gi]] = global i32 0
374// CK6-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Alexey Bataevb3638132018-07-19 16:34:13 +0000375// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
376// CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000377
Alexey Bataevb3638132018-07-19 16:34:13 +0000378// CK6-LABEL: implicit_maps_host_global{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000379int Gi;
380void implicit_maps_host_global (int a){
George Rokos63bc9d62017-11-21 18:25:12 +0000381 // 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 +0000382 // CK6-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
383 // CK6-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
384 // CK6-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
385 // CK6-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000386 // CK6-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
387 // CK6-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
388 // CK6-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
389 // CK6-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000390 // CK6-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
391 // CK6-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
392 // CK6-64-DAG: store i32 [[GBLVAL:%.+]], i32* [[CADDR]],
393 // CK6-64-DAG: [[GBLVAL]] = load i32, i32* [[GBL]],
394 // CK6-32-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[GBLVAL:%.+]],
395
396 // CK6: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
397 #pragma omp target
398 {
399 ++Gi;
400 }
401}
402
403// CK6: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
404// CK6: [[ADDR:%.+]] = alloca i[[sz]],
405// CK6: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
406// CK6-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
407// CK6-64: {{.+}} = load i32, i32* [[CADDR]],
408// CK6-32: {{.+}} = load i32, i32* [[ADDR]],
409
410#endif
411///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000412// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64
Samuel Antao1168d63c2016-06-30 21:22:08 +0000413// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000414// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-64
415// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32
Samuel Antao1168d63c2016-06-30 21:22:08 +0000416// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000417// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 --check-prefix CK7-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000418
Joel E. Denny72c27832018-07-11 20:26:20 +0000419// RUN: %clang_cc1 -DCK7 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000420// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000421// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s
422// RUN: %clang_cc1 -DCK7 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000423// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000424// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000425// SIMD-ONLY6-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000426#ifdef CK7
427
428// For a 32-bit targets, the value doesn't fit the size of the pointer,
429// therefore it is passed by reference with a map 'to' specification.
430
Alexey Bataevc15ea702018-05-09 18:02:37 +0000431// CK7-LABEL: @.__omp_offloading_{{.*}}implicit_maps_double{{.*}}_l464.region_id = weak constant i8 0
432
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000433// CK7-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Alexey Bataevb3638132018-07-19 16:34:13 +0000434// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
435// CK7-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
436// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 673
437// CK7-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 673]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000438
Alexey Bataevb3638132018-07-19 16:34:13 +0000439// CK7-LABEL: implicit_maps_double{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000440void implicit_maps_double (int a){
441 double d = (double)a;
442
George Rokos63bc9d62017-11-21 18:25:12 +0000443 // 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 +0000444 // CK7-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
445 // CK7-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
446 // CK7-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
447 // CK7-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
448
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000449 // CK7-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
450 // CK7-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
451 // CK7-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
452 // CK7-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000453 // CK7-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
454 // CK7-64-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to double*
455 // CK7-64-64-DAG: store double {{.+}}, double* [[CADDR]],
456
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000457 // CK7-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double**
458 // CK7-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
459 // CK7-32-DAG: store double* [[DECL:%[^,]+]], double** [[CBP1]]
460 // CK7-32-DAG: store double* [[DECL]], double** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000461
462 // CK7-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
463 // CK7-32: call void [[KERNEL:@.+]](double* [[DECL]])
464 #pragma omp target
465 {
466 d += 1.0;
467 }
468}
469
470// CK7-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
471// CK7-64: [[ADDR:%.+]] = alloca i[[sz]],
472// CK7-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
473// CK7-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to double*
474// CK7-64: {{.+}} = load double, double* [[CADDR]],
475
476// CK7-32: define internal void [[KERNEL]](double* {{.+}}[[ARG:%.+]])
477// CK7-32: [[ADDR:%.+]] = alloca double*,
478// CK7-32: store double* [[ARG]], double** [[ADDR]],
479// CK7-32: [[REF:%.+]] = load double*, double** [[ADDR]],
480// CK7-32: {{.+}} = load double, double* [[REF]],
481
482#endif
483///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000484// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8
Samuel Antao1168d63c2016-06-30 21:22:08 +0000485// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000486// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8
487// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8
Samuel Antao1168d63c2016-06-30 21:22:08 +0000488// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000489// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000490
Joel E. Denny72c27832018-07-11 20:26:20 +0000491// RUN: %clang_cc1 -DCK8 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000492// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000493// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s
494// RUN: %clang_cc1 -DCK8 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000495// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000496// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY7 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000497// SIMD-ONLY7-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000498#ifdef CK8
499
Alexey Bataevc15ea702018-05-09 18:02:37 +0000500// CK8-LABEL: @.__omp_offloading_{{.*}}implicit_maps_float{{.*}}_l524.region_id = weak constant i8 0
501
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000502// CK8-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Alexey Bataevb3638132018-07-19 16:34:13 +0000503// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
504// CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000505
Alexey Bataevb3638132018-07-19 16:34:13 +0000506// CK8-LABEL: implicit_maps_float{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000507void implicit_maps_float (int a){
508 float f = (float)a;
509
George Rokos63bc9d62017-11-21 18:25:12 +0000510 // 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 +0000511 // CK8-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
512 // CK8-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
513 // CK8-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
514 // CK8-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000515 // CK8-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
516 // CK8-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
517 // CK8-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
518 // CK8-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000519 // CK8-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
520 // CK8-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
521 // CK8-DAG: store float {{.+}}, float* [[CADDR]],
522
523 // CK8: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
524 #pragma omp target
525 {
526 f += 1.0;
527 }
528}
529
530// CK8: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
531// CK8: [[ADDR:%.+]] = alloca i[[sz]],
532// CK8: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
533// CK8: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
534// CK8: {{.+}} = load float, float* [[CADDR]],
535
536#endif
537///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000538// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9
Samuel Antao1168d63c2016-06-30 21:22:08 +0000539// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000540// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9
541// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9
Samuel Antao1168d63c2016-06-30 21:22:08 +0000542// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000543// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000544
Joel E. Denny72c27832018-07-11 20:26:20 +0000545// RUN: %clang_cc1 -DCK9 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000546// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000547// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s
548// RUN: %clang_cc1 -DCK9 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000549// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000550// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000551// SIMD-ONLY8-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000552#ifdef CK9
553
Alexey Bataevc15ea702018-05-09 18:02:37 +0000554// CK9-LABEL: @.__omp_offloading_{{.*}}implicit_maps_array{{.*}}_l575.region_id = weak constant i8 0
555
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000556// CK9-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Alexey Bataevb3638132018-07-19 16:34:13 +0000557// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547
George Rokos63bc9d62017-11-21 18:25:12 +0000558// CK9-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000559
Alexey Bataevb3638132018-07-19 16:34:13 +0000560// CK9-LABEL: implicit_maps_array{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000561void implicit_maps_array (int a){
562 double darr[2] = {(double)a, (double)a};
563
George Rokos63bc9d62017-11-21 18:25:12 +0000564 // 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 +0000565 // CK9-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
566 // CK9-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
567 // CK9-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
568 // CK9-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000569 // CK9-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [2 x double]**
570 // CK9-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [2 x double]**
571 // CK9-DAG: store [2 x double]* [[DECL:%[^,]+]], [2 x double]** [[CBP1]]
572 // CK9-DAG: store [2 x double]* [[DECL]], [2 x double]** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000573
574 // CK9: call void [[KERNEL:@.+]]([2 x double]* [[DECL]])
575 #pragma omp target
576 {
577 darr[0] += 1.0;
578 darr[1] += 1.0;
579 }
580}
581
582// CK9: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]])
583// CK9: [[ADDR:%.+]] = alloca [2 x double]*,
584// CK9: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]],
585// CK9: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]],
586// CK9: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i[[sz]] 0, i[[sz]] 0
587#endif
588///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000589// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10
Samuel Antao1168d63c2016-06-30 21:22:08 +0000590// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000591// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10
592// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10
Samuel Antao1168d63c2016-06-30 21:22:08 +0000593// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000594// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000595
Joel E. Denny72c27832018-07-11 20:26:20 +0000596// RUN: %clang_cc1 -DCK10 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000597// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000598// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s
599// RUN: %clang_cc1 -DCK10 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000600// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000601// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000602// SIMD-ONLY9-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000603#ifdef CK10
604
Alexey Bataevc15ea702018-05-09 18:02:37 +0000605// CK10-LABEL: @.__omp_offloading_{{.*}}implicit_maps_pointer{{.*}}_l626.region_id = weak constant i8 0
606
Samuel Antao6782e942016-05-26 16:48:10 +0000607// CK10-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] zeroinitializer
Alexey Bataevb3638132018-07-19 16:34:13 +0000608// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544
609// CK10-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 544]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000610
Alexey Bataevb3638132018-07-19 16:34:13 +0000611// CK10-LABEL: implicit_maps_pointer{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000612void implicit_maps_pointer (){
613 double *ddyn;
614
George Rokos63bc9d62017-11-21 18:25:12 +0000615 // 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 +0000616 // CK10-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
617 // CK10-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
618 // CK10-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
619 // CK10-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000620 // CK10-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double**
621 // CK10-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
622 // CK10-DAG: store double* [[PTR:%[^,]+]], double** [[CBP1]]
623 // CK10-DAG: store double* [[PTR]], double** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000624
625 // CK10: call void [[KERNEL:@.+]](double* [[PTR]])
626 #pragma omp target
627 {
628 ddyn[0] += 1.0;
629 ddyn[1] += 1.0;
630 }
631}
632
633// CK10: define internal void [[KERNEL]](double* {{.*}}[[ARG:%.+]])
634// CK10: [[ADDR:%.+]] = alloca double*,
635// CK10: store double* [[ARG]], double** [[ADDR]],
636// CK10: [[REF:%.+]] = load double*, double** [[ADDR]],
637// CK10: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] 0
638
639#endif
640///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000641// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11
Samuel Antao1168d63c2016-06-30 21:22:08 +0000642// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000643// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11
644// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11
Samuel Antao1168d63c2016-06-30 21:22:08 +0000645// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000646// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000647
Joel E. Denny72c27832018-07-11 20:26:20 +0000648// RUN: %clang_cc1 -DCK11 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000649// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000650// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s
651// RUN: %clang_cc1 -DCK11 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000652// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000653// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000654// SIMD-ONLY10-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000655#ifdef CK11
656
Alexey Bataevc15ea702018-05-09 18:02:37 +0000657// CK11-LABEL: @.__omp_offloading_{{.*}}implicit_maps_double_complex{{.*}}_l678.region_id = weak constant i8 0
658
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000659// CK11-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Alexey Bataevb3638132018-07-19 16:34:13 +0000660// Map types: OMP_MAP_TO | OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547
George Rokos63bc9d62017-11-21 18:25:12 +0000661// CK11-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000662
Alexey Bataevb3638132018-07-19 16:34:13 +0000663// CK11-LABEL: implicit_maps_double_complex{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000664void implicit_maps_double_complex (int a){
665 double _Complex dc = (double)a;
666
George Rokos63bc9d62017-11-21 18:25:12 +0000667 // 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 +0000668 // CK11-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
669 // CK11-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
670 // CK11-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
671 // CK11-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000672 // CK11-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { double, double }**
673 // CK11-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { double, double }**
674 // CK11-DAG: store { double, double }* [[PTR:%[^,]+]], { double, double }** [[CBP1]]
675 // CK11-DAG: store { double, double }* [[PTR]], { double, double }** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000676
677 // CK11: call void [[KERNEL:@.+]]({ double, double }* [[PTR]])
Alexey Bataev2fd0cb22017-10-05 17:51:39 +0000678 #pragma omp target defaultmap(tofrom:scalar)
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000679 {
680 dc *= dc;
681 }
682}
683
684// CK11: define internal void [[KERNEL]]({ double, double }* {{.*}}[[ARG:%.+]])
685// CK11: [[ADDR:%.+]] = alloca { double, double }*,
686// CK11: store { double, double }* [[ARG]], { double, double }** [[ADDR]],
687// CK11: [[REF:%.+]] = load { double, double }*, { double, double }** [[ADDR]],
688// CK11: {{.+}} = getelementptr inbounds { double, double }, { double, double }* [[REF]], i32 0, i32 0
689#endif
690///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000691// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64
Samuel Antao1168d63c2016-06-30 21:22:08 +0000692// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000693// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-64
694// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32
Samuel Antao1168d63c2016-06-30 21:22:08 +0000695// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000696// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 --check-prefix CK12-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000697
Joel E. Denny72c27832018-07-11 20:26:20 +0000698// RUN: %clang_cc1 -DCK12 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000699// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000700// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s
701// RUN: %clang_cc1 -DCK12 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000702// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000703// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY11 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000704// SIMD-ONLY11-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000705#ifdef CK12
706
707// For a 32-bit targets, the value doesn't fit the size of the pointer,
708// therefore it is passed by reference with a map 'to' specification.
709
Alexey Bataevc15ea702018-05-09 18:02:37 +0000710// CK12-LABEL: @.__omp_offloading_{{.*}}implicit_maps_float_complex{{.*}}_l743.region_id = weak constant i8 0
711
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000712// CK12-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Alexey Bataevb3638132018-07-19 16:34:13 +0000713// Map types: OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
714// CK12-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
715// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 673
716// CK12-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 673]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000717
Alexey Bataevb3638132018-07-19 16:34:13 +0000718// CK12-LABEL: implicit_maps_float_complex{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000719void implicit_maps_float_complex (int a){
720 float _Complex fc = (float)a;
721
George Rokos63bc9d62017-11-21 18:25:12 +0000722 // 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 +0000723 // CK12-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
724 // CK12-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
725 // CK12-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
726 // CK12-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
727
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000728 // CK12-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
729 // CK12-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
730 // CK12-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
731 // CK12-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000732 // CK12-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
733 // CK12-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
734 // CK12-64-DAG: store { float, float } {{.+}}, { float, float }* [[CADDR]],
735
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000736 // CK12-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { float, float }**
737 // CK12-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { float, float }**
738 // CK12-32-DAG: store { float, float }* [[DECL:%[^,]+]], { float, float }** [[CBP1]]
739 // CK12-32-DAG: store { float, float }* [[DECL]], { float, float }** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000740
741 // CK12-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
742 // CK12-32: call void [[KERNEL:@.+]]({ float, float }* [[DECL]])
743 #pragma omp target
744 {
745 fc *= fc;
746 }
747}
748
749// CK12-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
750// CK12-64: [[ADDR:%.+]] = alloca i[[sz]],
751// CK12-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
752// CK12-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
753// CK12-64: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[CADDR]], i32 0, i32 0
754
755// CK12-32: define internal void [[KERNEL]]({ float, float }* {{.+}}[[ARG:%.+]])
756// CK12-32: [[ADDR:%.+]] = alloca { float, float }*,
757// CK12-32: store { float, float }* [[ARG]], { float, float }** [[ADDR]],
758// CK12-32: [[REF:%.+]] = load { float, float }*, { float, float }** [[ADDR]],
759// CK12-32: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[REF]], i32 0, i32 0
760#endif
761///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000762// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13
Samuel Antao1168d63c2016-06-30 21:22:08 +0000763// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000764// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13
765// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13
Samuel Antao1168d63c2016-06-30 21:22:08 +0000766// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000767// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000768
Joel E. Denny72c27832018-07-11 20:26:20 +0000769// RUN: %clang_cc1 -DCK13 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000770// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000771// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s
772// RUN: %clang_cc1 -DCK13 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000773// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000774// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000775// SIMD-ONLY12-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000776#ifdef CK13
777
Alexey Bataevc15ea702018-05-09 18:02:37 +0000778// CK13-LABEL: @.__omp_offloading_{{.*}}implicit_maps_variable_length_array{{.*}}_l825.region_id = weak constant i8 0
779
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000780// We don't have a constant map size for VLAs.
781// Map types:
Alexey Bataevb3638132018-07-19 16:34:13 +0000782// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM = 288 (vla size)
783// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM = 288 (vla size)
784// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547
George Rokos63bc9d62017-11-21 18:25:12 +0000785// CK13-DAG: [[TYPES:@.+]] = {{.+}}constant [3 x i64] [i64 288, i64 288, i64 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000786
Alexey Bataevb3638132018-07-19 16:34:13 +0000787// CK13-LABEL: implicit_maps_variable_length_array{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000788void implicit_maps_variable_length_array (int a){
789 double vla[2][a];
790
George Rokos63bc9d62017-11-21 18:25:12 +0000791 // 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 +0000792 // CK13-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
793 // CK13-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
794 // CK13-DAG: [[SGEP]] = getelementptr inbounds {{.+}}[[SS:%[^,]+]], i32 0, i32 0
795
796 // CK13-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
797 // CK13-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
798 // CK13-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000799 // CK13-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[sz]]*
800 // CK13-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[sz]]*
801 // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CBP0]]
802 // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000803 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S0]],
804
805 // CK13-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
806 // CK13-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
807 // CK13-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000808 // CK13-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
809 // CK13-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
810 // CK13-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
811 // CK13-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000812 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S1]],
813
814 // CK13-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
815 // CK13-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
816 // CK13-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000817 // CK13-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double**
818 // CK13-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
819 // CK13-DAG: store double* [[DECL:%.+]], double** [[CBP2]]
820 // CK13-DAG: store double* [[DECL]], double** [[CP2]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000821 // CK13-DAG: store i[[sz]] [[VALS2:%.+]], i[[sz]]* [[S2]],
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000822 // CK13-DAG: [[VALS2]] = mul nuw i[[sz]] %{{.+}}, 8
823
824 // CK13: call void [[KERNEL:@.+]](i[[sz]] {{.+}}, i[[sz]] {{.+}}, double* [[DECL]])
825 #pragma omp target
826 {
827 vla[1][3] += 1.0;
828 }
829}
830
Alexey Bataev2f5ed342016-10-13 09:52:46 +0000831// CK13: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.*}}[[ARG:%.+]])
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000832// CK13: [[ADDR0:%.+]] = alloca i[[sz]],
833// CK13: [[ADDR1:%.+]] = alloca i[[sz]],
834// CK13: [[ADDR2:%.+]] = alloca double*,
835// CK13: store i[[sz]] [[VLA0]], i[[sz]]* [[ADDR0]],
836// CK13: store i[[sz]] [[VLA1]], i[[sz]]* [[ADDR1]],
837// CK13: store double* [[ARG]], double** [[ADDR2]],
838// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR0]],
839// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR1]],
840// CK13: [[REF:%.+]] = load double*, double** [[ADDR2]],
841// CK13: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] %{{.+}}
842#endif
843///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000844// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64
Samuel Antao1168d63c2016-06-30 21:22:08 +0000845// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000846// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-64
847// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32
Samuel Antao1168d63c2016-06-30 21:22:08 +0000848// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000849// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 --check-prefix CK14-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000850
Joel E. Denny72c27832018-07-11 20:26:20 +0000851// RUN: %clang_cc1 -DCK14 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000852// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000853// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s
854// RUN: %clang_cc1 -DCK14 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000855// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000856// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY13 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000857// SIMD-ONLY13-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000858#ifdef CK14
859
860// CK14-DAG: [[ST:%.+]] = type { i32, double }
Alexey Bataevc15ea702018-05-09 18:02:37 +0000861
862// CK14-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l877.region_id = weak constant i8 0
863
Alexey Bataevb3638132018-07-19 16:34:13 +0000864
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000865// Map types:
Alexey Bataevb3638132018-07-19 16:34:13 +0000866// - OMP_MAP_TARGET_PARAM = 32
867// - OMP_MAP_TO + OMP_MAP_FROM | OMP_MAP_IMPLICIT | OMP_MAP_MEMBER_OF = 281474976711171
868// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
869// CK14-DAG: [[TYPES:@.+]] = {{.+}}constant [4 x i64] [i64 32, i64 281474976711171, i64 281474976711171, i64 800]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000870
871class SSS {
872public:
873 int a;
874 double b;
875
876 void foo(int c) {
877 #pragma omp target
878 {
879 a += c;
880 b += (double)c;
881 }
882 }
883
884 SSS(int a, double b) : a(a), b(b) {}
885};
886
Alexey Bataevb3638132018-07-19 16:34:13 +0000887// CK14-LABEL: implicit_maps_class{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000888void implicit_maps_class (int a){
889 SSS sss(a, (double)a);
890
891 // CK14: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
Alexey Bataevb3638132018-07-19 16:34:13 +0000892 // CK14-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 4, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i[[sz:64|32]]* [[SIZES:%[^,]+]], {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000893 // CK14-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
894 // CK14-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
Alexey Bataevb3638132018-07-19 16:34:13 +0000895 // CK14-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]], i32 0, i32 0
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000896
897 // CK14-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
898 // CK14-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataevb3638132018-07-19 16:34:13 +0000899 // CK14-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000900 // CK14-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000901 // CK14-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000902 // CK14-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +0000903 // CK14-DAG: store i32* [[A:%.+]], i32** [[CP0]]
904 // CK14-DAG: store i[[sz]] %{{.+}}, i[[sz]]* [[S0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000905
906 // CK14-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
907 // CK14-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataevb3638132018-07-19 16:34:13 +0000908 // CK14-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 1
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000909 // CK14-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
Alexey Bataevb3638132018-07-19 16:34:13 +0000910 // CK14-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000911 // CK14-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]]
Alexey Bataevb3638132018-07-19 16:34:13 +0000912 // CK14-DAG: store i32* [[A]], i32** [[CP1]]
913 // CK14-DAG: store i[[sz]] 4, i[[sz]]* [[S1]]
Alexey Bataevf47c4b42017-09-26 13:47:31 +0000914
Alexey Bataevb3638132018-07-19 16:34:13 +0000915 // CK14-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
916 // CK14-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
917 // CK14-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 2
918 // CK14-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]**
919 // CK14-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
920 // CK14-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]]
921 // CK14-DAG: store double* %{{.+}}, double** [[CP2]]
922 // CK14-DAG: store i[[sz]] 8, i[[sz]]* [[S2]]
923
924 // CK14-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3
925 // CK14-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3
926 // CK14-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 3
927 // CK14-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i[[sz]]*
928 // CK14-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i[[sz]]*
929 // CK14-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP3]]
930 // CK14-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP3]]
931 // CK14-DAG: store i[[sz]] 4, i[[sz]]* [[S3]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000932 // CK14-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
933 // CK14-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
934 // CK14-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
935
936 // CK14: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
937 sss.foo(123);
938}
939
940// CK14: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
941// CK14: [[ADDR0:%.+]] = alloca [[ST]]*,
942// CK14: [[ADDR1:%.+]] = alloca i[[sz]],
943// CK14: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
944// CK14: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
945// CK14: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
946// CK14-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
947// CK14-64: {{.+}} = load i32, i32* [[CADDR1]],
948// CK14-32: {{.+}} = load i32, i32* [[ADDR1]],
949// CK14: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
950
951#endif
952///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +0000953// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64
Samuel Antao1168d63c2016-06-30 21:22:08 +0000954// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000955// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-64
956// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32
Samuel Antao1168d63c2016-06-30 21:22:08 +0000957// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000958// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 --check-prefix CK15-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000959
Joel E. Denny72c27832018-07-11 20:26:20 +0000960// RUN: %clang_cc1 -DCK15 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000961// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000962// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s
963// RUN: %clang_cc1 -DCK15 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000964// 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
Joel E. Denny72c27832018-07-11 20:26:20 +0000965// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY14 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +0000966// SIMD-ONLY14-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000967#ifdef CK15
968
Alexey Bataevb3638132018-07-19 16:34:13 +0000969// CK15: [[ST:%.+]] = type { i32, double }
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000970// Map types:
Alexey Bataevb3638132018-07-19 16:34:13 +0000971// - OMP_MAP_TARGET_PARAM = 32
972// - OMP_MAP_TO + OMP_MAP_FROM | OMP_MAP_IMPLICIT | OMP_MAP_MEMBER_OF = 281474976711171
973// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
974// CK15: [[TYPES:@.+]] = {{.+}}constant [4 x i64] [i64 32, i64 281474976711171, i64 281474976711171, i64 800]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000975
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000976// Map types:
Alexey Bataevb3638132018-07-19 16:34:13 +0000977// - OMP_MAP_TARGET_PARAM = 32
978// - OMP_MAP_TO + OMP_MAP_FROM | OMP_MAP_IMPLICIT | OMP_MAP_MEMBER_OF = 281474976711171
979// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
980// CK15: [[TYPES2:@.+]] = {{.+}}constant [4 x i64] [i64 32, i64 281474976711171, i64 281474976711171, i64 800]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000981
982template<int x>
983class SSST {
984public:
985 int a;
986 double b;
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000987
988 void foo(int c) {
989 #pragma omp target
990 {
991 a += c + x;
992 b += (double)(c + x);
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000993 }
994 }
995 template<int y>
996 void bar(int c) {
997 #pragma omp target
998 {
999 a += c + x + y;
1000 b += (double)(c + x + y);
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001001 }
1002 }
1003
Alexey Bataevb3638132018-07-19 16:34:13 +00001004 SSST(int a, double b) : a(a), b(b) {}
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001005};
1006
Alexey Bataevb3638132018-07-19 16:34:13 +00001007// CK15-LABEL: implicit_maps_templated_class{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001008void implicit_maps_templated_class (int a){
Alexey Bataevb3638132018-07-19 16:34:13 +00001009 SSST<123> ssst(a, (double)a);
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001010
1011 // CK15: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
Alexey Bataevb3638132018-07-19 16:34:13 +00001012 // CK15-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 4, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i[[sz:64|32]]* [[SIZES:%[^,]+]], {{.+}}[[TYPES]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001013 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1014 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
Alexey Bataevb3638132018-07-19 16:34:13 +00001015 // CK15-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]], i32 0, i32 0
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001016
1017 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1018 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataevb3638132018-07-19 16:34:13 +00001019 // CK15-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001020 // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001021 // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001022 // CK15-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00001023 // CK15-DAG: store i32* [[A:%.+]], i32** [[CP0]]
1024 // CK15-DAG: store i[[sz]] %{{.+}}, i[[sz]]* [[S0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001025
1026 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
1027 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataevb3638132018-07-19 16:34:13 +00001028 // CK15-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 1
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001029 // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
Alexey Bataevb3638132018-07-19 16:34:13 +00001030 // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001031 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]]
Alexey Bataevb3638132018-07-19 16:34:13 +00001032 // CK15-DAG: store i32* [[A]], i32** [[CP1]]
1033 // CK15-DAG: store i[[sz]] 4, i[[sz]]* [[S1]]
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001034
1035 // CK15-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
1036 // CK15-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
Alexey Bataevb3638132018-07-19 16:34:13 +00001037 // CK15-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 2
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001038 // CK15-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]**
Alexey Bataevb3638132018-07-19 16:34:13 +00001039 // CK15-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001040 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]]
Alexey Bataevb3638132018-07-19 16:34:13 +00001041 // CK15-DAG: store double* %{{.+}}, double** [[CP2]]
1042 // CK15-DAG: store i[[sz]] 8, i[[sz]]* [[S2]]
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001043
1044 // CK15-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3
1045 // CK15-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3
Alexey Bataevb3638132018-07-19 16:34:13 +00001046 // CK15-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 3
1047 // CK15-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i[[sz]]*
1048 // CK15-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i[[sz]]*
1049 // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP3]]
1050 // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP3]]
1051 // CK15-DAG: store i[[sz]] 4, i[[sz]]* [[S3]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001052 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1053 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1054 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1055
1056 // CK15: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
1057 ssst.foo(456);
1058
1059 // CK15: define {{.*}}void @{{.+}}bar{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
Alexey Bataevb3638132018-07-19 16:34:13 +00001060 // CK15-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 4, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i[[sz]]* [[SIZES:[^,]+]], {{.+}}[[TYPES2]]{{.+}})
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001061 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1062 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
Alexey Bataevb3638132018-07-19 16:34:13 +00001063 // CK15-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]], i32 0, i32 0
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001064
1065 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1066 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataevb3638132018-07-19 16:34:13 +00001067 // CK15-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001068 // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001069 // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
Alexey Bataevb3638132018-07-19 16:34:13 +00001070 // CK15-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]]
1071 // CK15-DAG: store i32* [[A:%.+]], i32** [[CP0]]
1072 // CK15-DAG: store i[[sz]] %{{.+}}, i[[sz]]* [[S0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001073
1074 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
1075 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataevb3638132018-07-19 16:34:13 +00001076 // CK15-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 1
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001077 // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
Alexey Bataevb3638132018-07-19 16:34:13 +00001078 // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001079 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP1]]
Alexey Bataevb3638132018-07-19 16:34:13 +00001080 // CK15-DAG: store i32* [[A]], i32** [[CP1]]
1081 // CK15-DAG: store i[[sz]] 4, i[[sz]]* [[S1]]
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001082
1083 // CK15-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
1084 // CK15-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
Alexey Bataevb3638132018-07-19 16:34:13 +00001085 // CK15-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 2
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001086 // CK15-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]**
Alexey Bataevb3638132018-07-19 16:34:13 +00001087 // CK15-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001088 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CBP2]]
Alexey Bataevb3638132018-07-19 16:34:13 +00001089 // CK15-DAG: store double* %{{.+}}, double** [[CP2]]
1090 // CK15-DAG: store i[[sz]] 8, i[[sz]]* [[S2]]
Alexey Bataevf47c4b42017-09-26 13:47:31 +00001091
1092 // CK15-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 3
1093 // CK15-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 3
Alexey Bataevb3638132018-07-19 16:34:13 +00001094 // CK15-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i32 0, i32 3
1095 // CK15-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to i[[sz]]*
1096 // CK15-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i[[sz]]*
1097 // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP3]]
1098 // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP3]]
1099 // CK15-DAG: store i[[sz]] 4, i[[sz]]* [[S3]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001100 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1101 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1102 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1103
1104 // CK15: call void [[KERNEL2:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
1105 ssst.bar<210>(789);
1106}
1107
1108// CK15: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
1109// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
1110// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
1111// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
1112// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
1113// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
1114// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
1115// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
1116// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
1117// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
1118
1119// CK15: define internal void [[KERNEL2]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
1120// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
1121// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
1122// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
1123// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
1124// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
1125// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
1126// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
1127// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
1128// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
1129
1130#endif
1131///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00001132// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64
Samuel Antao1168d63c2016-06-30 21:22:08 +00001133// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001134// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-64
1135// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32
Samuel Antao1168d63c2016-06-30 21:22:08 +00001136// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001137// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 --check-prefix CK16-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001138
Joel E. Denny72c27832018-07-11 20:26:20 +00001139// RUN: %clang_cc1 -DCK16 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001140// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001141// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s
1142// RUN: %clang_cc1 -DCK16 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001143// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001144// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY15 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001145// SIMD-ONLY15-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001146#ifdef CK16
1147
1148// CK16-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
1149// Map types:
Alexey Bataevb3638132018-07-19 16:34:13 +00001150// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
1151// CK16-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001152
1153template<int y>
1154int foo(int d) {
1155 int res = d;
1156 #pragma omp target
1157 {
1158 res += y;
1159 }
1160 return res;
1161}
Alexey Bataevb3638132018-07-19 16:34:13 +00001162// CK16-LABEL: implicit_maps_templated_function{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001163void implicit_maps_templated_function (int a){
1164 int i = a;
1165
1166 // CK16: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
George Rokos63bc9d62017-11-21 18:25:12 +00001167 // 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 +00001168 // CK16-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1169 // CK16-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1170
1171 // CK16-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1172 // CK16-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001173 // CK16-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
1174 // CK16-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
1175 // CK16-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
1176 // CK16-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001177 // CK16-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1178 // CK16-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1179 // CK16-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1180
1181 // CK16: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
1182 i = foo<543>(i);
1183}
1184// CK16: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
1185// CK16: [[ADDR:%.+]] = alloca i[[sz]],
1186// CK16: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
1187// CK16-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
1188// CK16-64: {{.+}} = load i32, i32* [[CADDR]],
1189// CK16-32: {{.+}} = load i32, i32* [[ADDR]],
1190
1191#endif
1192///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00001193// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17
Samuel Antao1168d63c2016-06-30 21:22:08 +00001194// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001195// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17
1196// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17
Samuel Antao1168d63c2016-06-30 21:22:08 +00001197// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001198// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001199
Joel E. Denny72c27832018-07-11 20:26:20 +00001200// RUN: %clang_cc1 -DCK17 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001201// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001202// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s
1203// RUN: %clang_cc1 -DCK17 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001204// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001205// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001206// SIMD-ONLY16-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001207#ifdef CK17
1208
1209// CK17-DAG: [[ST:%.+]] = type { i32, double }
Alexey Bataevb3638132018-07-19 16:34:13 +00001210// CK17-LABEL: @.__omp_offloading_{{.*}}implicit_maps_struct{{.*}}_l1236.region_id = weak constant i8 0
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001211// CK17-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} {{16|12}}]
Alexey Bataevb3638132018-07-19 16:34:13 +00001212// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547
George Rokos63bc9d62017-11-21 18:25:12 +00001213// CK17-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001214
1215class SSS {
1216public:
1217 int a;
1218 double b;
1219};
1220
Alexey Bataevb3638132018-07-19 16:34:13 +00001221// CK17-LABEL: implicit_maps_struct{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001222void implicit_maps_struct (int a){
1223 SSS s = {a, (double)a};
1224
George Rokos63bc9d62017-11-21 18:25:12 +00001225 // 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 +00001226 // CK17-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1227 // CK17-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1228 // CK17-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1229 // CK17-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001230 // CK17-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
1231 // CK17-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[ST]]**
1232 // CK17-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP1]]
1233 // CK17-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001234
1235 // CK17: call void [[KERNEL:@.+]]([[ST]]* [[DECL]])
1236 #pragma omp target
1237 {
1238 s.a += 1;
1239 s.b += 1.0;
1240 }
1241}
1242
1243// CK17: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]])
1244// CK17: [[ADDR:%.+]] = alloca [[ST]]*,
1245// CK17: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]],
1246// CK17: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]],
1247// CK17: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0
1248#endif
1249///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00001250// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64
Samuel Antao1168d63c2016-06-30 21:22:08 +00001251// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001252// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-64
1253// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32
Samuel Antao1168d63c2016-06-30 21:22:08 +00001254// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001255// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 --check-prefix CK18-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001256
Joel E. Denny72c27832018-07-11 20:26:20 +00001257// RUN: %clang_cc1 -DCK18 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001258// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001259// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s
1260// RUN: %clang_cc1 -DCK18 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001261// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001262// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY17 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001263// SIMD-ONLY17-NOT: {{__kmpc|__tgt}}
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001264#ifdef CK18
1265
1266// CK18-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
1267// Map types:
Alexey Bataevb3638132018-07-19 16:34:13 +00001268// - OMP_MAP_PRIVATE_VAL + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800
1269// CK18-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001270
1271template<typename T>
1272int foo(T d) {
1273 #pragma omp target
1274 {
1275 d += (T)1;
1276 }
1277 return d;
1278}
Alexey Bataevb3638132018-07-19 16:34:13 +00001279// CK18-LABEL: implicit_maps_template_type_capture{{.*}}(
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001280void implicit_maps_template_type_capture (int a){
1281 int i = a;
1282
1283 // CK18: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
George Rokos63bc9d62017-11-21 18:25:12 +00001284 // 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 +00001285 // CK18-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1286 // CK18-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1287
1288 // CK18-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1289 // CK18-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001290 // CK18-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
1291 // CK18-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
1292 // CK18-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
1293 // CK18-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001294 // CK18-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1295 // CK18-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1296 // CK18-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1297
1298 // CK18: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
1299 i = foo(i);
1300}
1301// CK18: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
1302// CK18: [[ADDR:%.+]] = alloca i[[sz]],
1303// CK18: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
1304// CK18-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
1305// CK18-64: {{.+}} = load i32, i32* [[CADDR]],
1306// CK18-32: {{.+}} = load i32, i32* [[ADDR]],
1307
1308#endif
Samuel Antao86ace552016-04-27 22:40:57 +00001309///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00001310// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK19 --check-prefix CK19-64
Samuel Antao1168d63c2016-06-30 21:22:08 +00001311// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001312// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK19 --check-prefix CK19-64
1313// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK19 --check-prefix CK19-32
Samuel Antao1168d63c2016-06-30 21:22:08 +00001314// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001315// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK19 --check-prefix CK19-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001316
Joel E. Denny72c27832018-07-11 20:26:20 +00001317// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001318// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001319// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s
1320// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001321// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00001322// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00001323// SIMD-ONLY18-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00001324#ifdef CK19
1325
Alexey Bataevb3638132018-07-19 16:34:13 +00001326// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1510.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001327// CK19: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001328// CK19: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001329
Alexey Bataevb3638132018-07-19 16:34:13 +00001330// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1531.region_id = weak constant i8 0
Alexey Bataevc15ea702018-05-09 18:02:37 +00001331// CK19: [[SIZE00n:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001332// CK19: [[MTYPE00n:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Jonas Hahnfeldf7c4d7b2017-07-01 10:40:50 +00001333
Alexey Bataevb3638132018-07-19 16:34:13 +00001334// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1553.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001335// CK19: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00001336// CK19: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001337
Alexey Bataevb3638132018-07-19 16:34:13 +00001338// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1572.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001339// CK19: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001340// CK19: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001341
Alexey Bataevb3638132018-07-19 16:34:13 +00001342// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1591.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001343// CK19: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001344// CK19: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001345
Alexey Bataevb3638132018-07-19 16:34:13 +00001346// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1610.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001347// CK19: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00001348// CK19: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001349
Alexey Bataevb3638132018-07-19 16:34:13 +00001350// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1629.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001351// CK19: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001352// CK19: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001353
Alexey Bataevb3638132018-07-19 16:34:13 +00001354// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1652.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001355// CK19: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001356
Alexey Bataevb3638132018-07-19 16:34:13 +00001357// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1675.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001358// CK19: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001359
Alexey Bataevb3638132018-07-19 16:34:13 +00001360// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1694.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001361// CK19: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001362// CK19: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001363
Alexey Bataevb3638132018-07-19 16:34:13 +00001364// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1715.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001365// CK19: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00001366// CK19: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001367
Alexey Bataevb3638132018-07-19 16:34:13 +00001368// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1736.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001369// CK19: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001370// CK19: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001371
Alexey Bataevb3638132018-07-19 16:34:13 +00001372// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1757.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001373// CK19: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001374// CK19: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001375
Alexey Bataevb3638132018-07-19 16:34:13 +00001376// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1778.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001377// CK19: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001378// CK19: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001379
Alexey Bataevb3638132018-07-19 16:34:13 +00001380// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1803.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001381// CK19: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i64] [i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001382
Alexey Bataevb3638132018-07-19 16:34:13 +00001383// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1828.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001384// CK19: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001385
Alexey Bataevb3638132018-07-19 16:34:13 +00001386// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1849.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001387// CK19: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001388// CK19: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001389
Alexey Bataevb3638132018-07-19 16:34:13 +00001390// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1883.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001391// CK19: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001392
Alexey Bataevb3638132018-07-19 16:34:13 +00001393// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1909.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001394// CK19: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001395// CK19: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001396
Alexey Bataevb3638132018-07-19 16:34:13 +00001397// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1935.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001398// CK19: [[SIZE18:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
George Rokos63bc9d62017-11-21 18:25:12 +00001399// CK19: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001400
Alexey Bataevb3638132018-07-19 16:34:13 +00001401// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1967.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001402// CK19: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001403
Alexey Bataevb3638132018-07-19 16:34:13 +00001404// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1993.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001405// CK19: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001406// CK19: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001407
Alexey Bataevb3638132018-07-19 16:34:13 +00001408// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2025.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001409// CK19: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001410
Alexey Bataevb3638132018-07-19 16:34:13 +00001411// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2051.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001412// CK19: [[SIZE22:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001413// CK19: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i64] [i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001414
Alexey Bataevb3638132018-07-19 16:34:13 +00001415// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2070.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001416// CK19: [[SIZE23:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001417// CK19: [[MTYPE23:@.+]] = private {{.*}}constant [1 x i64] [i64 39]
Samuel Antao86ace552016-04-27 22:40:57 +00001418
Alexey Bataevb3638132018-07-19 16:34:13 +00001419// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2092.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001420// CK19: [[SIZE24:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 480]
George Rokos63bc9d62017-11-21 18:25:12 +00001421// CK19: [[MTYPE24:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001422
Alexey Bataevb3638132018-07-19 16:34:13 +00001423// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2113.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001424// CK19: [[SIZE25:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00001425// CK19: [[MTYPE25:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001426
Alexey Bataevb3638132018-07-19 16:34:13 +00001427// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2134.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001428// CK19: [[SIZE26:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 24]
George Rokos63bc9d62017-11-21 18:25:12 +00001429// CK19: [[MTYPE26:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001430
Alexey Bataevb3638132018-07-19 16:34:13 +00001431// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2155.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001432// CK19: [[SIZE27:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00001433// CK19: [[MTYPE27:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001434
Alexey Bataevb3638132018-07-19 16:34:13 +00001435// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2200.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001436// CK19: [[SIZE28:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 16]
Alexey Bataevb3638132018-07-19 16:34:13 +00001437// CK19: [[MTYPE28:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 16, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001438
Alexey Bataevb3638132018-07-19 16:34:13 +00001439// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2245.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001440// CK19: [[SIZE29:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
Alexey Bataevb3638132018-07-19 16:34:13 +00001441// CK19: [[MTYPE29:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 16, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001442
Alexey Bataevb3638132018-07-19 16:34:13 +00001443// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2301.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001444// CK19: [[MTYPE30:@.+]] = private {{.*}}constant [4 x i64] [i64 288, i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001445
Alexey Bataevb3638132018-07-19 16:34:13 +00001446// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2345.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001447// 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 +00001448// CK19: [[MTYPE31:@.+]] = private {{.*}}constant [4 x i64] [i64 288, i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001449
Alexey Bataevb3638132018-07-19 16:34:13 +00001450// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2368.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001451// CK19: [[SIZE32:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
George Rokos63bc9d62017-11-21 18:25:12 +00001452// CK19: [[MTYPE32:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001453
Alexey Bataevb3638132018-07-19 16:34:13 +00001454// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2387.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001455// CK19: [[SIZE33:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
George Rokos63bc9d62017-11-21 18:25:12 +00001456// CK19: [[MTYPE33:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001457
Alexey Bataevb3638132018-07-19 16:34:13 +00001458// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2406.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001459// CK19: [[SIZE34:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
George Rokos63bc9d62017-11-21 18:25:12 +00001460// CK19: [[MTYPE34:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001461
Alexey Bataevb3638132018-07-19 16:34:13 +00001462// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2431.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001463// CK19: [[MTYPE35:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001464
Alexey Bataevb3638132018-07-19 16:34:13 +00001465// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2452.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001466// CK19: [[SIZE36:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 208]
George Rokos63bc9d62017-11-21 18:25:12 +00001467// CK19: [[MTYPE36:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001468
Alexey Bataevb3638132018-07-19 16:34:13 +00001469// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2492.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001470// CK19: [[MTYPE37:@.+]] = private {{.*}}constant [3 x i64] [i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001471
Alexey Bataevb3638132018-07-19 16:34:13 +00001472// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2534.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001473// CK19: [[MTYPE38:@.+]] = private {{.*}}constant [3 x i64] [i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001474
Alexey Bataevb3638132018-07-19 16:34:13 +00001475// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2576.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001476// CK19: [[MTYPE39:@.+]] = private {{.*}}constant [3 x i64] [i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001477
Alexey Bataevb3638132018-07-19 16:34:13 +00001478// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2618.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001479// CK19: [[MTYPE40:@.+]] = private {{.*}}constant [3 x i64] [i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001480
Alexey Bataevb3638132018-07-19 16:34:13 +00001481// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2653.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001482// 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 +00001483// CK19: [[MTYPE41:@.+]] = private {{.*}}constant [3 x i64] [i64 288, i64 288, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001484
Alexey Bataevb3638132018-07-19 16:34:13 +00001485// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2698.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00001486// CK19: [[SIZE42:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 104]
Alexey Bataevb3638132018-07-19 16:34:13 +00001487// CK19: [[MTYPE42:@.+]] = private {{.*}}constant [3 x i64] [i64 35, i64 16, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001488
Alexey Bataevb3638132018-07-19 16:34:13 +00001489// CK19-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l2723.region_id = weak constant i8 0
George Rokos63bc9d62017-11-21 18:25:12 +00001490// CK19: [[MTYPE43:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001491
Alexey Bataevb3638132018-07-19 16:34:13 +00001492// CK19-LABEL: explicit_maps_single{{.*}}(
Samuel Antao86ace552016-04-27 22:40:57 +00001493void explicit_maps_single (int ii){
1494 // Map of a scalar.
1495 int a = ii;
1496
1497 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00001498 // 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 +00001499 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1500 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1501
1502 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1503 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001504 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1505 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1506 // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
1507 // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001508
1509 // CK19: call void [[CALL00:@.+]](i32* {{[^,]+}})
1510 #pragma omp target map(alloc:a)
1511 {
1512 ++a;
1513 }
1514
Jonas Hahnfeldf7c4d7b2017-07-01 10:40:50 +00001515 // Map of a scalar in nested region.
1516 int b = a;
1517
1518 // Region 00n
George Rokos63bc9d62017-11-21 18:25:12 +00001519 // 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 +00001520 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1521 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1522
1523 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1524 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1525 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1526 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1527 // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
1528 // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
1529
1530 // CK19: call void [[CALL00n:@.+]](i32* {{[^,]+}})
1531 #pragma omp target map(alloc:b)
1532 #pragma omp parallel
1533 {
1534 ++b;
1535 }
1536
Samuel Antao86ace552016-04-27 22:40:57 +00001537 // Map of an array.
1538 int arra[100];
1539
1540 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00001541 // 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 +00001542 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1543 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1544
1545 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1546 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001547 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1548 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]**
1549 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1550 // CK19-DAG: store [100 x i32]* [[VAR0]], [100 x i32]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001551
1552 // CK19: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
1553 #pragma omp target map(to:arra)
1554 {
1555 arra[50]++;
1556 }
1557
1558 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00001559 // 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 +00001560 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1561 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1562
1563 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1564 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001565 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1566 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1567 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1568 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001569 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 20
1570
1571 // CK19: call void [[CALL02:@.+]]([100 x i32]* {{[^,]+}})
1572 #pragma omp target map(from:arra[20:60])
1573 {
1574 arra[50]++;
1575 }
1576
1577 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00001578 // 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 +00001579 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1580 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1581
1582 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1583 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001584 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1585 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1586 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1587 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001588 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1589
1590 // CK19: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
1591 #pragma omp target map(tofrom:arra[:60])
1592 {
1593 arra[50]++;
1594 }
1595
1596 // Region 04
George Rokos63bc9d62017-11-21 18:25:12 +00001597 // 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 +00001598 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1599 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1600
1601 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1602 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001603 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1604 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1605 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1606 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001607 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1608
1609 // CK19: call void [[CALL04:@.+]]([100 x i32]* {{[^,]+}})
1610 #pragma omp target map(alloc:arra[:])
1611 {
1612 arra[50]++;
1613 }
1614
1615 // Region 05
George Rokos63bc9d62017-11-21 18:25:12 +00001616 // 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 +00001617 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1618 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1619
1620 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1621 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001622 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1623 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1624 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1625 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001626 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 15
1627
1628 // CK19: call void [[CALL05:@.+]]([100 x i32]* {{[^,]+}})
1629 #pragma omp target map(to:arra[15])
1630 {
1631 arra[15]++;
1632 }
1633
1634 // Region 06
George Rokos63bc9d62017-11-21 18:25:12 +00001635 // 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 +00001636 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1637 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1638 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1639
1640 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1641 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1642 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001643 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1644 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1645 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1646 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001647 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001648 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1649 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1650
1651 // CK19: call void [[CALL06:@.+]]([100 x i32]* {{[^,]+}})
1652 #pragma omp target map(tofrom:arra[ii:ii+23])
1653 {
1654 arra[50]++;
1655 }
1656
1657 // Region 07
George Rokos63bc9d62017-11-21 18:25:12 +00001658 // 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 +00001659 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1660 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1661 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1662
1663 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1664 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1665 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001666 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1667 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1668 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1669 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001670 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001671 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1672 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1673
1674 // CK19: call void [[CALL07:@.+]]([100 x i32]* {{[^,]+}})
1675 #pragma omp target map(alloc:arra[:ii])
1676 {
1677 arra[50]++;
1678 }
1679
1680 // Region 08
George Rokos63bc9d62017-11-21 18:25:12 +00001681 // 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 +00001682 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1683 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1684
1685 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1686 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001687 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1688 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1689 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1690 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001691 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1692
1693 // CK19: call void [[CALL08:@.+]]([100 x i32]* {{[^,]+}})
1694 #pragma omp target map(tofrom:arra[ii])
1695 {
1696 arra[15]++;
1697 }
1698
1699 // Map of a pointer.
1700 int *pa;
1701
1702 // Region 09
George Rokos63bc9d62017-11-21 18:25:12 +00001703 // 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 +00001704 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1705 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1706
1707 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1708 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001709 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
1710 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
1711 // CK19-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]]
1712 // CK19-DAG: store i32** [[VAR0]], i32*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001713
1714 // CK19: call void [[CALL09:@.+]](i32** {{[^,]+}})
1715 #pragma omp target map(from:pa)
1716 {
1717 pa[50]++;
1718 }
1719
1720 // Region 10
George Rokos63bc9d62017-11-21 18:25:12 +00001721 // 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 +00001722 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1723 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1724
1725 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1726 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001727 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1728 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1729 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1730 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001731 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1732 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 20
1733 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1734
1735 // CK19: call void [[CALL10:@.+]](i32* {{[^,]+}})
1736 #pragma omp target map(tofrom:pa[20:60])
1737 {
1738 pa[50]++;
1739 }
1740
1741 // Region 11
George Rokos63bc9d62017-11-21 18:25:12 +00001742 // 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 +00001743 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1744 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1745
1746 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1747 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001748 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1749 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1750 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1751 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001752 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1753 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1754 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1755
1756 // CK19: call void [[CALL11:@.+]](i32* {{[^,]+}})
1757 #pragma omp target map(alloc:pa[:60])
1758 {
1759 pa[50]++;
1760 }
1761
1762 // Region 12
George Rokos63bc9d62017-11-21 18:25:12 +00001763 // 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 +00001764 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1765 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1766
1767 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1768 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001769 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1770 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1771 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1772 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001773 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1774 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 15
1775 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1776
1777 // CK19: call void [[CALL12:@.+]](i32* {{[^,]+}})
1778 #pragma omp target map(to:pa[15])
1779 {
1780 pa[15]++;
1781 }
1782
1783 // Region 13
George Rokos63bc9d62017-11-21 18:25:12 +00001784 // 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 +00001785 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1786 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1787 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1788
1789 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1790 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1791 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001792 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1793 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1794 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1795 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001796 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001797 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1798 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1799 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1800 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1801
1802 // CK19: call void [[CALL13:@.+]](i32* {{[^,]+}})
1803 #pragma omp target map(alloc:pa[ii-23:ii])
1804 {
1805 pa[50]++;
1806 }
1807
1808 // Region 14
George Rokos63bc9d62017-11-21 18:25:12 +00001809 // 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 +00001810 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1811 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1812 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1813
1814 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1815 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1816 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001817 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1818 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1819 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1820 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001821 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001822 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1823 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1824 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1825 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1826
1827 // CK19: call void [[CALL14:@.+]](i32* {{[^,]+}})
1828 #pragma omp target map(to:pa[:ii])
1829 {
1830 pa[50]++;
1831 }
1832
1833 // Region 15
George Rokos63bc9d62017-11-21 18:25:12 +00001834 // 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 +00001835 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1836 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1837
1838 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1839 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001840 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1841 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1842 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1843 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001844 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1845 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1846 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1847
1848 // CK19: call void [[CALL15:@.+]](i32* {{[^,]+}})
1849 #pragma omp target map(from:pa[ii+12])
1850 {
1851 pa[15]++;
1852 }
1853
1854 // Map of a variable-size array.
1855 int va[ii];
1856
1857 // Region 16
George Rokos63bc9d62017-11-21 18:25:12 +00001858 // 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 +00001859 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1860 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1861 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1862
1863 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1864 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1865 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001866 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1867 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1868 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1869 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001870 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001871
1872 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1873 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1874 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001875 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1876 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1877 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1878 // CK19-DAG: store i32* [[VAR1]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001879 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001880 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1881
1882 // CK19: call void [[CALL16:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1883 #pragma omp target map(to:va)
1884 {
1885 va[50]++;
1886 }
1887
1888 // Region 17
George Rokos63bc9d62017-11-21 18:25:12 +00001889 // 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 +00001890 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1891 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1892
1893 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1894 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001895 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1896 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1897 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1898 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001899
1900 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1901 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001902 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1903 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1904 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1905 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001906 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 20
1907
1908 // CK19: call void [[CALL17:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1909 #pragma omp target map(from:va[20:60])
1910 {
1911 va[50]++;
1912 }
1913
1914 // Region 18
George Rokos63bc9d62017-11-21 18:25:12 +00001915 // 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 +00001916 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1917 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1918
1919 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1920 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001921 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1922 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1923 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1924 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001925
1926 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1927 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001928 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1929 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1930 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1931 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001932 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1933
1934 // CK19: call void [[CALL18:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1935 #pragma omp target map(tofrom:va[:60])
1936 {
1937 va[50]++;
1938 }
1939
1940 // Region 19
George Rokos63bc9d62017-11-21 18:25:12 +00001941 // 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 +00001942 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1943 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1944 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1945
1946 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1947 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1948 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001949 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1950 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1951 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1952 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001953 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001954
1955 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1956 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1957 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001958 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1959 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1960 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1961 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001962 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001963 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1964 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1965
1966 // CK19: call void [[CALL19:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1967 #pragma omp target map(alloc:va[:])
1968 {
1969 va[50]++;
1970 }
1971
1972 // Region 20
George Rokos63bc9d62017-11-21 18:25:12 +00001973 // 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 +00001974 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1975 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1976
1977 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1978 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001979 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1980 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1981 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1982 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001983
1984 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1985 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001986 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1987 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1988 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1989 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001990 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 15
1991
1992 // CK19: call void [[CALL20:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1993 #pragma omp target map(to:va[15])
1994 {
1995 va[15]++;
1996 }
1997
1998 // Region 21
George Rokos63bc9d62017-11-21 18:25:12 +00001999 // 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 +00002000 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2001 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2002 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2003
2004 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2005 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2006 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002007 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2008 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2009 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
2010 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002011 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002012
2013 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2014 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2015 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002016 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
2017 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
2018 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
2019 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002020 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002021 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
2022 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
2023
2024 // CK19: call void [[CALL21:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
2025 #pragma omp target map(tofrom:va[ii:ii+23])
2026 {
2027 va[50]++;
2028 }
2029
2030 // Region 22
George Rokos63bc9d62017-11-21 18:25:12 +00002031 // 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 +00002032 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2033 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2034
2035 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2036 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002037 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2038 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2039 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
2040 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002041
2042 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2043 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002044 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
2045 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
2046 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
2047 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002048 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
2049
2050 // CK19: call void [[CALL22:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
2051 #pragma omp target map(tofrom:va[ii])
2052 {
2053 va[15]++;
2054 }
2055
2056 // Always.
2057 // Region 23
George Rokos63bc9d62017-11-21 18:25:12 +00002058 // 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 +00002059 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2060 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2061
2062 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2063 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002064 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2065 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2066 // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
2067 // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002068
2069 // CK19: call void [[CALL23:@.+]](i32* {{[^,]+}})
2070 #pragma omp target map(always, tofrom: a)
2071 {
2072 a++;
2073 }
2074
2075 // Multidimensional arrays.
2076 int marr[4][5][6];
2077 int ***mptr;
2078
2079 // Region 24
George Rokos63bc9d62017-11-21 18:25:12 +00002080 // 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 +00002081 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2082 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2083
2084 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2085 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002086 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
2087 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [4 x [5 x [6 x i32]]]**
2088 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
2089 // 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 +00002090
2091 // CK19: call void [[CALL24:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
2092 #pragma omp target map(tofrom: marr)
2093 {
2094 marr[1][2][3]++;
2095 }
2096
2097 // Region 25
George Rokos63bc9d62017-11-21 18:25:12 +00002098 // 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 +00002099 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2100 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2101
2102 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2103 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002104 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
2105 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2106 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
2107 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002108 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 2
2109 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
2110 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2111
2112 // CK19: call void [[CALL25:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
2113 #pragma omp target map(tofrom: marr[1][2][2:4])
2114 {
2115 marr[1][2][3]++;
2116 }
2117
2118 // Region 26
George Rokos63bc9d62017-11-21 18:25:12 +00002119 // 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 +00002120 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2121 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2122
2123 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2124 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002125 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
2126 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2127 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
2128 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002129 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 0
2130 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
2131 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2132
2133 // CK19: call void [[CALL26:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
2134 #pragma omp target map(tofrom: marr[1][2][:])
2135 {
2136 marr[1][2][3]++;
2137 }
2138
2139 // Region 27
George Rokos63bc9d62017-11-21 18:25:12 +00002140 // 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 +00002141 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2142 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2143
2144 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2145 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002146 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
2147 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2148 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
2149 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002150 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 3
2151 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
2152 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2153
2154 // CK19: call void [[CALL27:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
2155 #pragma omp target map(tofrom: marr[1][2][3])
2156 {
2157 marr[1][2][3]++;
2158 }
2159
2160 // Region 28
George Rokos63bc9d62017-11-21 18:25:12 +00002161 // 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 +00002162 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2163 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2164
2165 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2166 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002167 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32****
2168 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32****
2169 // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]]
2170 // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002171 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
2172 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
2173 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
2174
2175 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2176 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002177 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32****
2178 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32***
2179 // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]]
2180 // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002181 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
2182 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
2183 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
2184 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
2185
2186 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2187 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002188 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32***
2189 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
2190 // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]]
2191 // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002192 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 2
2193 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
2194 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
2195 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
2196 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
2197 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
2198
2199 // CK19: call void [[CALL28:@.+]](i32*** {{[^,]+}})
2200 #pragma omp target map(tofrom: mptr[1][2][2:4])
2201 {
2202 mptr[1][2][3]++;
2203 }
2204
2205 // Region 29
George Rokos63bc9d62017-11-21 18:25:12 +00002206 // 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 +00002207 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2208 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2209
2210 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2211 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002212 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32****
2213 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32****
2214 // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]]
2215 // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002216 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
2217 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
2218 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
2219
2220 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2221 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002222 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32****
2223 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32***
2224 // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]]
2225 // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002226 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
2227 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
2228 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
2229 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
2230
2231 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2232 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002233 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32***
2234 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
2235 // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]]
2236 // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002237 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 3
2238 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
2239 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
2240 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
2241 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
2242 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
2243
2244 // CK19: call void [[CALL29:@.+]](i32*** {{[^,]+}})
2245 #pragma omp target map(tofrom: mptr[1][2][3])
2246 {
2247 mptr[1][2][3]++;
2248 }
2249
2250 // Multidimensional VLA.
2251 double mva[23][ii][ii+5];
2252
2253 // Region 30
George Rokos63bc9d62017-11-21 18:25:12 +00002254 // 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 +00002255 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2256 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2257 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2258 //
2259 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2260 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2261 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002262 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2263 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2264 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]]
2265 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002266 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2267 //
2268 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2269 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2270 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002271 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2272 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2273 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2274 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002275 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002276 // CK19-64-DAG: [[VAR1]] = zext i32 %{{[^,]+}} to i64
2277 // CK19-64-DAG: [[VAR11]] = zext i32 %{{[^,]+}} to i64
2278 //
2279 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2280 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2281 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002282 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]*
2283 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]*
2284 // CK19-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]]
2285 // CK19-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002286 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002287 // CK19-64-DAG: [[VAR2]] = zext i32 %{{[^,]+}} to i64
2288 // CK19-64-DAG: [[VAR22]] = zext i32 %{{[^,]+}} to i64
2289 //
2290 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
2291 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
2292 // CK19-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002293 // CK19-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double**
2294 // CK19-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
2295 // CK19-DAG: store double* [[VAR3:%.+]], double** [[CBP3]]
2296 // CK19-DAG: store double* [[VAR3]], double** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00002297 // CK19-DAG: store i[[Z]] [[CSVAL3:%[^,]+]], i[[Z]]* [[S3]]
Samuel Antao86ace552016-04-27 22:40:57 +00002298 // CK19-DAG: [[CSVAL3]] = mul nuw i[[Z]] %{{[^,]+}}, {{8|4}}
2299
2300 // CK19: call void [[CALL30:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
2301 #pragma omp target map(tofrom: mva)
2302 {
2303 mva[1][2][3]++;
2304 }
2305
2306 // Region 31
George Rokos63bc9d62017-11-21 18:25:12 +00002307 // 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 +00002308 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2309 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2310 //
2311 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2312 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002313 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2314 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2315 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]]
2316 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002317 //
2318 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2319 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002320 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2321 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2322 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2323 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002324 //
2325 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2326 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002327 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]*
2328 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]*
2329 // CK19-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]]
2330 // CK19-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002331 //
2332 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
2333 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002334 // CK19-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double**
2335 // CK19-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
2336 // CK19-DAG: store double* [[VAR3:%.+]], double** [[CBP3]]
2337 // CK19-DAG: store double* [[SEC3:%.+]], double** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00002338 // CK19-DAG: [[SEC3]] = getelementptr {{.*}}double* [[SEC33:%.+]], i[[Z]] 0
2339 // CK19-DAG: [[SEC33]] = getelementptr {{.*}}double* [[SEC333:%.+]], i[[Z]] [[IDX3:%.+]]
2340 // CK19-DAG: [[IDX3]] = mul nsw i[[Z]] %{{[^,]+}}, %{{[^,]+}}
2341 // CK19-DAG: [[SEC333]] = getelementptr {{.*}}double* [[VAR3]], i[[Z]] [[IDX33:%.+]]
2342 // CK19-DAG: [[IDX33]] = mul nsw i[[Z]] 1, %{{[^,]+}}
2343
2344 // CK19: call void [[CALL31:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
2345 #pragma omp target map(tofrom: mva[1][ii-2][:5])
2346 {
2347 mva[1][2][3]++;
2348 }
2349
2350 // Multidimensional array sections.
2351 double marras[11][12][13];
2352 double mvlaas[11][ii][13];
2353 double ***mptras;
2354
2355 // Region 32
George Rokos63bc9d62017-11-21 18:25:12 +00002356 // 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 +00002357 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2358 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2359
2360 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2361 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002362 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2363 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [11 x [12 x [13 x double]]]**
2364 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2365 // 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 +00002366
2367 // CK19: call void [[CALL32:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2368 #pragma omp target map(marras)
2369 {
2370 marras[1][2][3]++;
2371 }
2372
2373 // Region 33
George Rokos63bc9d62017-11-21 18:25:12 +00002374 // 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 +00002375 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2376 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2377
2378 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2379 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002380 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2381 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]**
2382 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2383 // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002384 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2385
2386 // CK19: call void [[CALL33:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2387 #pragma omp target map(marras[:])
2388 {
2389 marras[1][2][3]++;
2390 }
2391
2392 // Region 34
George Rokos63bc9d62017-11-21 18:25:12 +00002393 // 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 +00002394 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2395 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2396
2397 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2398 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002399 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2400 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]**
2401 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2402 // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002403 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2404
2405 // CK19: call void [[CALL34:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2406 #pragma omp target map(marras[:][:][:])
2407 {
2408 marras[1][2][3]++;
2409 }
2410
2411 // Region 35
George Rokos63bc9d62017-11-21 18:25:12 +00002412 // 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 +00002413 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2414 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2415 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2416 //
2417 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2418 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2419 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2420
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002421 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2422 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2423 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2424 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002425 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002426 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2427 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2428 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2429
2430 // CK19: call void [[CALL35:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2431 #pragma omp target map(marras[1][:ii][:])
2432 {
2433 marras[1][2][3]++;
2434 }
2435
2436 // Region 36
George Rokos63bc9d62017-11-21 18:25:12 +00002437 // 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 +00002438 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2439 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2440
2441 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2442 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002443 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2444 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2445 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2446 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002447 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i{{.+}} 0
2448 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 0
2449 // CK19-DAG: [[SEC000]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2450
2451 // CK19: call void [[CALL36:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2452 #pragma omp target map(marras[:1][:2][:13])
2453 {
2454 marras[1][2][3]++;
2455 }
2456
2457 // Region 37
George Rokos63bc9d62017-11-21 18:25:12 +00002458 // 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 +00002459 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2460 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2461 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2462 //
2463 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2464 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2465 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002466 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2467 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2468 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2469 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002470 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2471 //
2472 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2473 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2474 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002475 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2476 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2477 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2478 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002479 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002480 //
2481 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2482 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2483 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002484 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2485 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2486 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2487 // CK19-DAG: store [13 x double]* [[VAR2]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002488 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002489 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2490
2491 // CK19: call void [[CALL37:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2492 #pragma omp target map(mvlaas)
2493 {
2494 mvlaas[1][2][3]++;
2495 }
2496
2497 // Region 38
George Rokos63bc9d62017-11-21 18:25:12 +00002498 // 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 +00002499 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2500 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2501 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2502 //
2503 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2504 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2505 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002506 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2507 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2508 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2509 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002510 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2511 //
2512 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2513 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2514 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002515 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2516 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2517 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2518 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002519 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002520 //
2521 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2522 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2523 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002524 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2525 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2526 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2527 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002528 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002529 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2530 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2531 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2532
2533 // CK19: call void [[CALL38:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2534 #pragma omp target map(mvlaas[:])
2535 {
2536 mvlaas[1][2][3]++;
2537 }
2538
2539 // Region 39
George Rokos63bc9d62017-11-21 18:25:12 +00002540 // 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 +00002541 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2542 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2543 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2544 //
2545 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2546 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2547 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002548 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2549 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2550 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2551 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002552 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2553 //
2554 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2555 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2556 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002557 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2558 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2559 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2560 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002561 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002562 //
2563 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2564 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2565 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002566 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2567 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2568 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2569 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002570 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002571 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2572 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2573 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2574
2575 // CK19: call void [[CALL39:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2576 #pragma omp target map(mvlaas[:][:][:])
2577 {
2578 mvlaas[1][2][3]++;
2579 }
2580
2581 // Region 40
George Rokos63bc9d62017-11-21 18:25:12 +00002582 // 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 +00002583 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2584 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2585 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2586 //
2587 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2588 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2589 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002590 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2591 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2592 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2593 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002594 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2595 //
2596 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2597 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2598 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002599 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2600 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2601 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2602 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002603 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002604 //
2605 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2606 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2607 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002608 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2609 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2610 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2611 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002612 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002613 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2614 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2615 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 1, %{{[^,]+}}
2616
2617 // CK19: call void [[CALL40:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2618 #pragma omp target map(mvlaas[1][:ii][:])
2619 {
2620 mvlaas[1][2][3]++;
2621 }
2622
2623 // Region 41
George Rokos63bc9d62017-11-21 18:25:12 +00002624 // 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 +00002625 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2626 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2627 //
2628 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2629 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002630 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2631 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2632 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2633 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002634 //
2635 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2636 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002637 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2638 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2639 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2640 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002641 //
2642 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2643 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002644 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2645 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2646 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2647 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002648 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2649 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2650 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2651
2652 // CK19: call void [[CALL41:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2653 #pragma omp target map(mvlaas[:1][:2][:13])
2654 {
2655 mvlaas[1][2][3]++;
2656 }
2657
2658 // Region 42
George Rokos63bc9d62017-11-21 18:25:12 +00002659 // 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 +00002660 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2661 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2662
2663 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2664 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002665 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to double****
2666 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double****
2667 // CK19-DAG: store double*** [[VAR0:%.+]], double**** [[CBP0]]
2668 // CK19-DAG: store double*** [[SEC0:%.+]], double**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002669 // CK19-DAG: [[VAR0]] = load double***, double**** [[PTR:%[^,]+]],
2670 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}double*** [[SEC00:[^,]+]], i{{.+}} 0
2671 // CK19-DAG: [[SEC00]] = load double***, double**** [[PTR]],
2672
2673 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2674 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002675 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double****
2676 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double***
2677 // CK19-DAG: store double*** [[SEC0]], double**** [[CBP1]]
2678 // CK19-DAG: store double** [[SEC1:%.+]], double*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002679 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}double** [[SEC11:[^,]+]], i{{.+}} 2
2680 // CK19-DAG: [[SEC11]] = load double**, double*** [[SEC111:%[^,]+]],
2681 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}double*** [[SEC1111:[^,]+]], i{{.+}} 0
2682 // CK19-DAG: [[SEC1111]] = load double***, double**** [[PTR]],
2683
2684 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2685 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002686 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double***
2687 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
2688 // CK19-DAG: store double** [[SEC1]], double*** [[CBP2]]
2689 // CK19-DAG: store double* [[SEC2:%.+]], double** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002690 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}double* [[SEC22:[^,]+]], i{{.+}} 0
2691 // CK19-DAG: [[SEC22]] = load double*, double** [[SEC222:%[^,]+]],
2692 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}double** [[SEC2222:[^,]+]], i{{.+}} 2
2693 // CK19-DAG: [[SEC2222]] = load double**, double*** [[SEC22222:%[^,]+]],
2694 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}double*** [[SEC222222:[^,]+]], i{{.+}} 0
2695 // CK19-DAG: [[SEC222222]] = load double***, double**** [[PTR]],
2696
2697 // CK19: call void [[CALL42:@.+]](double*** {{[^,]+}})
2698 #pragma omp target map(mptras[:1][2][:13])
2699 {
2700 mptras[1][2][3]++;
2701 }
2702
2703 // Region 43 - the memory is not contiguous for this map - will map the whole last dimension.
George Rokos63bc9d62017-11-21 18:25:12 +00002704 // 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 +00002705 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2706 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2707 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2708 //
2709 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2710 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2711 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2712
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002713 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2714 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2715 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2716 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002717 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002718 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2719 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2720 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2721
2722 // CK19: call void [[CALL43:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2723 #pragma omp target map(marras[1][:ii][1:])
2724 {
2725 marras[1][2][3]++;
2726 }
2727
2728}
2729
2730// CK19: define {{.+}}[[CALL00]]
2731// CK19: define {{.+}}[[CALL01]]
2732// CK19: define {{.+}}[[CALL02]]
2733// CK19: define {{.+}}[[CALL03]]
2734// CK19: define {{.+}}[[CALL04]]
2735// CK19: define {{.+}}[[CALL05]]
2736// CK19: define {{.+}}[[CALL06]]
2737// CK19: define {{.+}}[[CALL07]]
2738// CK19: define {{.+}}[[CALL08]]
2739// CK19: define {{.+}}[[CALL09]]
2740// CK19: define {{.+}}[[CALL10]]
2741// CK19: define {{.+}}[[CALL11]]
2742// CK19: define {{.+}}[[CALL12]]
2743// CK19: define {{.+}}[[CALL13]]
2744// CK19: define {{.+}}[[CALL14]]
2745// CK19: define {{.+}}[[CALL15]]
2746// CK19: define {{.+}}[[CALL16]]
2747// CK19: define {{.+}}[[CALL17]]
2748// CK19: define {{.+}}[[CALL18]]
2749// CK19: define {{.+}}[[CALL19]]
2750// CK19: define {{.+}}[[CALL20]]
2751// CK19: define {{.+}}[[CALL21]]
2752// CK19: define {{.+}}[[CALL22]]
2753// CK19: define {{.+}}[[CALL23]]
2754// CK19: define {{.+}}[[CALL24]]
2755// CK19: define {{.+}}[[CALL25]]
2756// CK19: define {{.+}}[[CALL26]]
2757// CK19: define {{.+}}[[CALL27]]
2758// CK19: define {{.+}}[[CALL28]]
2759// CK19: define {{.+}}[[CALL29]]
2760// CK19: define {{.+}}[[CALL30]]
2761// CK19: define {{.+}}[[CALL31]]
2762// CK19: define {{.+}}[[CALL32]]
2763// CK19: define {{.+}}[[CALL33]]
2764// CK19: define {{.+}}[[CALL34]]
2765// CK19: define {{.+}}[[CALL35]]
2766// CK19: define {{.+}}[[CALL36]]
2767// CK19: define {{.+}}[[CALL37]]
2768// CK19: define {{.+}}[[CALL38]]
2769// CK19: define {{.+}}[[CALL39]]
2770// CK19: define {{.+}}[[CALL40]]
2771// CK19: define {{.+}}[[CALL41]]
2772// CK19: define {{.+}}[[CALL42]]
2773// CK19: define {{.+}}[[CALL43]]
2774
2775#endif
2776///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00002777// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64
Samuel Antao1168d63c2016-06-30 21:22:08 +00002778// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00002779// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64
2780// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32
Samuel Antao1168d63c2016-06-30 21:22:08 +00002781// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00002782// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00002783
Joel E. Denny72c27832018-07-11 20:26:20 +00002784// RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00002785// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00002786// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s
2787// RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00002788// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00002789// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY19 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00002790// SIMD-ONLY19-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00002791#ifdef CK20
2792
Alexey Bataevb3638132018-07-19 16:34:13 +00002793// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l2832.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00002794// CK20: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00002795// CK20: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002796
Alexey Bataevb3638132018-07-19 16:34:13 +00002797// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l2853.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00002798// CK20: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
George Rokos63bc9d62017-11-21 18:25:12 +00002799// CK20: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002800
Alexey Bataevb3638132018-07-19 16:34:13 +00002801// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l2871.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00002802// CK20: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00002803// CK20: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002804
Alexey Bataevb3638132018-07-19 16:34:13 +00002805// CK20-LABEL: @.__omp_offloading_{{.*}}explicit_maps_references_and_function_args{{.*}}_l2892.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00002806// CK20: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 12]
George Rokos63bc9d62017-11-21 18:25:12 +00002807// CK20: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002808
Alexey Bataevb3638132018-07-19 16:34:13 +00002809// CK20-LABEL: explicit_maps_references_and_function_args{{.*}}(
Samuel Antao86ace552016-04-27 22:40:57 +00002810void explicit_maps_references_and_function_args (int a, float b, int (&c)[10], float *d){
2811
2812 int &aa = a;
2813 float &bb = b;
2814 int (&cc)[10] = c;
2815 float *&dd = d;
2816
2817 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00002818 // 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 +00002819 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2820 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2821
2822 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2823 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002824 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2825 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2826 // CK20-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
2827 // CK20-DAG: store i32* [[RVAR00:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002828 // CK20-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2829 // CK20-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2830
2831 // CK20: call void [[CALL00:@.+]](i32* {{[^,]+}})
2832 #pragma omp target map(to:aa)
2833 {
2834 aa += 1;
2835 }
2836
2837 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00002838 // 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 +00002839 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2840 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2841
2842 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2843 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002844 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]**
2845 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2846 // CK20-DAG: store [10 x i32]* [[RVAR0:%.+]], [10 x i32]** [[CBP0]]
2847 // CK20-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002848 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[RVAR00:%.+]], i{{.+}} 0, i{{.+}} 0
2849 // CK20-DAG: [[RVAR0]] = load [10 x i32]*, [10 x i32]** [[VAR0:%[^,]+]]
2850 // CK20-DAG: [[RVAR00]] = load [10 x i32]*, [10 x i32]** [[VAR0]]
2851
2852 // CK20: call void [[CALL01:@.+]]([10 x i32]* {{[^,]+}})
2853 #pragma omp target map(to:cc[:5])
2854 {
2855 cc[3] += 1;
2856 }
2857
2858 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00002859 // 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 +00002860 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2861 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2862
2863 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2864 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002865 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
2866 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
2867 // CK20-DAG: store float* [[VAR0:%.+]], float** [[CBP0]]
2868 // CK20-DAG: store float* [[VAR0]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002869
2870 // CK20: call void [[CALL02:@.+]](float* {{[^,]+}})
2871 #pragma omp target map(from:b)
2872 {
2873 b += 1.0f;
2874 }
2875
2876 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00002877 // 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 +00002878 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2879 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2880
2881 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2882 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002883 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
2884 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
2885 // CK20-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]]
2886 // CK20-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002887 // CK20-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
2888 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
2889 // CK20-DAG: [[RVAR00]] = load float*, float** [[VAR0]]
2890
2891 // CK20: call void [[CALL03:@.+]](float* {{[^,]+}})
2892 #pragma omp target map(from:d[2:3])
2893 {
2894 d[2] += 1.0f;
2895 }
2896}
2897
2898// CK20: define {{.+}}[[CALL00]]
2899// CK20: define {{.+}}[[CALL01]]
2900// CK20: define {{.+}}[[CALL02]]
2901// CK20: define {{.+}}[[CALL03]]
2902
2903#endif
2904///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00002905// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK21 --check-prefix CK21-64
Samuel Antao1168d63c2016-06-30 21:22:08 +00002906// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00002907// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK21 --check-prefix CK21-64
2908// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK21 --check-prefix CK21-32
Samuel Antao1168d63c2016-06-30 21:22:08 +00002909// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00002910// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK21 --check-prefix CK21-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00002911
Joel E. Denny72c27832018-07-11 20:26:20 +00002912// RUN: %clang_cc1 -DCK21 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00002913// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00002914// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s
2915// RUN: %clang_cc1 -DCK21 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00002916// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00002917// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY20 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00002918// SIMD-ONLY20-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00002919#ifdef CK21
2920// CK21: [[ST:%.+]] = type { i32, i32, float* }
2921
Alexey Bataevc15ea702018-05-09 18:02:37 +00002922// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00002923// CK21: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659]
Samuel Antao86ace552016-04-27 22:40:57 +00002924
Alexey Bataevc15ea702018-05-09 18:02:37 +00002925// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00002926// CK21: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 492]
George Rokos63bc9d62017-11-21 18:25:12 +00002927// CK21: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002928
Alexey Bataevc15ea702018-05-09 18:02:37 +00002929// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00002930// CK21: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710674]
Samuel Antao86ace552016-04-27 22:40:57 +00002931
Alexey Bataevc15ea702018-05-09 18:02:37 +00002932// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00002933// CK21: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
George Rokos63bc9d62017-11-21 18:25:12 +00002934// CK21: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002935
Alexey Bataevc15ea702018-05-09 18:02:37 +00002936// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00002937// CK21: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00002938// CK21: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002939
Alexey Bataevc15ea702018-05-09 18:02:37 +00002940// CK21-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00002941// CK21: [[MTYPE05:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710659]
Samuel Antao86ace552016-04-27 22:40:57 +00002942
Alexey Bataevb3638132018-07-19 16:34:13 +00002943// CK21-LABEL: explicit_maps_template_args_and_members{{.*}}(
Samuel Antao86ace552016-04-27 22:40:57 +00002944
2945template <int X, typename T>
2946struct CC {
2947 T A;
2948 int A2;
2949 float *B;
2950
2951 int foo(T arg) {
2952 float la[X];
2953 T *lb;
2954
2955 // Region 00
Alexey Bataevb3638132018-07-19 16:34:13 +00002956 // CK21-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00002957 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2958 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00002959 // CK21-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00002960
2961 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2962 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00002963 // CK21-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002964 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2965 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2966 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
2967 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00002968 // CK21-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002969 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
2970
Alexey Bataevb3638132018-07-19 16:34:13 +00002971 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2972 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2973 // CK21-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2974 // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
2975 // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
2976 // CK21-DAG: store [[ST]]* [[VAR1:%.+]], [[ST]]** [[CBP1]]
2977 // CK21-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
2978 // CK21-DAG: store i[[Z]] {{.+}}, i[[Z]]* [[S1]]
2979 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}[[ST]]* [[VAR1:%.+]], i{{.+}} 0, i{{.+}} 0
2980
Samuel Antao86ace552016-04-27 22:40:57 +00002981 // CK21: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
2982 #pragma omp target map(A)
2983 {
2984 A += 1;
2985 }
2986
2987 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00002988 // 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 +00002989 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2990 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2991
2992 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2993 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002994 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2995 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2996 // CK21-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
2997 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002998 // CK21-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2999 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
3000 // CK21-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
3001
3002 // CK21: call void [[CALL01:@.+]](i32* {{[^,]+}})
3003 #pragma omp target map(lb[:X])
3004 {
3005 lb[4] += 1;
3006 }
3007
3008 // Region 02
Alexey Bataevb3638132018-07-19 16:34:13 +00003009 // CK21-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003010 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3011 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003012 // CK21-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00003013
3014 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3015 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003016 // CK21-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003017 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
3018 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float***
3019 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
3020 // CK21-DAG: store float** [[SEC0:%.+]], float*** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003021 // CK21-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003022 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3023
3024 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3025 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataevb3638132018-07-19 16:34:13 +00003026 // CK21-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003027 // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float***
3028 // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
3029 // CK21-DAG: store float** [[SEC0]], float*** [[CBP1]]
3030 // CK21-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003031 // CK21-DAG: store i[[Z]] {{.+}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003032 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}float* [[RVAR1:%[^,]+]], i{{.+}} 123
3033 // CK21-DAG: [[RVAR1]] = load float*, float** [[SEC1_:%[^,]+]]
3034 // CK21-DAG: [[SEC1_]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3035
3036 // CK21: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}})
3037 #pragma omp target map(from:B[X:X+2])
3038 {
3039 B[2] += 1.0f;
3040 }
3041
3042 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00003043 // 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 +00003044 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3045 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3046
3047 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3048 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003049 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [123 x float]**
3050 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [123 x float]**
3051 // CK21-DAG: store [123 x float]* [[VAR0:%.+]], [123 x float]** [[CBP0]]
3052 // CK21-DAG: store [123 x float]* [[VAR0]], [123 x float]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003053
3054 // CK21: call void [[CALL03:@.+]]([123 x float]* {{[^,]+}})
3055 #pragma omp target map(from:la)
3056 {
3057 la[3] += 1.0f;
3058 }
3059
3060 // Region 04
George Rokos63bc9d62017-11-21 18:25:12 +00003061 // 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 +00003062 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3063 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3064
3065 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3066 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003067 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
3068 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3069 // CK21-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
3070 // CK21-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003071
3072 // CK21: call void [[CALL04:@.+]](i32* {{[^,]+}})
3073 #pragma omp target map(from:arg)
3074 {
3075 arg +=1;
3076 }
3077
3078 // Make sure the extra flag is passed to the second map.
3079 // Region 05
Alexey Bataevb3638132018-07-19 16:34:13 +00003080 // CK21-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE05]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003081 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3082 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003083 // CK21-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00003084
3085 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3086 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003087 // CK21-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003088 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
3089 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3090 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
3091 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003092 // CK21-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003093 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
3094
3095 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3096 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataevb3638132018-07-19 16:34:13 +00003097 // CK21-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003098 // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
3099 // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
Alexey Bataevb3638132018-07-19 16:34:13 +00003100 // CK21-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CBP1]]
3101 // CK21-DAG: store i32* [[SEC0]], i32** [[CP1]]
3102 // CK21-DAG: store i[[Z]] {{.+}}, i[[Z]]* [[S1]]
3103
3104 // CK21-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
3105 // CK21-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
3106 // CK21-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
3107 // CK21-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[ST]]**
3108 // CK21-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
3109 // CK21-DAG: store [[ST]]* [[VAR2:%.+]], [[ST]]** [[CBP2]]
3110 // CK21-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]]
3111 // CK21-DAG: store i[[Z]] {{.+}}, i[[Z]]* [[S2]]
3112 // CK21-DAG: [[SEC2]] = getelementptr {{.*}}[[ST]]* [[VAR2]], i{{.+}} 0, i{{.+}} 1
Samuel Antao86ace552016-04-27 22:40:57 +00003113
3114 // CK21: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
3115 #pragma omp target map(A, A2)
3116 {
3117 A += 1;
3118 A2 += 1;
3119 }
3120 return A;
3121 }
3122};
3123
3124int explicit_maps_template_args_and_members(int a){
3125 CC<123,int> c;
3126 return c.foo(a);
3127}
3128
3129// CK21: define {{.+}}[[CALL00]]
3130// CK21: define {{.+}}[[CALL01]]
3131// CK21: define {{.+}}[[CALL02]]
3132// CK21: define {{.+}}[[CALL03]]
3133// CK21: define {{.+}}[[CALL04]]
3134// CK21: define {{.+}}[[CALL05]]
3135#endif
3136///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00003137// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64
Samuel Antao1168d63c2016-06-30 21:22:08 +00003138// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003139// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-64
3140// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32
Samuel Antao1168d63c2016-06-30 21:22:08 +00003141// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003142// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 --check-prefix CK22-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003143
Joel E. Denny72c27832018-07-11 20:26:20 +00003144// RUN: %clang_cc1 -DCK22 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003145// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003146// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s
3147// RUN: %clang_cc1 -DCK22 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003148// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003149// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY21 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003150// SIMD-ONLY21-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00003151#ifdef CK22
3152
3153// CK22-DAG: [[ST:%.+]] = type { float }
3154// CK22-DAG: [[STT:%.+]] = type { i32 }
3155
Alexey Bataevc15ea702018-05-09 18:02:37 +00003156// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003157// CK22: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003158// CK22: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003159
Alexey Bataevc15ea702018-05-09 18:02:37 +00003160// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003161// CK22: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00003162// CK22: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003163
Alexey Bataevc15ea702018-05-09 18:02:37 +00003164// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003165// CK22: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003166// CK22: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003167
Alexey Bataevc15ea702018-05-09 18:02:37 +00003168// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003169// CK22: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00003170// CK22: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003171
Alexey Bataevc15ea702018-05-09 18:02:37 +00003172// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003173// CK22: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
George Rokos63bc9d62017-11-21 18:25:12 +00003174// CK22: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003175
Alexey Bataevc15ea702018-05-09 18:02:37 +00003176// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003177// CK22: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003178// CK22: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003179
Alexey Bataevc15ea702018-05-09 18:02:37 +00003180// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003181// CK22: [[SIZE06:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00003182// CK22: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003183
Alexey Bataevc15ea702018-05-09 18:02:37 +00003184// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003185// CK22: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003186// CK22: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003187
Alexey Bataevc15ea702018-05-09 18:02:37 +00003188// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003189// CK22: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00003190// CK22: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003191
Alexey Bataevc15ea702018-05-09 18:02:37 +00003192// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003193// CK22: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
George Rokos63bc9d62017-11-21 18:25:12 +00003194// CK22: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003195
Alexey Bataevc15ea702018-05-09 18:02:37 +00003196// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003197// CK22: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003198// CK22: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003199
Alexey Bataevc15ea702018-05-09 18:02:37 +00003200// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003201// CK22: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00003202// CK22: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003203
Alexey Bataevc15ea702018-05-09 18:02:37 +00003204// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003205// CK22: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003206// CK22: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003207
Alexey Bataevc15ea702018-05-09 18:02:37 +00003208// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003209// CK22: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00003210// CK22: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003211
Alexey Bataevc15ea702018-05-09 18:02:37 +00003212// CK22-LABEL: @.__omp_offloading_{{.*}}explicit_maps_globals{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003213// CK22: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
George Rokos63bc9d62017-11-21 18:25:12 +00003214// CK22: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003215
3216int a;
3217int c[100];
3218int *d;
3219
3220struct ST {
3221 float fa;
3222};
3223
3224ST sa ;
3225ST sc[100];
3226ST *sd;
3227
3228template<typename T>
3229struct STT {
3230 T fa;
3231};
3232
3233STT<int> sta ;
3234STT<int> stc[100];
3235STT<int> *std;
3236
Alexey Bataevb3638132018-07-19 16:34:13 +00003237// CK22-LABEL: explicit_maps_globals{{.*}}(
Samuel Antao86ace552016-04-27 22:40:57 +00003238int explicit_maps_globals(void){
3239 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00003240 // 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 +00003241 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3242 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3243
3244 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3245 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003246 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
3247 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3248 // CK22-DAG: store i32* @a, i32** [[CBP0]]
3249 // CK22-DAG: store i32* @a, i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003250
3251 // CK22: call void [[CALL00:@.+]](i32* {{[^,]+}})
3252 #pragma omp target map(a)
3253 { a+=1; }
3254
3255 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00003256 // 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 +00003257 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3258 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3259
3260 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3261 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003262 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
3263 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]**
3264 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]]
3265 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003266
3267 // CK22: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
3268 #pragma omp target map(c)
3269 { c[3]+=1; }
3270
3271 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00003272 // 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 +00003273 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3274 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3275
3276 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3277 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003278 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
3279 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
3280 // CK22-DAG: store i32** @d, i32*** [[CBP0]]
3281 // CK22-DAG: store i32** @d, i32*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003282
3283 // CK22: call void [[CALL02:@.+]](i32** {{[^,]+}})
3284 #pragma omp target map(d)
3285 { d[3]+=1; }
3286
3287 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00003288 // 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 +00003289 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3290 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3291
3292 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3293 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003294 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
3295 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3296 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]]
3297 // 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 +00003298
3299 // CK22: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
3300 #pragma omp target map(c[1:4])
3301 { c[3]+=1; }
3302
3303 // Region 04
George Rokos63bc9d62017-11-21 18:25:12 +00003304 // 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 +00003305 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3306 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3307
3308 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3309 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003310 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
3311 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3312 // CK22-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
3313 // CK22-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003314 // CK22-DAG: [[RVAR0]] = load i32*, i32** @d
3315 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 2
3316 // CK22-DAG: [[RVAR00]] = load i32*, i32** @d
3317
3318 // CK22: call void [[CALL04:@.+]](i32* {{[^,]+}})
3319 #pragma omp target map(d[2:5])
3320 { d[3]+=1; }
3321
3322 // Region 05
George Rokos63bc9d62017-11-21 18:25:12 +00003323 // 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 +00003324 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3325 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3326
3327 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3328 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003329 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
3330 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
3331 // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CBP0]]
3332 // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003333
3334 // CK22: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
3335 #pragma omp target map(sa)
3336 { sa.fa+=1; }
3337
3338 // Region 06
George Rokos63bc9d62017-11-21 18:25:12 +00003339 // 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 +00003340 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3341 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3342
3343 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3344 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003345 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]**
3346 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[ST]]]**
3347 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]]
3348 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003349
3350 // CK22: call void [[CALL06:@.+]]([100 x [[ST]]]* {{[^,]+}})
3351 #pragma omp target map(sc)
3352 { sc[3].fa+=1; }
3353
3354 // Region 07
George Rokos63bc9d62017-11-21 18:25:12 +00003355 // 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 +00003356 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3357 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3358
3359 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3360 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003361 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]***
3362 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]***
3363 // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CBP0]]
3364 // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003365
3366 // CK22: call void [[CALL07:@.+]]([[ST]]** {{[^,]+}})
3367 #pragma omp target map(sd)
3368 { sd[3].fa+=1; }
3369
3370 // Region 08
George Rokos63bc9d62017-11-21 18:25:12 +00003371 // 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 +00003372 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3373 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3374
3375 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3376 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003377 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]**
3378 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
3379 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]]
3380 // 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 +00003381
3382 // CK22: call void [[CALL08:@.+]]([100 x [[ST]]]* {{[^,]+}})
3383 #pragma omp target map(sc[1:4])
3384 { sc[3].fa+=1; }
3385
3386 // Region 09
George Rokos63bc9d62017-11-21 18:25:12 +00003387 // 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 +00003388 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3389 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3390
3391 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3392 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003393 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
3394 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
3395 // CK22-DAG: store [[ST]]* [[RVAR0:%.+]], [[ST]]** [[CBP0]]
3396 // CK22-DAG: store [[ST]]* [[SEC0:%.+]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003397 // CK22-DAG: [[RVAR0]] = load [[ST]]*, [[ST]]** @sd
3398 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[RVAR00:%.+]], i{{.+}} 2
3399 // CK22-DAG: [[RVAR00]] = load [[ST]]*, [[ST]]** @sd
3400
3401 // CK22: call void [[CALL09:@.+]]([[ST]]* {{[^,]+}})
3402 #pragma omp target map(sd[2:5])
3403 { sd[3].fa+=1; }
3404
3405 // Region 10
George Rokos63bc9d62017-11-21 18:25:12 +00003406 // 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 +00003407 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3408 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3409
3410 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3411 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003412 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]**
3413 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
3414 // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CBP0]]
3415 // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003416
3417 // CK22: call void [[CALL10:@.+]]([[STT]]* {{[^,]+}})
3418 #pragma omp target map(sta)
3419 { sta.fa+=1; }
3420
3421 // Region 11
George Rokos63bc9d62017-11-21 18:25:12 +00003422 // 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 +00003423 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3424 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3425
3426 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3427 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003428 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]**
3429 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[STT]]]**
3430 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]]
3431 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003432
3433 // CK22: call void [[CALL11:@.+]]([100 x [[STT]]]* {{[^,]+}})
3434 #pragma omp target map(stc)
3435 { stc[3].fa+=1; }
3436
3437 // Region 12
George Rokos63bc9d62017-11-21 18:25:12 +00003438 // 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 +00003439 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3440 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3441
3442 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3443 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003444 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]***
3445 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]***
3446 // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CBP0]]
3447 // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003448
3449 // CK22: call void [[CALL12:@.+]]([[STT]]** {{[^,]+}})
3450 #pragma omp target map(std)
3451 { std[3].fa+=1; }
3452
3453 // Region 13
George Rokos63bc9d62017-11-21 18:25:12 +00003454 // 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 +00003455 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3456 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3457
3458 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3459 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003460 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]**
3461 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
3462 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]]
3463 // 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 +00003464
3465 // CK22: call void [[CALL13:@.+]]([100 x [[STT]]]* {{[^,]+}})
3466 #pragma omp target map(stc[1:4])
3467 { stc[3].fa+=1; }
3468
3469 // Region 14
George Rokos63bc9d62017-11-21 18:25:12 +00003470 // 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 +00003471 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3472 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3473
3474 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3475 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003476 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]**
3477 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
3478 // CK22-DAG: store [[STT]]* [[RVAR0:%.+]], [[STT]]** [[CBP0]]
3479 // CK22-DAG: store [[STT]]* [[SEC0:%.+]], [[STT]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003480 // CK22-DAG: [[RVAR0]] = load [[STT]]*, [[STT]]** @std
3481 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[STT]]* [[RVAR00:%.+]], i{{.+}} 2
3482 // CK22-DAG: [[RVAR00]] = load [[STT]]*, [[STT]]** @std
3483
3484 // CK22: call void [[CALL14:@.+]]([[STT]]* {{[^,]+}})
3485 #pragma omp target map(std[2:5])
3486 { std[3].fa+=1; }
3487
3488 return 0;
3489}
3490// CK22: define {{.+}}[[CALL00]]
3491// CK22: define {{.+}}[[CALL01]]
3492// CK22: define {{.+}}[[CALL02]]
3493// CK22: define {{.+}}[[CALL03]]
3494// CK22: define {{.+}}[[CALL04]]
3495// CK22: define {{.+}}[[CALL05]]
3496// CK22: define {{.+}}[[CALL06]]
3497// CK22: define {{.+}}[[CALL07]]
3498// CK22: define {{.+}}[[CALL08]]
3499// CK22: define {{.+}}[[CALL09]]
3500// CK22: define {{.+}}[[CALL10]]
3501// CK22: define {{.+}}[[CALL11]]
3502// CK22: define {{.+}}[[CALL12]]
3503// CK22: define {{.+}}[[CALL13]]
3504// CK22: define {{.+}}[[CALL14]]
3505#endif
3506///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00003507// 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 -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64
Samuel Antao1168d63c2016-06-30 21:22:08 +00003508// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003509// 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 -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-64
3510// 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 -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32
Samuel Antao1168d63c2016-06-30 21:22:08 +00003511// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003512// 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 -allow-deprecated-dag-overlap %s --check-prefix CK23 --check-prefix CK23-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003513
Joel E. Denny72c27832018-07-11 20:26:20 +00003514// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003515// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003516// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s
3517// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003518// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003519// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY22 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003520// SIMD-ONLY22-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00003521#ifdef CK23
3522
Alexey Bataevc15ea702018-05-09 18:02:37 +00003523// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003524// CK23: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003525// CK23: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003526
Alexey Bataevc15ea702018-05-09 18:02:37 +00003527// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003528// CK23: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00003529// CK23: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003530
Alexey Bataevc15ea702018-05-09 18:02:37 +00003531// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003532// CK23: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00003533// CK23: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003534
Alexey Bataevc15ea702018-05-09 18:02:37 +00003535// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003536// CK23: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00003537// CK23: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003538
Alexey Bataevc15ea702018-05-09 18:02:37 +00003539// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003540// CK23: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00003541// CK23: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003542
Alexey Bataevc15ea702018-05-09 18:02:37 +00003543// CK23-LABEL: @.__omp_offloading_{{.*}}explicit_maps_inside_captured{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00003544// CK23: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
George Rokos63bc9d62017-11-21 18:25:12 +00003545// CK23: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003546
Alexey Bataevb3638132018-07-19 16:34:13 +00003547// CK23-LABEL: explicit_maps_inside_captured{{.*}}(
Samuel Antao86ace552016-04-27 22:40:57 +00003548int explicit_maps_inside_captured(int a){
3549 float b;
3550 float c[100];
3551 float *d;
3552
3553 // CK23: call void @{{.*}}explicit_maps_inside_captured{{.*}}([[SA:%.+]]* {{.*}})
3554 // CK23: define {{.*}}explicit_maps_inside_captured{{.*}}
3555 [&](void){
3556 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00003557 // 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 +00003558 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3559 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3560
3561 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3562 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003563 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
3564 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3565 // CK23-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
3566 // CK23-DAG: store i32* [[VAR00:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003567 // CK23-DAG: [[VAR0]] = load i32*, i32** [[CAP0:%[^,]+]]
3568 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3569 // CK23-DAG: [[VAR00]] = load i32*, i32** [[CAP00:%[^,]+]]
3570 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3571
3572 // CK23: call void [[CALL00:@.+]](i32* {{[^,]+}})
3573 #pragma omp target map(a)
3574 { a+=1; }
3575 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00003576 // 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 +00003577 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3578 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3579
3580 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3581 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003582 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
3583 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3584 // CK23-DAG: store float* [[VAR0:%.+]], float** [[CBP0]]
3585 // CK23-DAG: store float* [[VAR00:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003586 // CK23-DAG: [[VAR0]] = load float*, float** [[CAP0:%[^,]+]]
3587 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3588 // CK23-DAG: [[VAR00]] = load float*, float** [[CAP00:%[^,]+]]
3589 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3590
3591 // CK23: call void [[CALL01:@.+]](float* {{[^,]+}})
3592 #pragma omp target map(b)
3593 { b+=1; }
3594 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00003595 // 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 +00003596 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3597 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3598
3599 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3600 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003601 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]**
3602 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x float]**
3603 // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]]
3604 // CK23-DAG: store [100 x float]* [[VAR00:%.+]], [100 x float]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003605 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3606 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3607 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3608 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3609
3610 // CK23: call void [[CALL02:@.+]]([100 x float]* {{[^,]+}})
3611 #pragma omp target map(c)
3612 { c[3]+=1; }
3613
3614 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00003615 // 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 +00003616 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3617 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3618
3619 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3620 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003621 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float***
3622 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float***
3623 // CK23-DAG: store float** [[VAR0:%.+]], float*** [[CBP0]]
3624 // CK23-DAG: store float** [[VAR00:%.+]], float*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003625 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3626 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3627 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3628 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3629
3630 // CK23: call void [[CALL03:@.+]](float** {{[^,]+}})
3631 #pragma omp target map(d)
3632 { d[3]+=1; }
3633 // Region 04
George Rokos63bc9d62017-11-21 18:25:12 +00003634 // 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 +00003635 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3636 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3637
3638 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3639 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003640 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]**
3641 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3642 // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]]
3643 // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003644 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}[100 x float]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3645 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3646 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3647 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3648 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3649
3650 // CK23: call void [[CALL04:@.+]]([100 x float]* {{[^,]+}})
3651 #pragma omp target map(c[2:4])
3652 { c[3]+=1; }
3653
3654 // Region 05
George Rokos63bc9d62017-11-21 18:25:12 +00003655 // 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 +00003656 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3657 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3658
3659 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3660 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003661 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
3662 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3663 // CK23-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]]
3664 // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003665 // CK23-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
3666 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
3667 // CK23-DAG: [[RVAR00]] = load float*, float** [[VAR00:%[^,]+]]
3668 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3669 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3670 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3671 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3672
3673 // CK23: call void [[CALL05:@.+]](float* {{[^,]+}})
3674 #pragma omp target map(d[2:4])
3675 { d[3]+=1; }
3676 }();
3677 return b;
3678}
3679
3680// CK23: define {{.+}}[[CALL00]]
3681// CK23: define {{.+}}[[CALL01]]
3682// CK23: define {{.+}}[[CALL02]]
3683// CK23: define {{.+}}[[CALL03]]
3684// CK23: define {{.+}}[[CALL04]]
3685// CK23: define {{.+}}[[CALL05]]
3686#endif
3687///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00003688// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64
Samuel Antao1168d63c2016-06-30 21:22:08 +00003689// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003690// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64
3691// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32
Samuel Antao1168d63c2016-06-30 21:22:08 +00003692// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003693// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003694
Joel E. Denny72c27832018-07-11 20:26:20 +00003695// RUN: %clang_cc1 -DCK24 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003696// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003697// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s
3698// RUN: %clang_cc1 -DCK24 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003699// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00003700// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY23 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003701// SIMD-ONLY23-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00003702#ifdef CK24
3703
3704// CK24-DAG: [[SC:%.+]] = type { i32, [[SB:%.+]], [[SB:%.+]]*, [10 x i32] }
3705// CK24-DAG: [[SB]] = type { i32, [[SA:%.+]], [10 x [[SA:%.+]]], [10 x [[SA:%.+]]*], [[SA:%.+]]* }
3706// CK24-DAG: [[SA]] = type { i32, [[SA]]*, [10 x i32] }
3707
3708struct SA{
3709 int a;
3710 struct SA *p;
3711 int b[10];
3712};
3713struct SB{
3714 int a;
3715 struct SA s;
3716 struct SA sa[10];
3717 struct SA *sp[10];
3718 struct SA *p;
3719};
3720struct SC{
3721 int a;
3722 struct SB s;
3723 struct SB *p;
3724 int b[10];
3725};
3726
Alexey Bataevc15ea702018-05-09 18:02:37 +00003727// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003728// CK24: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659]
Samuel Antao86ace552016-04-27 22:40:57 +00003729
Alexey Bataevc15ea702018-05-09 18:02:37 +00003730// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003731// CK24: [[MTYPE13:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659]
Samuel Antao86ace552016-04-27 22:40:57 +00003732
Alexey Bataevc15ea702018-05-09 18:02:37 +00003733// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003734// CK24: [[MTYPE14:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659]
Samuel Antao86ace552016-04-27 22:40:57 +00003735
Alexey Bataevc15ea702018-05-09 18:02:37 +00003736// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003737// CK24: [[MTYPE15:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659]
Samuel Antao86ace552016-04-27 22:40:57 +00003738
Alexey Bataevc15ea702018-05-09 18:02:37 +00003739// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003740// CK24: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659]
Samuel Antao86ace552016-04-27 22:40:57 +00003741
Alexey Bataevc15ea702018-05-09 18:02:37 +00003742// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003743// CK24: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710675]
Samuel Antao86ace552016-04-27 22:40:57 +00003744
Alexey Bataevc15ea702018-05-09 18:02:37 +00003745// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003746// CK24: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659]
Samuel Antao86ace552016-04-27 22:40:57 +00003747
Alexey Bataevc15ea702018-05-09 18:02:37 +00003748// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003749// CK24: [[MTYPE19:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710675]
Samuel Antao86ace552016-04-27 22:40:57 +00003750
Alexey Bataevc15ea702018-05-09 18:02:37 +00003751// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003752// CK24: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710675]
Samuel Antao86ace552016-04-27 22:40:57 +00003753
Alexey Bataevc15ea702018-05-09 18:02:37 +00003754// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003755// CK24: [[MTYPE21:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710675]
Samuel Antao86ace552016-04-27 22:40:57 +00003756
Alexey Bataevc15ea702018-05-09 18:02:37 +00003757// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003758// CK24: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710659]
Samuel Antao86ace552016-04-27 22:40:57 +00003759
Alexey Bataevc15ea702018-05-09 18:02:37 +00003760// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003761// CK24: [[MTYPE23:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710659, i64 281474976710675]
Samuel Antao86ace552016-04-27 22:40:57 +00003762
Alexey Bataevc15ea702018-05-09 18:02:37 +00003763// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_struct_fields{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003764// CK24: [[MTYPE24:@.+]] = private {{.*}}constant [4 x i64] [i64 32, i64 281474976710672, i64 16, i64 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003765
3766// CK24-LABEL: explicit_maps_struct_fields
3767int explicit_maps_struct_fields(int a){
3768 SC s;
3769 SC *p;
3770
3771// Region 01
Alexey Bataevb3638132018-07-19 16:34:13 +00003772// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003773// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3774// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003775// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00003776
3777// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3778// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003779// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003780// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3781// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3782// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3783// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003784// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003785// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
3786
Alexey Bataevb3638132018-07-19 16:34:13 +00003787// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3788// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3789// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
3790// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]**
3791// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3792// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]]
3793// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]]
3794// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
3795
Samuel Antao86ace552016-04-27 22:40:57 +00003796// CK24: call void [[CALL01:@.+]]([[SC]]* {{[^,]+}})
3797#pragma omp target map(s.a)
3798 { s.a++; }
Alexey Bataevb3638132018-07-19 16:34:13 +00003799
Samuel Antao86ace552016-04-27 22:40:57 +00003800//
3801// Same thing but starting from a pointer.
3802//
3803// Region 13
Alexey Bataevb3638132018-07-19 16:34:13 +00003804// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE13]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003805// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3806// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003807// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00003808
3809// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3810// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003811// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003812// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3813// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3814// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3815// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003816// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003817// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 0
3818
Alexey Bataevb3638132018-07-19 16:34:13 +00003819// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3820// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3821// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
3822// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]**
3823// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3824// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]]
3825// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]]
3826// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
3827
Samuel Antao86ace552016-04-27 22:40:57 +00003828// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3829// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3830
3831// CK24: call void [[CALL13:@.+]]([[SC]]* {{[^,]+}})
3832#pragma omp target map(p->a)
3833 { p->a++; }
Alexey Bataevb3638132018-07-19 16:34:13 +00003834
Samuel Antao86ace552016-04-27 22:40:57 +00003835// Region 14
Alexey Bataevb3638132018-07-19 16:34:13 +00003836// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE14]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003837// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3838// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003839// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00003840
3841// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3842// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003843// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003844// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3845// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]**
3846// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3847// CK24-DAG: store [[SA]]* [[SEC0:%.+]], [[SA]]** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003848// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003849// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3850// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3851
Alexey Bataevb3638132018-07-19 16:34:13 +00003852// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3853// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3854// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
3855// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]**
3856// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]**
3857// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]]
3858// CK24-DAG: store [[SA]]* [[SEC0]], [[SA]]** [[CP1]]
3859// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
3860
Samuel Antao86ace552016-04-27 22:40:57 +00003861// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3862// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3863
3864// CK24: call void [[CALL14:@.+]]([[SC]]* {{[^,]+}})
3865#pragma omp target map(p->s.s)
3866 { p->a++; }
Alexey Bataevb3638132018-07-19 16:34:13 +00003867
Samuel Antao86ace552016-04-27 22:40:57 +00003868// Region 15
Alexey Bataevb3638132018-07-19 16:34:13 +00003869// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE15]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003870// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3871// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003872// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00003873
3874// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3875// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003876// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003877// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3878// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3879// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3880// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003881// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003882// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3883// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3884// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3885
Alexey Bataevb3638132018-07-19 16:34:13 +00003886// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3887// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3888// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
3889// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]**
3890// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3891// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]]
3892// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]]
3893// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
3894
Samuel Antao86ace552016-04-27 22:40:57 +00003895// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3896// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3897
3898// CK24: call void [[CALL15:@.+]]([[SC]]* {{[^,]+}})
3899#pragma omp target map(p->s.s.a)
3900 { p->a++; }
3901
3902// Region 16
Alexey Bataevb3638132018-07-19 16:34:13 +00003903// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE16]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003904// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3905// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003906// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00003907
3908// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3909// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003910// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003911// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3912// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3913// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3914// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003915// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003916// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3917// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 3
3918
Alexey Bataevb3638132018-07-19 16:34:13 +00003919// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3920// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3921// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
3922// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]**
3923// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3924// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]]
3925// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]]
3926// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
3927
Samuel Antao86ace552016-04-27 22:40:57 +00003928// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3929// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3930
3931// CK24: call void [[CALL16:@.+]]([[SC]]* {{[^,]+}})
3932#pragma omp target map(p->b[:5])
3933 { p->a++; }
3934
3935// Region 17
Alexey Bataevb3638132018-07-19 16:34:13 +00003936// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003937// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3938// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003939// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00003940
3941// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3942// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003943// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003944// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3945// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3946// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3947// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003948// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003949// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3950
3951// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3952// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataevb3638132018-07-19 16:34:13 +00003953// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003954// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3955// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SB]]**
3956// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3957// CK24-DAG: store [[SB]]* [[SEC1:%.+]], [[SB]]** [[CP1]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003958// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003959// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3960// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3961// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3962
3963// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3964// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3965// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3966
3967// CK24: call void [[CALL17:@.+]]([[SC]]* {{[^,]+}})
3968#pragma omp target map(p->p[:5])
3969 { p->a++; }
3970
3971// Region 18
Alexey Bataevb3638132018-07-19 16:34:13 +00003972// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE18]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00003973// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3974// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003975// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00003976
3977// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3978// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00003979// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003980// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3981// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3982// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3983// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00003984// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003985// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3986// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3987// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3988// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3989
Alexey Bataevb3638132018-07-19 16:34:13 +00003990// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3991// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3992// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
3993// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]**
3994// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3995// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]]
3996// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]]
3997// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
3998
Samuel Antao86ace552016-04-27 22:40:57 +00003999// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
4000// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
4001
4002// CK24: call void [[CALL18:@.+]]([[SC]]* {{[^,]+}})
4003#pragma omp target map(p->s.sa[3].a)
4004 { p->a++; }
4005
4006// Region 19
Alexey Bataevb3638132018-07-19 16:34:13 +00004007// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE19]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004008// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4009// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004010// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00004011
4012// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4013// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004014// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004015// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
4016// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
4017// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
4018// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004019// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004020// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3
4021// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
4022// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
4023
4024// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4025// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataevb3638132018-07-19 16:34:13 +00004026// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
4027// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]**
4028// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]***
4029// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]]
4030// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CP1]]
4031// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
4032
4033// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4034// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
4035// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]***
4036// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
4037// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP2]]
4038// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00004039// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
4040// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
4041// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
4042// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
4043// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
4044
4045// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
4046// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
4047// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
4048
4049// CK24: call void [[CALL19:@.+]]([[SC]]* {{[^,]+}})
4050#pragma omp target map(p->s.sp[3]->a)
4051 { p->a++; }
4052
4053// Region 20
Alexey Bataevb3638132018-07-19 16:34:13 +00004054// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004055// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4056// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004057// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00004058
4059// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4060// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004061// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004062// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
4063// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
4064// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
4065// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004066// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004067// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
4068
4069// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4070// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004071// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
4072// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
4073// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
4074// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004075// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
4076// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
4077// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
4078
4079// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
4080// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
4081// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
4082
4083// CK24: call void [[CALL20:@.+]]([[SC]]* {{[^,]+}})
4084#pragma omp target map(p->p->a)
4085 { p->a++; }
4086
4087// Region 21
Alexey Bataevb3638132018-07-19 16:34:13 +00004088// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE21]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004089// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4090// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004091// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00004092
4093// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4094// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004095// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004096// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
4097// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
4098// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
4099// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004100// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004101// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4
4102// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
4103
4104// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4105// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataevb3638132018-07-19 16:34:13 +00004106// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
4107// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]**
4108// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]***
4109// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]]
4110// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CP1]]
4111// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
4112
4113// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4114// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
4115// CK24-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
4116// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]***
4117// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
4118// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP2]]
4119// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP2]]
4120// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00004121// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0
4122// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
4123// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4
4124// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
4125
4126// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
4127// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
4128// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
4129
4130// CK24: call void [[CALL21:@.+]]([[SC]]* {{[^,]+}})
4131#pragma omp target map(p->s.p->a)
4132 { p->a++; }
4133
4134// Region 22
Alexey Bataevb3638132018-07-19 16:34:13 +00004135// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE22]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004136// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4137// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004138// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00004139
4140// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4141// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004142// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004143// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
4144// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4145// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
4146// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004147// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004148// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
4149// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
4150// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
4151// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
4152
Alexey Bataevb3638132018-07-19 16:34:13 +00004153// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4154// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4155// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
4156// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]**
4157// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
4158// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]]
4159// CK24-DAG: store i32* [[SEC0]], i32** [[CP1]]
4160// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
4161
Samuel Antao86ace552016-04-27 22:40:57 +00004162// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
4163// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
4164
4165// CK24: call void [[CALL22:@.+]]([[SC]]* {{[^,]+}})
4166#pragma omp target map(p->s.s.b[:2])
4167 { p->a++; }
4168
4169// Region 23
Alexey Bataevb3638132018-07-19 16:34:13 +00004170// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE23]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004171// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4172// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004173// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00004174
4175// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4176// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004177// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004178// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
4179// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
4180// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
4181// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004182// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004183// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4
4184// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
4185
4186// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4187// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataevb3638132018-07-19 16:34:13 +00004188// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
4189// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SC]]**
4190// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]***
4191// CK24-DAG: store [[SC]]* [[VAR0]], [[SC]]** [[CBP1]]
4192// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CP1]]
4193// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
4194
4195// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4196// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
4197// CK24-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
4198// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]***
4199// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
4200// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP2]]
4201// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP2]]
4202// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00004203// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
4204// CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2
4205// CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]],
4206// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4
4207// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
4208
4209// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
4210// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
4211// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
4212
4213// CK24: call void [[CALL23:@.+]]([[SC]]* {{[^,]+}})
4214#pragma omp target map(p->s.p->b[:2])
4215 { p->a++; }
4216
4217// Region 24
Alexey Bataevb3638132018-07-19 16:34:13 +00004218// CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE24]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004219// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4220// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004221// CK24-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00004222
4223// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4224// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004225// CK24-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004226// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
4227// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
4228// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
4229// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004230// CK24-DAG: store i[[sz]] {{%.+}}, i[[sz]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004231// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
4232
4233// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4234// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataevb3638132018-07-19 16:34:13 +00004235// CK24-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004236// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
4237// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]***
4238// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
4239// CK24-DAG: store [[SA]]** [[SEC1:%.+]], [[SA]]*** [[CP1]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004240// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004241// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4
4242// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
4243// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
4244
4245// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4246// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataevb3638132018-07-19 16:34:13 +00004247// CK24-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004248// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]***
4249// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [[SA]]***
4250// CK24-DAG: store [[SA]]** [[SEC1]], [[SA]]*** [[CBP2]]
4251// CK24-DAG: store [[SA]]** [[SEC2:%.+]], [[SA]]*** [[CP2]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004252// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00004253// CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1
4254// CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]],
4255// CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4
4256// CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]],
4257// CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0000:%.+]], i{{.+}} 0, i{{.+}} 2
4258
4259// CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4260// CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataevb3638132018-07-19 16:34:13 +00004261// CK24-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004262// CK24-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to [[SA]]***
4263// CK24-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32**
4264// CK24-DAG: store [[SA]]** [[SEC2]], [[SA]]*** [[CBP3]]
4265// CK24-DAG: store i32* [[SEC3:%.+]], i32** [[CP3]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004266// CK24-DAG: store i[[sz]] {{.+}}, i[[sz]]* [[S3]]
Samuel Antao86ace552016-04-27 22:40:57 +00004267// CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0
4268// CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]],
4269// CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1
4270// CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]],
4271// CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4
4272// CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]],
4273// CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR00000:%.+]], i{{.+}} 0, i{{.+}} 2
4274
4275// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
4276// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
4277// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
4278// CK24-DAG: [[VAR0000]] = load [[SC]]*, [[SC]]** %{{.+}}
4279// CK24-DAG: [[VAR00000]] = load [[SC]]*, [[SC]]** %{{.+}}
4280
4281// CK24: call void [[CALL24:@.+]]([[SC]]* {{[^,]+}})
4282#pragma omp target map(p->p->p->p->a)
4283 { p->a++; }
4284
4285 return s.a;
4286}
4287
4288// CK24: define {{.+}}[[CALL01]]
Samuel Antao86ace552016-04-27 22:40:57 +00004289// CK24: define {{.+}}[[CALL13]]
4290// CK24: define {{.+}}[[CALL14]]
4291// CK24: define {{.+}}[[CALL15]]
4292// CK24: define {{.+}}[[CALL16]]
4293// CK24: define {{.+}}[[CALL17]]
4294// CK24: define {{.+}}[[CALL18]]
4295// CK24: define {{.+}}[[CALL19]]
4296// CK24: define {{.+}}[[CALL20]]
4297// CK24: define {{.+}}[[CALL21]]
4298// CK24: define {{.+}}[[CALL22]]
4299// CK24: define {{.+}}[[CALL23]]
4300// CK24: define {{.+}}[[CALL24]]
4301#endif
4302///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00004303// 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 -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64
Samuel Antao1168d63c2016-06-30 21:22:08 +00004304// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004305// 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 -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-64
4306// 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 -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32
Samuel Antao1168d63c2016-06-30 21:22:08 +00004307// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004308// 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 -allow-deprecated-dag-overlap %s --check-prefix CK25 --check-prefix CK25-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004309
Joel E. Denny72c27832018-07-11 20:26:20 +00004310// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004311// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004312// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s
4313// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004314// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004315// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY24 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004316// SIMD-ONLY24-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00004317#ifdef CK25
4318// CK25: [[ST:%.+]] = type { i32, float }
4319// CK25: [[CA00:%.+]] = type { [[ST]]* }
4320// CK25: [[CA01:%.+]] = type { i32* }
4321
Alexey Bataevc15ea702018-05-09 18:02:37 +00004322// CK25-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004323// CK25: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i64] [i64 32, i64 281474976710657]
Samuel Antao86ace552016-04-27 22:40:57 +00004324
Alexey Bataevc15ea702018-05-09 18:02:37 +00004325// CK25-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004326// CK25: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
George Rokos63bc9d62017-11-21 18:25:12 +00004327// CK25: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 33]
Samuel Antao86ace552016-04-27 22:40:57 +00004328
Alexey Bataevb3638132018-07-19 16:34:13 +00004329// CK25-LABEL: explicit_maps_with_inner_lambda{{.*}}(
Samuel Antao86ace552016-04-27 22:40:57 +00004330
4331template <int X, typename T>
4332struct CC {
4333 T A;
4334 float B;
4335
4336 int foo(T arg) {
4337 // Region 00
Alexey Bataevb3638132018-07-19 16:34:13 +00004338 // CK25-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao86ace552016-04-27 22:40:57 +00004339 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4340 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004341 // CK25-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao86ace552016-04-27 22:40:57 +00004342
4343 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4344 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004345 // CK25-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004346 // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4347 // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4348 // CK25-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4349 // CK25-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004350 // CK25-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004351 // CK25-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
4352
Alexey Bataevb3638132018-07-19 16:34:13 +00004353 // CK25-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4354 // CK25-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4355 // CK25-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
4356 // CK25-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
4357 // CK25-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
4358 // CK25-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CBP1]]
4359 // CK25-DAG: store i32* [[SEC0]], i32** [[CP1]]
4360 // CK25-DAG: store i[[Z]] {{.+}}, i[[Z]]* [[S1]]
4361
Samuel Antao86ace552016-04-27 22:40:57 +00004362 // CK25: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
4363 #pragma omp target map(to:A)
4364 {
4365 [&]() {
4366 A += 1;
4367 }();
4368 }
4369
4370 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00004371 // 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 +00004372 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4373 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4374
4375 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4376 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004377 // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4378 // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4379 // CK25-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4380 // CK25-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004381
4382 // CK25: call void [[CALL01:@.+]](i32* {{[^,]+}})
4383 #pragma omp target map(to:arg)
4384 {
4385 [&]() {
4386 arg += 1;
4387 }();
4388 }
4389
4390 return A+arg;
4391 }
4392};
4393
4394int explicit_maps_with_inner_lambda(int a){
4395 CC<123,int> c;
4396 return c.foo(a);
4397}
4398
4399// CK25: define {{.+}}[[CALL00]]([[ST]]* [[VAL:%.+]])
4400// CK25: store [[ST]]* [[VAL]], [[ST]]** [[VALADDR:%[^,]+]],
4401// CK25: [[VAL1:%.+]] = load [[ST]]*, [[ST]]** [[VALADDR]],
4402// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA00]], [[CA00]]* [[CA:%[^,]+]], i32 0, i32 0
4403// CK25: store [[ST]]* [[VAL1]], [[ST]]** [[VALADDR1]],
4404// CK25: call void {{.*}}[[LAMBDA:@.+]]{{.*}}([[CA00]]* [[CA]])
4405
4406// CK25: define {{.+}}[[LAMBDA]]
4407
4408// CK25: define {{.+}}[[CALL01]](i32* {{.*}}[[VAL:%.+]])
4409// CK25: store i32* [[VAL]], i32** [[VALADDR:%[^,]+]],
4410// CK25: [[VAL1:%.+]] = load i32*, i32** [[VALADDR]],
4411// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA01]], [[CA01]]* [[CA:%[^,]+]], i32 0, i32 0
4412// CK25: store i32* [[VAL1]], i32** [[VALADDR1]],
Alexey Bataevbef6aa62016-10-14 12:43:59 +00004413// CK25: call void {{.*}}[[LAMBDA2:@.+]]{{.*}}([[CA01]]* [[CA]])
4414
4415// CK25: define {{.+}}[[LAMBDA2]]
Samuel Antao86ace552016-04-27 22:40:57 +00004416#endif
4417///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00004418// 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 -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64
Samuel Antao1168d63c2016-06-30 21:22:08 +00004419// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004420// 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 -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-64
4421// 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 -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32
Samuel Antao1168d63c2016-06-30 21:22:08 +00004422// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004423// 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 -allow-deprecated-dag-overlap %s --check-prefix CK26 --check-prefix CK26-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004424
Joel E. Denny72c27832018-07-11 20:26:20 +00004425// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004426// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004427// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s
4428// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004429// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004430// 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 -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY25 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004431// SIMD-ONLY25-NOT: {{__kmpc|__tgt}}
Samuel Antao86ace552016-04-27 22:40:57 +00004432#ifdef CK26
4433// CK26: [[ST:%.+]] = type { i32, float*, i32, float* }
4434
Alexey Bataevc15ea702018-05-09 18:02:37 +00004435// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00004436// CK26: [[SIZE00:@.+]] = private {{.*}}constant [2 x i[[Z:64|32]]] [i[[Z:64|32]] {{32|16}}, i[[Z:64|32]] 4]
Alexey Bataevb3638132018-07-19 16:34:13 +00004437// CK26: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004438
Alexey Bataevc15ea702018-05-09 18:02:37 +00004439// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00004440// CK26: [[SIZE01:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Alexey Bataevb3638132018-07-19 16:34:13 +00004441// CK26: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004442
Alexey Bataevc15ea702018-05-09 18:02:37 +00004443// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00004444// CK26: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Alexey Bataevb3638132018-07-19 16:34:13 +00004445// CK26: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004446
Alexey Bataevc15ea702018-05-09 18:02:37 +00004447// CK26-LABEL: @.__omp_offloading_{{.*}}CC{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao86ace552016-04-27 22:40:57 +00004448// CK26: [[SIZE03:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Alexey Bataevb3638132018-07-19 16:34:13 +00004449// CK26: [[MTYPE03:@.+]] = private {{.*}}constant [2 x i64] [i64 547, i64 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004450
Alexey Bataevb3638132018-07-19 16:34:13 +00004451// CK26-LABEL: explicit_maps_with_private_class_members{{.*}}(
Samuel Antao86ace552016-04-27 22:40:57 +00004452
4453struct CC {
4454 int fA;
4455 float &fB;
4456 int pA;
4457 float &pB;
4458
4459 CC(float &B) : fB(B), pB(B) {
4460
4461 // CK26: call {{.*}}@__kmpc_fork_call{{.*}} [[OUTCALL:@.+]] to void (i32*, i32*, ...)*
4462 // define {{.*}}void [[OUTCALL]]
4463 #pragma omp parallel firstprivate(fA,fB) private(pA,pB)
4464 {
4465 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00004466 // 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 +00004467 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4468 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4469
4470 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4471 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004472 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4473 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4474 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4475 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004476
4477 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4478 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004479 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
4480 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
4481 // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
4482 // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004483 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4484 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4485
4486 // CK26: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4487 #pragma omp target map(fA)
4488 {
4489 ++fA;
4490 }
4491
4492 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00004493 // 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 +00004494 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4495 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4496
4497 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4498 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004499 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4500 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4501 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4502 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004503
4504 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4505 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004506 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float**
4507 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
4508 // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]]
4509 // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004510 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4511 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4512
4513 // CK26: call void [[CALL01:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4514 #pragma omp target map(fB)
4515 {
4516 fB += 1.0;
4517 }
4518
4519 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00004520 // 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 +00004521 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4522 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4523
4524 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4525 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004526 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4527 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4528 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4529 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004530
4531 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4532 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004533 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
4534 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
4535 // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
4536 // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004537 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4538 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4539
4540 // CK26: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4541 #pragma omp target map(pA)
4542 {
4543 ++pA;
4544 }
4545
4546 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00004547 // 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 +00004548 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4549 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4550
4551 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4552 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004553 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4554 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4555 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4556 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004557
4558 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4559 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004560 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float**
4561 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
4562 // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]]
4563 // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004564 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4565 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4566
4567 // CK26: call void [[CALL03:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4568 #pragma omp target map(pB)
4569 {
4570 pB += 1.0;
4571 }
4572 }
4573 }
4574
4575 int foo() {
4576 return fA + pA;
4577 }
4578};
4579
4580// Make sure the private instance is used in all target regions.
4581// CK26: define {{.+}}[[CALL00]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4582// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4583// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4584// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4585// CK26: add nsw i32 [[VAL]], 1
4586
4587// CK26: define {{.+}}[[CALL01]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4588// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4589// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4590// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4591// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4592// CK26: fadd double [[EXT]], 1.000000e+00
4593
4594// CK26: define {{.+}}[[CALL02]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4595// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4596// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4597// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4598// CK26: add nsw i32 [[VAL]], 1
4599
4600// CK26: define {{.+}}[[CALL03]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4601// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4602// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4603// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4604// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4605// CK26: fadd double [[EXT]], 1.000000e+00
4606
4607int explicit_maps_with_private_class_members(){
4608 float B;
4609 CC c(B);
4610 return c.foo();
4611}
4612#endif
Samuel Antao6782e942016-05-26 16:48:10 +00004613///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00004614// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64
Samuel Antao1168d63c2016-06-30 21:22:08 +00004615// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004616// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-64
4617// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32
Samuel Antao1168d63c2016-06-30 21:22:08 +00004618// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004619// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK27 --check-prefix CK27-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004620
Joel E. Denny72c27832018-07-11 20:26:20 +00004621// RUN: %clang_cc1 -DCK27 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004622// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004623// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s
4624// RUN: %clang_cc1 -DCK27 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004625// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004626// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004627// SIMD-ONLY26-NOT: {{__kmpc|__tgt}}
Samuel Antao6782e942016-05-26 16:48:10 +00004628#ifdef CK27
4629
Alexey Bataevc15ea702018-05-09 18:02:37 +00004630// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao6782e942016-05-26 16:48:10 +00004631// CK27: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] zeroinitializer
Alexey Bataevb3638132018-07-19 16:34:13 +00004632// CK27: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 544]
Samuel Antao6782e942016-05-26 16:48:10 +00004633
Alexey Bataevc15ea702018-05-09 18:02:37 +00004634// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao6782e942016-05-26 16:48:10 +00004635// CK27: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
George Rokos63bc9d62017-11-21 18:25:12 +00004636// CK27: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao6782e942016-05-26 16:48:10 +00004637
Alexey Bataevc15ea702018-05-09 18:02:37 +00004638// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao6782e942016-05-26 16:48:10 +00004639// CK27: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
George Rokos63bc9d62017-11-21 18:25:12 +00004640// CK27: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao6782e942016-05-26 16:48:10 +00004641
Alexey Bataevc15ea702018-05-09 18:02:37 +00004642// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao6782e942016-05-26 16:48:10 +00004643// CK27: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
George Rokos63bc9d62017-11-21 18:25:12 +00004644// CK27: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao6782e942016-05-26 16:48:10 +00004645
Alexey Bataevc15ea702018-05-09 18:02:37 +00004646// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
4647// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antaod486f842016-05-26 16:53:38 +00004648// CK27: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
Alexey Bataevb3638132018-07-19 16:34:13 +00004649// CK27: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i64] [i64 544]
Samuel Antaod486f842016-05-26 16:53:38 +00004650
Alexey Bataevc15ea702018-05-09 18:02:37 +00004651// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
4652// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antaod486f842016-05-26 16:53:38 +00004653// CK27: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Alexey Bataevb3638132018-07-19 16:34:13 +00004654// CK27: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i64] [i64 800]
Samuel Antaod486f842016-05-26 16:53:38 +00004655
Alexey Bataevc15ea702018-05-09 18:02:37 +00004656// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
4657// CK27-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antaod486f842016-05-26 16:53:38 +00004658// CK27: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 40]
Alexey Bataevb3638132018-07-19 16:34:13 +00004659// CK27: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 673]
Samuel Antaod486f842016-05-26 16:53:38 +00004660
Alexey Bataevb3638132018-07-19 16:34:13 +00004661// CK27-LABEL: zero_size_section_and_private_maps{{.*}}(
Samuel Antaod486f842016-05-26 16:53:38 +00004662void zero_size_section_and_private_maps (int ii){
Samuel Antao6782e942016-05-26 16:48:10 +00004663
4664 // Map of a pointer.
4665 int *pa;
4666
4667 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00004668 // 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 +00004669 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4670 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4671
4672 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4673 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004674 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4675 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4676 // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4677 // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004678
4679 // CK27: call void [[CALL00:@.+]](i32* {{[^,]+}})
4680 #pragma omp target
4681 {
4682 pa[50]++;
4683 }
4684
4685 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00004686 // 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 +00004687 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4688 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4689
4690 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4691 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004692 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4693 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4694 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4695 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004696 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4697 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4698 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4699
4700 // CK27: call void [[CALL01:@.+]](i32* {{[^,]+}})
4701 #pragma omp target map(pa[:0])
4702 {
4703 pa[50]++;
4704 }
4705
4706 // Region 02
George Rokos63bc9d62017-11-21 18:25:12 +00004707 // 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 +00004708 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4709 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4710
4711 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4712 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004713 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4714 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4715 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4716 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004717 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4718 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4719 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4720
4721 // CK27: call void [[CALL02:@.+]](i32* {{[^,]+}})
4722 #pragma omp target map(pa[0:0])
4723 {
4724 pa[50]++;
4725 }
4726
4727 // Region 03
George Rokos63bc9d62017-11-21 18:25:12 +00004728 // 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 +00004729 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4730 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4731
4732 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4733 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004734 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4735 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4736 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4737 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004738 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4739 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.+}}
4740 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4741
4742 // CK27: call void [[CALL03:@.+]](i32* {{[^,]+}})
4743 #pragma omp target map(pa[ii:0])
4744 {
4745 pa[50]++;
4746 }
Samuel Antaod486f842016-05-26 16:53:38 +00004747
4748 int *pvtPtr;
4749 int pvtScl;
4750 int pvtArr[10];
4751
4752 // Region 04
George Rokos63bc9d62017-11-21 18:25:12 +00004753 // 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 +00004754 // CK27: call void [[CALL04:@.+]]()
4755 #pragma omp target private(pvtPtr)
4756 {
4757 pvtPtr[5]++;
4758 }
4759
4760 // Region 05
George Rokos63bc9d62017-11-21 18:25:12 +00004761 // 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 +00004762 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4763 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4764
4765 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4766 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004767 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4768 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4769 // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4770 // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antaod486f842016-05-26 16:53:38 +00004771
4772 // CK27: call void [[CALL05:@.+]](i32* {{[^,]+}})
4773 #pragma omp target firstprivate(pvtPtr)
4774 {
4775 pvtPtr[5]++;
4776 }
4777
4778 // Region 06
George Rokos63bc9d62017-11-21 18:25:12 +00004779 // 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 +00004780 // CK27: call void [[CALL06:@.+]]()
4781 #pragma omp target private(pvtScl)
4782 {
4783 pvtScl++;
4784 }
4785
4786 // Region 07
George Rokos63bc9d62017-11-21 18:25:12 +00004787 // 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 +00004788 // CK27-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
4789 // CK27-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
4790 // CK27-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
4791 // CK27-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004792 // CK27-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
4793 // CK27-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
4794 // CK27-DAG: store i[[Z]] [[VAL:%.+]], i[[Z]]* [[CBP1]]
4795 // CK27-DAG: store i[[Z]] [[VAL]], i[[Z]]* [[CP1]]
Samuel Antaod486f842016-05-26 16:53:38 +00004796 // CK27-DAG: [[VAL]] = load i[[Z]], i[[Z]]* [[ADDR:%.+]],
4797 // CK27-64-DAG: [[CADDR:%.+]] = bitcast i[[Z]]* [[ADDR]] to i32*
4798 // CK27-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
4799
4800 // CK27: call void [[CALL07:@.+]](i[[Z]] [[VAL]])
4801 #pragma omp target firstprivate(pvtScl)
4802 {
4803 pvtScl++;
4804 }
4805
4806 // Region 08
George Rokos63bc9d62017-11-21 18:25:12 +00004807 // 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 +00004808 // CK27: call void [[CALL08:@.+]]()
4809 #pragma omp target private(pvtArr)
4810 {
4811 pvtArr[5]++;
4812 }
4813
4814 // Region 09
George Rokos63bc9d62017-11-21 18:25:12 +00004815 // 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 +00004816 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4817 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4818
4819 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4820 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004821 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]**
4822 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [10 x i32]**
4823 // CK27-DAG: store [10 x i32]* [[VAR0:%.+]], [10 x i32]** [[CBP0]]
4824 // CK27-DAG: store [10 x i32]* [[VAR0]], [10 x i32]** [[CP0]]
Samuel Antaod486f842016-05-26 16:53:38 +00004825
4826 // CK27: call void [[CALL09:@.+]]([10 x i32]* {{[^,]+}})
4827 #pragma omp target firstprivate(pvtArr)
4828 {
4829 pvtArr[5]++;
4830 }
Samuel Antao6782e942016-05-26 16:48:10 +00004831}
4832
4833// CK27: define {{.+}}[[CALL00]]
4834// CK27: define {{.+}}[[CALL01]]
4835// CK27: define {{.+}}[[CALL02]]
4836// CK27: define {{.+}}[[CALL03]]
Samuel Antaod486f842016-05-26 16:53:38 +00004837// CK27: define {{.+}}[[CALL04]]
4838// CK27: define {{.+}}[[CALL05]]
4839// CK27: define {{.+}}[[CALL06]]
4840// CK27: define {{.+}}[[CALL07]]
Samuel Antao6782e942016-05-26 16:48:10 +00004841#endif
Samuel Antao403ffd42016-07-27 22:49:49 +00004842///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00004843// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64
Samuel Antao403ffd42016-07-27 22:49:49 +00004844// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004845// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-64
4846// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32
Samuel Antao403ffd42016-07-27 22:49:49 +00004847// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004848// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK28 --check-prefix CK28-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004849
Joel E. Denny72c27832018-07-11 20:26:20 +00004850// RUN: %clang_cc1 -DCK28 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004851// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004852// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s
4853// RUN: %clang_cc1 -DCK28 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004854// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004855// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY27 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004856// SIMD-ONLY27-NOT: {{__kmpc|__tgt}}
Samuel Antao403ffd42016-07-27 22:49:49 +00004857#ifdef CK28
4858
Alexey Bataevc15ea702018-05-09 18:02:37 +00004859// CK28-LABEL: @.__omp_offloading_{{.*}}explicit_maps_pointer_references{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao403ffd42016-07-27 22:49:49 +00004860// CK28: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] {{8|4}}]
George Rokos63bc9d62017-11-21 18:25:12 +00004861// CK28: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao403ffd42016-07-27 22:49:49 +00004862
Alexey Bataevc15ea702018-05-09 18:02:37 +00004863// CK28-LABEL: @.__omp_offloading_{{.*}}explicit_maps_pointer_references{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Samuel Antao403ffd42016-07-27 22:49:49 +00004864// CK28: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
George Rokos63bc9d62017-11-21 18:25:12 +00004865// CK28: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 35]
Samuel Antao403ffd42016-07-27 22:49:49 +00004866
Alexey Bataevb3638132018-07-19 16:34:13 +00004867// CK28-LABEL: explicit_maps_pointer_references{{.*}}(
Samuel Antao403ffd42016-07-27 22:49:49 +00004868void explicit_maps_pointer_references (int *p){
4869 int *&a = p;
4870
4871 // Region 00
George Rokos63bc9d62017-11-21 18:25:12 +00004872 // 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 +00004873 // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4874 // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4875
4876 // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4877 // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004878 // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
4879 // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
4880 // CK28-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]]
4881 // CK28-DAG: store i32** [[VAR1:%.+]], i32*** [[CP0]]
Samuel Antao403ffd42016-07-27 22:49:49 +00004882 // CK28-DAG: [[VAR0]] = load i32**, i32*** [[VAR00:%.+]],
4883 // CK28-DAG: [[VAR1]] = load i32**, i32*** [[VAR11:%.+]],
4884
4885 // CK28: call void [[CALL00:@.+]](i32** {{[^,]+}})
4886 #pragma omp target map(a)
4887 {
4888 ++a;
4889 }
4890
4891 // Region 01
George Rokos63bc9d62017-11-21 18:25:12 +00004892 // 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 +00004893 // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4894 // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4895
4896 // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4897 // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004898 // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4899 // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4900 // CK28-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4901 // CK28-DAG: store i32* [[VAR1:%.+]], i32** [[CP0]]
Samuel Antao403ffd42016-07-27 22:49:49 +00004902 // CK28-DAG: [[VAR0]] = load i32*, i32** [[VAR00:%.+]],
4903 // CK28-DAG: [[VAR00]] = load i32**, i32*** [[VAR000:%.+]],
4904 // CK28-DAG: [[VAR1]] = getelementptr inbounds i32, i32* [[VAR11:%.+]], i{{64|32}} 2
4905 // CK28-DAG: [[VAR11]] = load i32*, i32** [[VAR111:%.+]],
4906 // CK28-DAG: [[VAR111]] = load i32**, i32*** [[VAR1111:%.+]],
4907
4908 // CK28: call void [[CALL01:@.+]](i32* {{[^,]+}})
4909 #pragma omp target map(a[2:100])
4910 {
4911 ++a;
4912 }
4913}
4914#endif
Samuel Antao03a3cec2016-07-27 22:52:16 +00004915///==========================================================================///
Joel E. Denny72c27832018-07-11 20:26:20 +00004916// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64
Samuel Antao03a3cec2016-07-27 22:52:16 +00004917// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004918// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-64
4919// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32
Samuel Antao03a3cec2016-07-27 22:52:16 +00004920// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004921// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK29 --check-prefix CK29-32
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004922
Joel E. Denny72c27832018-07-11 20:26:20 +00004923// RUN: %clang_cc1 -DCK29 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004924// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004925// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s
4926// RUN: %clang_cc1 -DCK29 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004927// 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
Joel E. Denny72c27832018-07-11 20:26:20 +00004928// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY28 %s
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00004929// SIMD-ONLY28-NOT: {{__kmpc|__tgt}}
Samuel Antao03a3cec2016-07-27 22:52:16 +00004930#ifdef CK29
4931
4932// CK29: [[SSA:%.+]] = type { double*, double** }
4933// CK29: [[SSB:%.+]] = type { [[SSA]]*, [[SSA]]** }
4934
Alexey Bataevc15ea702018-05-09 18:02:37 +00004935// CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004936// CK29: [[MTYPE00:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710672, i64 19]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004937
Alexey Bataevc15ea702018-05-09 18:02:37 +00004938// CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004939// CK29: [[MTYPE01:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710672, i64 19]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004940
Alexey Bataevc15ea702018-05-09 18:02:37 +00004941// CK29-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004942// CK29: [[MTYPE02:@.+]] = private {{.*}}constant [3 x i64] [i64 32, i64 281474976710672, i64 19]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004943
4944struct SSA{
4945 double *p;
4946 double *&pr;
4947 SSA(double *&pr) : pr(pr) {}
4948};
4949
4950struct SSB{
4951 SSA *p;
4952 SSA *&pr;
4953 SSB(SSA *&pr) : pr(pr) {}
4954
4955 // CK29-LABEL: define {{.+}}foo
4956 void foo() {
4957
4958 // Region 00
Alexey Bataevb3638132018-07-19 16:34:13 +00004959 // CK29-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z:64|32]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE00]]{{.+}})
Samuel Antao03a3cec2016-07-27 22:52:16 +00004960
4961 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4962 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004963 // CK29-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004964
4965 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4966 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00004967 // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004968 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
4969 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]**
4970 // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]]
4971 // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004972 // CK29-DAG: store i[[Z]] %{{.+}}, i[[Z]]* [[S0]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004973 // CK29-DAG: [[VAR0]] = load [[SSB]]*, [[SSB]]** %
4974 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 0
4975
4976 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4977 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataevb3638132018-07-19 16:34:13 +00004978 // CK29-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004979 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]***
Alexey Bataevb3638132018-07-19 16:34:13 +00004980 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double***
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004981 // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]]
Alexey Bataevb3638132018-07-19 16:34:13 +00004982 // CK29-DAG: store double** [[VAR1:%.+]], double*** [[CP1]]
4983 // CK29-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
4984 // CK29-DAG: [[VAR1]] = load double**, double*** [[VAR1_REF:%.+]],
4985 // CK29-DAG: [[VAR1_REF]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
Samuel Antao03a3cec2016-07-27 22:52:16 +00004986
4987 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4988 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataevb3638132018-07-19 16:34:13 +00004989 // CK29-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
4990 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double***
4991 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
4992 // CK29-DAG: store double** [[VAR1]], double*** [[CBP2]]
4993 // CK29-DAG: store double* [[VAR2:%.+]], double** [[CP2]]
4994 // CK29-DAG: store i[[Z]] 80, i[[Z]]* [[S2]]
4995 // CK29-DAG: [[VAR2]] = getelementptr inbounds double, double* [[VAR22:%.+]], i{{.+}} 0
4996 // CK29-DAG: [[VAR22]] = load double*, double** %{{.+}},
Samuel Antao03a3cec2016-07-27 22:52:16 +00004997
4998 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4999 #pragma omp target map(p->pr[:10])
5000 {
5001 p->pr++;
5002 }
5003
5004 // Region 01
Alexey Bataevb3638132018-07-19 16:34:13 +00005005 // CK29-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE01]]{{.+}})
Samuel Antao03a3cec2016-07-27 22:52:16 +00005006
5007 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
5008 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00005009 // CK29-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00005010
5011 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
5012 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00005013 // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00005014 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
Alexey Bataevb3638132018-07-19 16:34:13 +00005015 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]**
5016 // CK29-DAG: store [[SSB]]* [[VAR0]], [[SSB]]** [[CBP0]]
5017 // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]]
5018 // CK29-DAG: store i[[Z]] %{{.+}}, i[[Z]]* [[S0]]
5019 // CK29-DAG: [[VAR00]] = load [[SSA]]**, [[SSA]]*** [[VAR000:%.+]],
5020 // CK29-DAG: [[VAR000]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
Samuel Antao03a3cec2016-07-27 22:52:16 +00005021
5022 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
5023 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataevb3638132018-07-19 16:34:13 +00005024 // CK29-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
5025 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]***
5026 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double***
5027 // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]]
5028 // CK29-DAG: store double** [[VAR1:%.+]], double*** [[CP1]]
5029 // CK29-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
5030 // CK29-DAG: [[VAR1]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 0
Samuel Antao03a3cec2016-07-27 22:52:16 +00005031
5032 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
5033 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataevb3638132018-07-19 16:34:13 +00005034 // CK29-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
5035 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double***
5036 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
5037 // CK29-DAG: store double** [[VAR1]], double*** [[CBP2]]
5038 // CK29-DAG: store double* [[VAR2:%.+]], double** [[CP2]]
5039 // CK29-DAG: store i[[Z]] 80, i[[Z]]* [[S2]]
5040 // CK29-DAG: [[VAR2]] = getelementptr inbounds double, double* [[VAR22:%.+]], i{{.+}} 0
5041 // CK29-DAG: [[VAR22]] = load double*, double** %{{.+}},
Samuel Antao03a3cec2016-07-27 22:52:16 +00005042
5043 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
5044 #pragma omp target map(pr->p[:10])
5045 {
5046 pr->p++;
5047 }
5048
5049 // Region 02
Alexey Bataevb3638132018-07-19 16:34:13 +00005050 // CK29-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE02]]{{.+}})
Samuel Antao03a3cec2016-07-27 22:52:16 +00005051
5052 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
5053 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
Alexey Bataevb3638132018-07-19 16:34:13 +00005054 // CK29-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00005055
5056 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
5057 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataevb3638132018-07-19 16:34:13 +00005058 // CK29-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00005059 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
Alexey Bataevb3638132018-07-19 16:34:13 +00005060 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]**
5061 // CK29-DAG: store [[SSB]]* [[VAR0]], [[SSB]]** [[CBP0]]
5062 // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]]
5063 // CK29-DAG: store i[[Z]] %{{.+}}, i[[Z]]* [[S0]]
5064 // CK29-DAG: [[VAR00]] = load [[SSA]]**, [[SSA]]*** [[VAR000:%.+]],
5065 // CK29-DAG: [[VAR000]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
Samuel Antao03a3cec2016-07-27 22:52:16 +00005066
5067 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
5068 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataevb3638132018-07-19 16:34:13 +00005069 // CK29-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
5070 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]***
5071 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double***
5072 // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]]
5073 // CK29-DAG: store double** [[VAR1:%.+]], double*** [[CP1]]
5074 // CK29-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
5075 // CK29-DAG: [[VAR1]] = load double**, double*** [[VAR1_REF:%.+]],
5076 // CK29-DAG: [[VAR1_REF]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
Samuel Antao03a3cec2016-07-27 22:52:16 +00005077
5078 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
5079 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataevb3638132018-07-19 16:34:13 +00005080 // CK29-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
5081 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double***
5082 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
5083 // CK29-DAG: store double** [[VAR1]], double*** [[CBP2]]
5084 // CK29-DAG: store double* [[VAR2:%.+]], double** [[CP2]]
5085 // CK29-DAG: store i[[Z]] 80, i[[Z]]* [[S2]]
5086 // CK29-DAG: [[VAR2]] = getelementptr inbounds double, double* [[VAR22:%.+]], i{{.+}} 0
5087 // CK29-DAG: [[VAR22]] = load double*, double** %{{.+}},
Samuel Antao03a3cec2016-07-27 22:52:16 +00005088
5089 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
5090 #pragma omp target map(pr->pr[:10])
5091 {
5092 pr->pr++;
5093 }
5094 }
5095};
5096
5097void explicit_maps_member_pointer_references(SSA *sap) {
5098 double *d;
5099 SSA sa(d);
5100 SSB sb(sap);
5101 sb.foo();
5102}
5103#endif
Alexey Bataeve82445f2018-09-20 13:54:02 +00005104///==========================================================================///
5105// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64
5106// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
5107// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-64
5108// RUN: %clang_cc1 -DCK30 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32
5109// RUN: %clang_cc1 -DCK30 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
5110// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK30 --check-prefix CK30-32
5111
5112// RUN: %clang_cc1 -DCK30 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s
5113// RUN: %clang_cc1 -DCK30 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
5114// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s
5115// RUN: %clang_cc1 -DCK30 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s
5116// RUN: %clang_cc1 -DCK30 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
5117// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY30 %s
5118// SIMD-ONLY30-NOT: {{__kmpc|__tgt}}
5119#ifdef CK30
5120
5121// CK30-DAG: [[BASE:%.+]] = type { i32*, i32, i32* }
5122// CK30-DAG: [[STRUCT:%.+]] = type { [[BASE]], i32*, i32*, i32, i32* }
5123
5124// CK30-LABEL: @.__omp_offloading_{{.*}}map_with_deep_copy{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0
5125// The first element: 0x20 - OMP_MAP_TARGET_PARAM
5126// 2-4: 0x1000000000003 - OMP_MAP_MEMBER_OF(0) | OMP_MAP_TO | OMP_MAP_FROM - copies all the data in structs excluding deep-copied elements (from &s to &s.ptrBase1, from &s.ptr to &s.ptr1, from &s.ptr1 to end of s).
5127// 5-6: 0x1000000000013 - OMP_MAP_MEMBER_OF(0) | OMP_MAP_PTR_AND_OBJ | OMP_MAP_TO | OMP_MAP_FROM - deep copy of the pointers + pointee.
5128// CK30: [[MTYPE00:@.+]] = private {{.*}}constant [6 x i64] [i64 32, i64 281474976710659, i64 281474976710659, i64 281474976710659, i64 281474976710675, i64 281474976710675]
5129
5130typedef struct {
5131 int *ptrBase;
5132 int valBase;
5133 int *ptrBase1;
5134} Base;
5135
5136typedef struct : public Base {
5137 int *ptr;
5138 int *ptr2;
5139 int val;
5140 int *ptr1;
5141} StructWithPtr;
5142
5143// CK30-DAG: call i32 @__tgt_target(i64 -1, i8* @.__omp_offloading_{{.*}}map_with_deep_copy{{.*}}_l{{[0-9]+}}.region_id, i32 6, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i{{64|32}}* [[GEPS:%.+]], i64* getelementptr inbounds ([6 x i64], [6 x i64]* [[MTYPE00]], i32 0, i32 0))
5144// CK30-DAG: [[GEPS]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i{{64|32}}]* [[SIZES:%.+]], i32 0, i32 0
5145// CK30-DAG: [[GEPP]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS:%.+]], i32 0, i32 0
5146// CK30-DAG: [[GEPBP]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES:%.+]], i32 0, i32 0
5147
5148// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 0
5149// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]**
5150// CK30-DAG: store [[STRUCT]]* [[S:%.+]], [[STRUCT]]** [[BC]],
5151// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 0
5152// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to [[STRUCT]]**
5153// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]],
5154// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i{{64|32}}]* [[SIZES]], i32 0, i32 0
5155// CK30-64-DAG: store i64 [[S_ALLOC_SIZE:%.+]], i64* [[SIZE]],
5156// CK30-32-DAG: store i32 [[S_ALLOC_SIZE32:%.+]], i32* [[SIZE]],
5157// CK30-32-DAG: [[S_ALLOC_SIZE32]] = trunc i64 [[S_ALLOC_SIZE:%.+]] to i32
5158// CK30-DAG: [[S_ALLOC_SIZE]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
5159// CK30-DAG: [[DIFF]] = sub i64 [[S_END_BC:%.+]], [[S_BEGIN_BC:%.+]]
5160// CK30-DAG: [[S_BEGIN_BC]] = ptrtoint i8* [[S_BEGIN:%.+]] to i64
5161// CK30-DAG: [[S_END_BC]] = ptrtoint i8* [[S_END:%.+]] to i64
5162// CK30-DAG: [[S_BEGIN]] = bitcast [[STRUCT]]* [[S]] to i8*
5163// CK30-DAG: [[S_END]] = getelementptr i8, i8* [[S_LAST:%.+]], i32 1
5164// CK30-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_BC:%.+]], i{{64|32}} {{55|27}}
5165// CK30-DAG: [[S_BC]] = bitcast [[STRUCT]]* [[S]] to i8*
5166
5167// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 1
5168// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]**
5169// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]],
5170// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 1
5171// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to [[STRUCT]]**
5172// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]],
5173// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i{{64|32}}]* [[SIZES]], i32 0, i32 1
5174// CK30-64-DAG: store i64 [[SIZE1:%.+]], i64* [[SIZE]],
5175// CK30-32-DAG: store i32 [[SIZE1_32:%.+]], i32* [[SIZE]],
5176// CK30-32-DAG: [[SIZE1_32]] = trunc i64 [[SIZE1:%.+]] to i32
5177// CK30-DAG: [[SIZE1]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
5178// CK30-DAG: [[DIFF]] = sub i64 [[S_PTRBASE1_BC:%.+]], [[S_BEGIN_BC:%.+]]
5179// CK30-DAG: [[S_BEGIN_BC]] = ptrtoint i8* [[S_BEGIN:%.+]] to i64
5180// CK30-DAG: [[S_PTRBASE1_BC]] = ptrtoint i8* [[S_PTRBASE1:%.+]] to i64
5181// CK30-DAG: [[S_PTRBASE1]] = bitcast i32** [[S_PTRBASE1_REF:%.+]] to i8*
5182// CK30-DAG: [[S_BEGIN]] = bitcast [[STRUCT]]* [[S]] to i8*
5183// CK30-DAG: [[S_PTRBASE1_REF]] = getelementptr inbounds [[BASE]], [[BASE]]* [[BASE_ADDR:%.+]], i32 0, i32 2
5184// CK30-DAG: [[BASE_ADDR]] = bitcast [[STRUCT]]* [[S]] to [[BASE]]*
5185
5186// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 2
5187// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]**
5188// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]],
5189// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 2
5190// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32***
5191// CK30-DAG: store i32** [[PTR1:%.+]], i32*** [[BC]],
5192// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i{{64|32}}]* [[SIZES]], i32 0, i32 2
5193// CK30-64-DAG: store i64 [[SIZE2:%.+]], i64* [[SIZE]],
5194// CK30-32-DAG: store i32 [[SIZE2_32:%.+]], i32* [[SIZE]],
5195// CK30-32-DAG: [[SIZE2_32]] = trunc i64 [[SIZE2:%.+]] to i32
5196// CK30-DAG: [[PTR1]] = getelementptr i32*, i32** [[S_PTRBASE1_REF]], i{{64|32}} 1
5197// CK30-DAG: [[SIZE2]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
5198// CK30-DAG: [[DIFF]] = sub i64 [[S_PTR1_BC:%.+]], [[S_PTRBASE1_BC:%.+]]
5199// CK30-DAG: [[S_PTR1_BC]] = ptrtoint i8* [[S_PTR1:%.+]] to i64
5200// CK30-DAG: [[S_PTRBASE1_BC]] = ptrtoint i8* [[S_PTRBASE1:%.+]] to i64
5201// CK30-DAG: [[S_PTR1]] = bitcast i32** [[S_PTR1_REF:%.+]] to i8*
5202// CK30-DAG: [[S_PTRBASE1]] = bitcast i32** [[PTR1]] to i8*
5203// CK30-DAG: [[S_PTR1_REF]] = getelementptr inbounds [[STRUCT]], [[STRUCT]]* [[S]], i32 0, i32 4
5204
5205// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 3
5206// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to [[STRUCT]]**
5207// CK30-DAG: store [[STRUCT]]* [[S]], [[STRUCT]]** [[BC]],
5208// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 3
5209// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32***
5210// CK30-DAG: store i32** [[PTR2:%.+]], i32*** [[BC]],
5211// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i{{64|32}}]* [[SIZES]], i32 0, i32 3
5212// CK30-64-DAG: store i64 [[SIZE3:%.+]], i64* [[SIZE]],
5213// CK30-32-DAG: store i32 [[SIZE3_32:%.+]], i32* [[SIZE]],
5214// CK30-32-DAG: [[SIZE3_32]] = trunc i64 [[SIZE3:%.+]] to i32
5215// CK30-DAG: [[PTR2]] = getelementptr i32*, i32** [[S_PTR1_REF]], i{{64|32}} 1
5216// CK30-DAG: [[SIZE3]] = sdiv exact i64 [[DIFF:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
5217// CK30-DAG: [[DIFF]] = sub i64 [[S_END_BC:%.+]], [[S_PTR1_BC:%.+]]
5218// CK30-DAG: [[S_PTR1_BC]] = ptrtoint i8* [[S_PTR1:%.+]] to i64
5219// CK30-DAG: [[S_END_BC]] = ptrtoint i8* [[S_END:%.+]] to i64
5220// CK30-DAG: [[S_PTR1]] = bitcast i32** [[PTR2]] to i8*
5221// CK30-DAG: [[S_END]] = getelementptr i8, i8* [[S_LAST]], i{{64|32}} 1
5222
5223// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 4
5224// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to i32***
5225// CK30-DAG: store i32** [[S_PTR1:%.+]], i32*** [[BC]],
5226// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 4
5227// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32**
5228// CK30-DAG: store i32* [[S_PTR1_BEGIN:%.+]], i32** [[BC]],
5229// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i{{64|32}}]* [[SIZES]], i32 0, i32 4
5230// CK30-DAG: store i{{64|32}} 4, i{{64|32}}* [[SIZE]],
5231// CK30-DAG: [[S_PTR1]] = getelementptr inbounds [[STRUCT]], [[STRUCT]]* [[S]], i32 0, i32 4
5232// CK30-DAG: [[S_PTR1_BEGIN]] = getelementptr inbounds i32, i32* [[S_PTR1_BEGIN_REF:%.+]], i{{64|32}} 0
5233// CK30-DAG: [[S_PTR1_BEGIN_REF]] = load i32*, i32** [[S_PTR1:%.+]],
5234// CK30-DAG: [[S_PTR1]] = getelementptr inbounds [[STRUCT]], [[STRUCT]]* [[S]], i32 0, i32 4
5235
5236// CK30-DAG: [[BASE_PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BASES]], i32 0, i32 5
5237// CK30-DAG: [[BC:%.+]] = bitcast i8** [[BASE_PTR]] to i32***
5238// CK30-DAG: store i32** [[S_PTRBASE1:%.+]], i32*** [[BC]],
5239// CK30-DAG: [[PTR:%.+]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[PTRS]], i32 0, i32 5
5240// CK30-DAG: [[BC:%.+]] = bitcast i8** [[PTR]] to i32**
5241// CK30-DAG: store i32* [[S_PTRBASE1_BEGIN:%.+]], i32** [[BC]],
5242// CK30-DAG: [[SIZE:%.+]] = getelementptr inbounds [6 x i{{64|32}}], [6 x i{{64|32}}]* [[SIZES]], i32 0, i32 5
5243// CK30-DAG: store i{{64|32}} 4, i{{64|32}}* [[SIZE]],
5244// CK30-DAG: [[S_PTRBASE1]] = getelementptr inbounds [[BASE]], [[BASE]]* [[S_BASE:%.+]], i32 0, i32 2
5245// CK30-DAG: [[S_BASE]] = bitcast [[STRUCT]]* [[S]] to [[BASE]]*
5246// CK30-DAG: [[S_PTRBASE1_BEGIN]] = getelementptr inbounds i32, i32* [[S_PTRBASE1_BEGIN_REF:%.+]], i{{64|32}} 0
5247// CK30-DAG: [[S_PTRBASE1_BEGIN_REF]] = load i32*, i32** [[S_PTRBASE1:%.+]],
5248// CK30-DAG: [[S_PTRBASE1]] = getelementptr inbounds [[BASE]], [[BASE]]* [[S_BASE:%.+]], i32 0, i32 2
5249// CK30-DAG: [[S_BASE]] = bitcast [[STRUCT]]* [[S]] to [[BASE]]*
5250void map_with_deep_copy() {
5251 StructWithPtr s;
5252#pragma omp target map(s, s.ptr1 [0:1], s.ptrBase1 [0:1])
5253 {
5254 s.val++;
5255 s.ptr1[0]++;
5256 s.ptrBase1[0] = 10001;
5257 }
5258}
5259
5260#endif
Samuel Antao4af1b7b2015-12-02 17:44:43 +00005261#endif