10caf736dSAlexey Bataev // expected-no-diagnostics
20caf736dSAlexey Bataev #ifndef HEADER
30caf736dSAlexey Bataev #define HEADER
40caf736dSAlexey Bataev 
50caf736dSAlexey Bataev ///==========================================================================///
60caf736dSAlexey Bataev // RUN: %clang_cc1 -DCK34 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK34 --check-prefix CK34-64
70caf736dSAlexey Bataev // RUN: %clang_cc1 -DCK34 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
80caf736dSAlexey Bataev // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK34 --check-prefix CK34-64
90caf736dSAlexey Bataev // RUN: %clang_cc1 -DCK34 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  --check-prefix CK34 --check-prefix CK34-32
100caf736dSAlexey Bataev // RUN: %clang_cc1 -DCK34 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
110caf736dSAlexey Bataev // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK34 --check-prefix CK34-32
120caf736dSAlexey Bataev 
130caf736dSAlexey Bataev // RUN: %clang_cc1 -DCK34 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY32 %s
140caf736dSAlexey Bataev // RUN: %clang_cc1 -DCK34 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
150caf736dSAlexey Bataev // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY32 %s
160caf736dSAlexey Bataev // RUN: %clang_cc1 -DCK34 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY32 %s
170caf736dSAlexey Bataev // RUN: %clang_cc1 -DCK34 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
180caf736dSAlexey Bataev // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY32 %s
190caf736dSAlexey Bataev // SIMD-ONLY32-NOT: {{__kmpc|__tgt}}
200caf736dSAlexey Bataev #ifdef CK34
210caf736dSAlexey Bataev 
220caf736dSAlexey Bataev class C {
230caf736dSAlexey Bataev public:
240caf736dSAlexey Bataev   int a;
250caf736dSAlexey Bataev   double *b;
260caf736dSAlexey Bataev };
270caf736dSAlexey Bataev 
280caf736dSAlexey Bataev #pragma omp declare mapper(C s) map(s.a, s.b[0:2])
290caf736dSAlexey Bataev 
300caf736dSAlexey Bataev class S {
310caf736dSAlexey Bataev   int a;
320caf736dSAlexey Bataev   C c;
330caf736dSAlexey Bataev   int b;
340caf736dSAlexey Bataev public:
350caf736dSAlexey Bataev   void foo();
360caf736dSAlexey Bataev };
370caf736dSAlexey Bataev 
380caf736dSAlexey Bataev // TARGET_PARAM = 0x20
390caf736dSAlexey Bataev // MEMBER_OF_1 | TO = 0x1000000000001
400caf736dSAlexey Bataev // MEMBER_OF_1 | IMPLICIT | TO = 0x1000000000201
410caf736dSAlexey Bataev // CK34-DAG: [[MTYPE_TO:@.+]] = {{.+}}constant [4 x i64] [i64 [[#0x20]], i64 [[#0x1000000000001]], i64 [[#0x1000000000001]], i64 [[#0x1000000000201]]]
420caf736dSAlexey Bataev // TARGET_PARAM = 0x20
430caf736dSAlexey Bataev // MEMBER_OF_1 | FROM = 0x1000000000002
440caf736dSAlexey Bataev // MEMBER_OF_1 | IMPLICIT | FROM = 0x1000000000202
450caf736dSAlexey Bataev // CK34-DAG: [[MTYPE_FROM:@.+]] = {{.+}}constant [4 x i64] [i64 [[#0x20]], i64 [[#0x1000000000002]], i64 [[#0x1000000000002]], i64 [[#0x1000000000202]]]
460caf736dSAlexey Bataev 
470caf736dSAlexey Bataev void default_mapper() {
480caf736dSAlexey Bataev   S s;
490caf736dSAlexey Bataev 
50*ca6fa71bSAlexey Bataev   // CK34-DAG: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{.+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE_TO]]{{.+}}, i8** null, i8** [[GEPMF:%.+]])
510caf736dSAlexey Bataev   // CK34-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
520caf736dSAlexey Bataev   // CK34-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
53*ca6fa71bSAlexey Bataev   // CK34-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
540caf736dSAlexey Bataev   // CK34-DAG: [[GEPMF]] = bitcast [4 x i8*]* [[MF:%.+]] to i8**
550caf736dSAlexey Bataev 
560caf736dSAlexey Bataev   // pass TARGET_PARAM {&s, &s, ((void*)(&s+1)-(void*)&s)}
570caf736dSAlexey Bataev 
580caf736dSAlexey Bataev   // CK34-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
590caf736dSAlexey Bataev   // CK34-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
60*ca6fa71bSAlexey Bataev   // CK34-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
610caf736dSAlexey Bataev   // CK34-DAG: [[MF0:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 0
620caf736dSAlexey Bataev 
630caf736dSAlexey Bataev   // CK34-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to %class.S**
640caf736dSAlexey Bataev   // CK34-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to %class.S**
650caf736dSAlexey Bataev 
660caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR:%.+]], %class.S** [[BPC0]],
670caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC0]],
68*ca6fa71bSAlexey Bataev   // CK34-DAG: store i64 [[S_SIZE:%.+]], i64* [[S0]],
690caf736dSAlexey Bataev   // CK34-DAG: store i8* null, i8** [[MF0]],
700caf736dSAlexey Bataev 
710caf736dSAlexey Bataev   // CK34-DAG: [[S_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
720caf736dSAlexey Bataev   // CK34-DAG: [[SZ]] = sub i64 [[S_1_INTPTR:%.+]], [[S_INTPTR:%.+]]
730caf736dSAlexey Bataev   // CK34-DAG: [[S_1_INTPTR]] = ptrtoint i8* [[S_1_VOID:%.+]] to i64
740caf736dSAlexey Bataev   // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64
750caf736dSAlexey Bataev   // CK34-DAG: [[S_1_VOID]] = bitcast %class.S* [[S_1:%.+]] to i8*
760caf736dSAlexey Bataev   // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
770caf736dSAlexey Bataev   // CK34-DAG: [[S_1]] = getelementptr %class.S, %class.S* [[S_ADDR]], i32 1
780caf736dSAlexey Bataev 
790caf736dSAlexey Bataev   // pass MEMBER_OF_1 | TO {&s, &s, ((void*)(&s.a+1)-(void*)&s)} to copy the data of s.a.
800caf736dSAlexey Bataev 
810caf736dSAlexey Bataev   // CK34-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
820caf736dSAlexey Bataev   // CK34-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
83*ca6fa71bSAlexey Bataev   // CK34-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
840caf736dSAlexey Bataev   // CK34-DAG: [[MF1:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 1
850caf736dSAlexey Bataev 
860caf736dSAlexey Bataev   // CK34-DAG: [[BPC1:%.+]] = bitcast i8** [[BP1]] to %class.S**
870caf736dSAlexey Bataev   // CK34-DAG: [[PC1:%.+]] = bitcast i8** [[P1]] to %class.S**
880caf736dSAlexey Bataev 
890caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC1]],
900caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC1]],
91*ca6fa71bSAlexey Bataev   // CK34-DAG: store i64 [[A_SIZE:%.+]], i64* [[S1]],
920caf736dSAlexey Bataev   // CK34-DAG: store i8* null, i8** [[MF1]],
930caf736dSAlexey Bataev 
940caf736dSAlexey Bataev   // CK34-DAG: [[A_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
950caf736dSAlexey Bataev   // CK34-DAG: [[SZ]] = sub i64 [[C_BEGIN_INTPTR:%.+]], [[S_INTPTR:%.+]]
960caf736dSAlexey Bataev   // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64
970caf736dSAlexey Bataev   // CK34-DAG: [[C_BEGIN_INTPTR]] = ptrtoint i8* [[C_BEGIN_VOID:%.+]] to i64
980caf736dSAlexey Bataev   // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
990caf736dSAlexey Bataev   // CK34-DAG: [[C_BEGIN_VOID]] = bitcast %class.C* [[C_ADDR:%.+]] to i8*
1000caf736dSAlexey Bataev   // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2
1010caf736dSAlexey Bataev   // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1
1020caf736dSAlexey Bataev 
1030caf736dSAlexey Bataev   // pass MEMBER_OF_1 | TO {&s, &s.c+1, ((void*)(&s)+31+1-(void*)(&s.c+1))} to copy the data of s.b.
1040caf736dSAlexey Bataev 
1050caf736dSAlexey Bataev   // CK34-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1060caf736dSAlexey Bataev   // CK34-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
107*ca6fa71bSAlexey Bataev   // CK34-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
1080caf736dSAlexey Bataev   // CK34-DAG: [[MF2:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 2
1090caf736dSAlexey Bataev 
1100caf736dSAlexey Bataev   // CK34-DAG: [[BPC2:%.+]] = bitcast i8** [[BP2]] to %class.S**
1110caf736dSAlexey Bataev   // CK34-DAG: [[PC2:%.+]] = bitcast i8** [[P2]] to %class.C**
1120caf736dSAlexey Bataev 
1130caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC2]],
1140caf736dSAlexey Bataev   // CK34-DAG: store %class.C* [[C_END:%.+]], %class.C** [[PC2]],
115*ca6fa71bSAlexey Bataev   // CK34-DAG: store i64 [[B_SIZE:%.+]], i64* [[S2]],
1160caf736dSAlexey Bataev   // CK34-DAG: store i8* null, i8** [[MF2]],
1170caf736dSAlexey Bataev 
1180caf736dSAlexey Bataev   // CK34-DAG: [[C_END]] = getelementptr %class.C, %class.C* [[C_ADDR]], i{{.+}} 1
1190caf736dSAlexey Bataev 
1200caf736dSAlexey Bataev   // CK34-DAG: [[B_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
1210caf736dSAlexey Bataev   // CK34-DAG: [[SZ]] = sub i64 [[S_END_INTPTR:%.+]], [[C_END_INTPTR:%.+]]
1220caf736dSAlexey Bataev   // CK34-DAG: [[C_END_INTPTR]] = ptrtoint i8* [[C_END_VOID:%.+]] to i64
1230caf736dSAlexey Bataev   // CK34-DAG: [[S_END_INTPTR]] = ptrtoint i8* [[S_END_VOID:%.+]] to i64
1240caf736dSAlexey Bataev   // CK34-DAG: [[C_END_VOID]] = bitcast %class.C* [[C_END]] to i8*
1250caf736dSAlexey Bataev   // CK34-DAG: [[S_END_VOID]] = getelementptr i8, i8* [[S_LAST:%.+]], i{{.+}} 1
1260caf736dSAlexey Bataev   // CK34-64-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i64 31
1270caf736dSAlexey Bataev   // CK34-32-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i32 15
1280caf736dSAlexey Bataev   // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
1290caf736dSAlexey Bataev 
1300caf736dSAlexey Bataev   // pass MEMBER_OF_1 | TO | IMPLICIT | MAPPER {&s, &s.c, 16} to copy the data of s.c.
1310caf736dSAlexey Bataev 
1320caf736dSAlexey Bataev   // CK34-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
1330caf736dSAlexey Bataev   // CK34-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
134*ca6fa71bSAlexey Bataev   // CK34-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3
1350caf736dSAlexey Bataev   // CK34-DAG: [[MF3:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 3
1360caf736dSAlexey Bataev 
1370caf736dSAlexey Bataev   // CK34-DAG: [[BPC3:%.+]] = bitcast i8** [[BP3]] to %class.S**
1380caf736dSAlexey Bataev   // CK34-DAG: [[PC3:%.+]] = bitcast i8** [[P3]] to %class.C**
1390caf736dSAlexey Bataev 
1400caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC3]],
1410caf736dSAlexey Bataev   // CK34-DAG: store %class.C* [[C_ADDR:%.+]], %class.C** [[PC3]],
142*ca6fa71bSAlexey Bataev   // CK34-64-DAG: store i64 16, i64* [[S3]],
143*ca6fa71bSAlexey Bataev   // CK34-32-DAG: store i64 8, i64* [[S3]],
1440caf736dSAlexey Bataev   // CK34-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[C_DEFAULT_MAPPER:@.+]] to i8*), i8** [[MF3]],
1450caf736dSAlexey Bataev 
1460caf736dSAlexey Bataev   // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2
1470caf736dSAlexey Bataev   // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1
1480caf736dSAlexey Bataev 
1490caf736dSAlexey Bataev   #pragma omp target map(to: s)
1500caf736dSAlexey Bataev   s.foo();
1510caf736dSAlexey Bataev 
1520caf736dSAlexey Bataev   // CK34 : call void
1530caf736dSAlexey Bataev 
154*ca6fa71bSAlexey Bataev   // CK34-DAG: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{.+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i64* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE_FROM]]{{.+}}, i8** null, i8** [[GEPMF:%.+]])
1550caf736dSAlexey Bataev   // CK34-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1560caf736dSAlexey Bataev   // CK34-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
157*ca6fa71bSAlexey Bataev   // CK34-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1580caf736dSAlexey Bataev   // CK34-DAG: [[GEPMF]] = bitcast [4 x i8*]* [[MF:%.+]] to i8**
1590caf736dSAlexey Bataev 
1600caf736dSAlexey Bataev   // pass TARGET_PARAM {&s, &s, ((void*)(&s+1)-(void*)&s)}
1610caf736dSAlexey Bataev 
1620caf736dSAlexey Bataev   // CK34-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1630caf736dSAlexey Bataev   // CK34-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
164*ca6fa71bSAlexey Bataev   // CK34-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1650caf736dSAlexey Bataev   // CK34-DAG: [[MF0:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 0
1660caf736dSAlexey Bataev 
1670caf736dSAlexey Bataev   // CK34-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to %class.S**
1680caf736dSAlexey Bataev   // CK34-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to %class.S**
1690caf736dSAlexey Bataev 
1700caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC0]],
1710caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC0]],
172*ca6fa71bSAlexey Bataev   // CK34-DAG: store i64 [[S_SIZE:%.+]], i64* [[S0]],
1730caf736dSAlexey Bataev   // CK34-DAG: store i8* null, i8** [[MF0]],
1740caf736dSAlexey Bataev 
1750caf736dSAlexey Bataev   // CK34-DAG: [[S_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
1760caf736dSAlexey Bataev   // CK34-DAG: [[SZ]] = sub i64 [[S_1_INTPTR:%.+]], [[S_INTPTR:%.+]]
1770caf736dSAlexey Bataev   // CK34-DAG: [[S_1_INTPTR]] = ptrtoint i8* [[S_1_VOID:%.+]] to i64
1780caf736dSAlexey Bataev   // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64
1790caf736dSAlexey Bataev   // CK34-DAG: [[S_1_VOID]] = bitcast %class.S* [[S_1:%.+]] to i8*
1800caf736dSAlexey Bataev   // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
1810caf736dSAlexey Bataev   // CK34-DAG: [[S_1]] = getelementptr %class.S, %class.S* [[S_ADDR]], i32 1
1820caf736dSAlexey Bataev 
1830caf736dSAlexey Bataev   // pass MEMBER_OF_1 | FROM {&s, &s, ((void*)(&s.a+1)-(void*)&s)} to copy the data of s.a.
1840caf736dSAlexey Bataev 
1850caf736dSAlexey Bataev   // CK34-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1860caf736dSAlexey Bataev   // CK34-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
187*ca6fa71bSAlexey Bataev   // CK34-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1880caf736dSAlexey Bataev   // CK34-DAG: [[MF1:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 1
1890caf736dSAlexey Bataev 
1900caf736dSAlexey Bataev   // CK34-DAG: [[BPC1:%.+]] = bitcast i8** [[BP1]] to %class.S**
1910caf736dSAlexey Bataev   // CK34-DAG: [[PC1:%.+]] = bitcast i8** [[P1]] to %class.S**
1920caf736dSAlexey Bataev 
1930caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC1]],
1940caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC1]],
195*ca6fa71bSAlexey Bataev   // CK34-DAG: store i64 [[A_SIZE:%.+]], i64* [[S1]],
1960caf736dSAlexey Bataev   // CK34-DAG: store i8* null, i8** [[MF1]],
1970caf736dSAlexey Bataev 
1980caf736dSAlexey Bataev   // CK34-DAG: [[A_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
1990caf736dSAlexey Bataev   // CK34-DAG: [[SZ]] = sub i64 [[C_BEGIN_INTPTR:%.+]], [[S_INTPTR:%.+]]
2000caf736dSAlexey Bataev   // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64
2010caf736dSAlexey Bataev   // CK34-DAG: [[C_BEGIN_INTPTR]] = ptrtoint i8* [[C_BEGIN_VOID:%.+]] to i64
2020caf736dSAlexey Bataev   // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
2030caf736dSAlexey Bataev   // CK34-DAG: [[C_BEGIN_VOID]] = bitcast %class.C* [[C_ADDR:%.+]] to i8*
2040caf736dSAlexey Bataev   // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2
2050caf736dSAlexey Bataev   // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1
2060caf736dSAlexey Bataev 
2070caf736dSAlexey Bataev   // pass MEMBER_OF_1 | FROM {&s, &s.c+1, ((void*)(&s)+31+1-(void*)(&s.c+1))} to copy the data of s.b.
2080caf736dSAlexey Bataev 
2090caf736dSAlexey Bataev   // CK34-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2100caf736dSAlexey Bataev   // CK34-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
211*ca6fa71bSAlexey Bataev   // CK34-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2120caf736dSAlexey Bataev   // CK34-DAG: [[MF2:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 2
2130caf736dSAlexey Bataev 
2140caf736dSAlexey Bataev   // CK34-DAG: [[BPC2:%.+]] = bitcast i8** [[BP2]] to %class.S**
2150caf736dSAlexey Bataev   // CK34-DAG: [[PC2:%.+]] = bitcast i8** [[P2]] to %class.C**
2160caf736dSAlexey Bataev 
2170caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC2]],
2180caf736dSAlexey Bataev   // CK34-DAG: store %class.C* [[C_END:%.+]], %class.C** [[PC2]],
219*ca6fa71bSAlexey Bataev   // CK34-DAG: store i64 [[B_SIZE:%.+]], i64* [[S2]],
2200caf736dSAlexey Bataev   // CK34-DAG: store i8* null, i8** [[MF2]],
2210caf736dSAlexey Bataev 
2220caf736dSAlexey Bataev   // CK34-DAG: [[C_END]] = getelementptr %class.C, %class.C* [[C_ADDR]], i{{.+}} 1
2230caf736dSAlexey Bataev 
2240caf736dSAlexey Bataev   // CK34-DAG: [[B_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
2250caf736dSAlexey Bataev   // CK34-DAG: [[SZ]] = sub i64 [[S_END_INTPTR:%.+]], [[C_END_INTPTR:%.+]]
2260caf736dSAlexey Bataev   // CK34-DAG: [[C_END_INTPTR]] = ptrtoint i8* [[C_END_VOID:%.+]] to i64
2270caf736dSAlexey Bataev   // CK34-DAG: [[S_END_INTPTR]] = ptrtoint i8* [[S_END_VOID:%.+]] to i64
2280caf736dSAlexey Bataev   // CK34-DAG: [[C_END_VOID]] = bitcast %class.C* [[C_END]] to i8*
2290caf736dSAlexey Bataev   // CK34-DAG: [[S_END_VOID]] = getelementptr i8, i8* [[S_LAST:%.+]], i{{.+}} 1
2300caf736dSAlexey Bataev   // CK34-64-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i64 31
2310caf736dSAlexey Bataev   // CK34-32-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i32 15
2320caf736dSAlexey Bataev   // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
2330caf736dSAlexey Bataev 
2340caf736dSAlexey Bataev   // pass MEMBER_OF_1 | FROM | IMPLICIT | MAPPER {&s, &s.c, 16} to copy the data of s.c.
2350caf736dSAlexey Bataev 
2360caf736dSAlexey Bataev   // CK34-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
2370caf736dSAlexey Bataev   // CK34-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
238*ca6fa71bSAlexey Bataev   // CK34-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3
2390caf736dSAlexey Bataev   // CK34-DAG: [[MF3:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 3
2400caf736dSAlexey Bataev 
2410caf736dSAlexey Bataev   // CK34-DAG: [[BPC3:%.+]] = bitcast i8** [[BP3]] to %class.S**
2420caf736dSAlexey Bataev   // CK34-DAG: [[PC3:%.+]] = bitcast i8** [[P3]] to %class.C**
2430caf736dSAlexey Bataev 
2440caf736dSAlexey Bataev   // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC3]],
2450caf736dSAlexey Bataev   // CK34-DAG: store %class.C* [[C_ADDR:%.+]], %class.C** [[PC3]],
246*ca6fa71bSAlexey Bataev   // CK34-64-DAG: store i64 16, i64* [[S3]],
247*ca6fa71bSAlexey Bataev   // CK34-32-DAG: store i64 8, i64* [[S3]],
2480caf736dSAlexey Bataev   // CK34-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[C_DEFAULT_MAPPER]] to i8*), i8** [[MF3]],
2490caf736dSAlexey Bataev 
2500caf736dSAlexey Bataev   // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2
2510caf736dSAlexey Bataev   // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1
2520caf736dSAlexey Bataev 
2530caf736dSAlexey Bataev   #pragma omp target map(from: s)
2540caf736dSAlexey Bataev   s.foo();
2550caf736dSAlexey Bataev }
2560caf736dSAlexey Bataev 
2570caf736dSAlexey Bataev #endif // CK34
2580caf736dSAlexey Bataev #endif
259