10caf736dSAlexey Bataev // expected-no-diagnostics
20caf736dSAlexey Bataev #ifndef HEADER
30caf736dSAlexey Bataev #define HEADER
40caf736dSAlexey Bataev
50caf736dSAlexey Bataev ///==========================================================================///
6532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
7532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
8532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
9532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
10532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
11532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
13532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
14532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
15532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
16532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
17532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
18532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -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
38d04d9220SAlexey Bataev // CK34-DAG: [[SIZE_TO:@.+]] = private {{.*}}constant [4 x i64] [i64 0, i64 0, i64 0, i64 {{16|8}}]
390caf736dSAlexey Bataev // TARGET_PARAM = 0x20
400caf736dSAlexey Bataev // MEMBER_OF_1 | TO = 0x1000000000001
410caf736dSAlexey Bataev // MEMBER_OF_1 | IMPLICIT | TO = 0x1000000000201
420caf736dSAlexey Bataev // CK34-DAG: [[MTYPE_TO:@.+]] = {{.+}}constant [4 x i64] [i64 [[#0x20]], i64 [[#0x1000000000001]], i64 [[#0x1000000000001]], i64 [[#0x1000000000201]]]
43d04d9220SAlexey Bataev // CK34-DAG: [[SIZE_FROM:@.+]] = private {{.*}}constant [4 x i64] [i64 0, i64 0, i64 0, i64 {{16|8}}]
440caf736dSAlexey Bataev // TARGET_PARAM = 0x20
450caf736dSAlexey Bataev // MEMBER_OF_1 | FROM = 0x1000000000002
460caf736dSAlexey Bataev // MEMBER_OF_1 | IMPLICIT | FROM = 0x1000000000202
470caf736dSAlexey Bataev // CK34-DAG: [[MTYPE_FROM:@.+]] = {{.+}}constant [4 x i64] [i64 [[#0x20]], i64 [[#0x1000000000002]], i64 [[#0x1000000000002]], i64 [[#0x1000000000202]]]
480caf736dSAlexey Bataev
default_mapper()490caf736dSAlexey Bataev void default_mapper() {
500caf736dSAlexey Bataev S s;
510caf736dSAlexey Bataev
52*1fff1166SJoseph Huber // CK34-DAG: call i32 @__tgt_target_kernel(%struct.ident_t* @{{.+}}, i64 -1, i32 -1, i32 0, i8* @.{{.+}}.region_id, %struct.__tgt_kernel_arguments* [[ARGS:%.+]])
53*1fff1166SJoseph Huber // CK34-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2
54*1fff1166SJoseph Huber // CK34-DAG: store i8** [[BPGEP:%.+]], i8*** [[BPARG]]
55*1fff1166SJoseph Huber // CK34-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3
56*1fff1166SJoseph Huber // CK34-DAG: store i8** [[PGEP:%.+]], i8*** [[PARG]]
57*1fff1166SJoseph Huber // CK34-DAG: [[SARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 4
58*1fff1166SJoseph Huber // CK34-DAG: store i64* [[SIZES:%.+]], i64** [[SARG]]
59*1fff1166SJoseph Huber // CK34-DAG: [[MARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 7
60*1fff1166SJoseph Huber // CK34-DAG: store i8** [[MFGEP:%.+]], i8*** [[MARG]]
61*1fff1166SJoseph Huber // CK34-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
62*1fff1166SJoseph Huber // CK34-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
63*1fff1166SJoseph Huber // CK34-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
64*1fff1166SJoseph Huber // CK34-DAG: [[MFGEP]] = bitcast [4 x i8*]* [[MF:%.+]] to i8**
650caf736dSAlexey Bataev
660caf736dSAlexey Bataev // pass TARGET_PARAM {&s, &s, ((void*)(&s+1)-(void*)&s)}
670caf736dSAlexey Bataev
680caf736dSAlexey Bataev // CK34-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
690caf736dSAlexey Bataev // CK34-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
70ca6fa71bSAlexey Bataev // CK34-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
710caf736dSAlexey Bataev // CK34-DAG: [[MF0:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 0
720caf736dSAlexey Bataev
730caf736dSAlexey Bataev // CK34-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to %class.S**
740caf736dSAlexey Bataev // CK34-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to %class.S**
750caf736dSAlexey Bataev
760caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR:%.+]], %class.S** [[BPC0]],
770caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC0]],
78ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[S_SIZE:%.+]], i64* [[S0]],
790caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF0]],
800caf736dSAlexey Bataev
810caf736dSAlexey Bataev // CK34-DAG: [[S_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
820caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_1_INTPTR:%.+]], [[S_INTPTR:%.+]]
830caf736dSAlexey Bataev // CK34-DAG: [[S_1_INTPTR]] = ptrtoint i8* [[S_1_VOID:%.+]] to i64
840caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64
850caf736dSAlexey Bataev // CK34-DAG: [[S_1_VOID]] = bitcast %class.S* [[S_1:%.+]] to i8*
860caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
870caf736dSAlexey Bataev // CK34-DAG: [[S_1]] = getelementptr %class.S, %class.S* [[S_ADDR]], i32 1
880caf736dSAlexey Bataev
890caf736dSAlexey Bataev // pass MEMBER_OF_1 | TO {&s, &s, ((void*)(&s.a+1)-(void*)&s)} to copy the data of s.a.
900caf736dSAlexey Bataev
910caf736dSAlexey Bataev // CK34-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
920caf736dSAlexey Bataev // CK34-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
93ca6fa71bSAlexey Bataev // CK34-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
940caf736dSAlexey Bataev // CK34-DAG: [[MF1:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 1
950caf736dSAlexey Bataev
960caf736dSAlexey Bataev // CK34-DAG: [[BPC1:%.+]] = bitcast i8** [[BP1]] to %class.S**
970caf736dSAlexey Bataev // CK34-DAG: [[PC1:%.+]] = bitcast i8** [[P1]] to %class.S**
980caf736dSAlexey Bataev
990caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC1]],
1000caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC1]],
101ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[A_SIZE:%.+]], i64* [[S1]],
1020caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF1]],
1030caf736dSAlexey Bataev
1040caf736dSAlexey Bataev // CK34-DAG: [[A_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
1050caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[C_BEGIN_INTPTR:%.+]], [[S_INTPTR:%.+]]
1060caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64
1070caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_INTPTR]] = ptrtoint i8* [[C_BEGIN_VOID:%.+]] to i64
1080caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
1090caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_VOID]] = bitcast %class.C* [[C_ADDR:%.+]] to i8*
1100caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2
1110caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1
1120caf736dSAlexey Bataev
1130caf736dSAlexey 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.
1140caf736dSAlexey Bataev
1150caf736dSAlexey Bataev // CK34-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1160caf736dSAlexey Bataev // CK34-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
117ca6fa71bSAlexey Bataev // CK34-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
1180caf736dSAlexey Bataev // CK34-DAG: [[MF2:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 2
1190caf736dSAlexey Bataev
1200caf736dSAlexey Bataev // CK34-DAG: [[BPC2:%.+]] = bitcast i8** [[BP2]] to %class.S**
1210caf736dSAlexey Bataev // CK34-DAG: [[PC2:%.+]] = bitcast i8** [[P2]] to %class.C**
1220caf736dSAlexey Bataev
1230caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC2]],
1240caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_END:%.+]], %class.C** [[PC2]],
125ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[B_SIZE:%.+]], i64* [[S2]],
1260caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF2]],
1270caf736dSAlexey Bataev
1280caf736dSAlexey Bataev // CK34-DAG: [[C_END]] = getelementptr %class.C, %class.C* [[C_ADDR]], i{{.+}} 1
1290caf736dSAlexey Bataev
1300caf736dSAlexey Bataev // CK34-DAG: [[B_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
1310caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_END_INTPTR:%.+]], [[C_END_INTPTR:%.+]]
1320caf736dSAlexey Bataev // CK34-DAG: [[C_END_INTPTR]] = ptrtoint i8* [[C_END_VOID:%.+]] to i64
1330caf736dSAlexey Bataev // CK34-DAG: [[S_END_INTPTR]] = ptrtoint i8* [[S_END_VOID:%.+]] to i64
1340caf736dSAlexey Bataev // CK34-DAG: [[C_END_VOID]] = bitcast %class.C* [[C_END]] to i8*
1350caf736dSAlexey Bataev // CK34-DAG: [[S_END_VOID]] = getelementptr i8, i8* [[S_LAST:%.+]], i{{.+}} 1
1360caf736dSAlexey Bataev // CK34-64-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i64 31
1370caf736dSAlexey Bataev // CK34-32-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i32 15
1380caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
1390caf736dSAlexey Bataev
1400caf736dSAlexey Bataev // pass MEMBER_OF_1 | TO | IMPLICIT | MAPPER {&s, &s.c, 16} to copy the data of s.c.
1410caf736dSAlexey Bataev
1420caf736dSAlexey Bataev // CK34-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
1430caf736dSAlexey Bataev // CK34-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
1440caf736dSAlexey Bataev // CK34-DAG: [[MF3:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 3
1450caf736dSAlexey Bataev
1460caf736dSAlexey Bataev // CK34-DAG: [[BPC3:%.+]] = bitcast i8** [[BP3]] to %class.S**
1470caf736dSAlexey Bataev // CK34-DAG: [[PC3:%.+]] = bitcast i8** [[P3]] to %class.C**
1480caf736dSAlexey Bataev
1490caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC3]],
1500caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_ADDR:%.+]], %class.C** [[PC3]],
1510caf736dSAlexey Bataev // CK34-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[C_DEFAULT_MAPPER:@.+]] to i8*), i8** [[MF3]],
1520caf736dSAlexey Bataev
1530caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2
1540caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1
1550caf736dSAlexey Bataev
1560caf736dSAlexey Bataev #pragma omp target map(to: s)
1570caf736dSAlexey Bataev s.foo();
1580caf736dSAlexey Bataev
1590caf736dSAlexey Bataev // CK34 : call void
1600caf736dSAlexey Bataev
161*1fff1166SJoseph Huber // CK34-DAG: call i32 @__tgt_target_kernel(%struct.ident_t* @{{.+}}, i64 -1, i32 -1, i32 0, i8* @.{{.+}}.region_id, %struct.__tgt_kernel_arguments* [[ARGS:%.+]])
162*1fff1166SJoseph Huber // CK34-DAG: [[BPARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 2
163*1fff1166SJoseph Huber // CK34-DAG: store i8** [[BPGEP:%.+]], i8*** [[BPARG]]
164*1fff1166SJoseph Huber // CK34-DAG: [[PARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 3
165*1fff1166SJoseph Huber // CK34-DAG: store i8** [[PGEP:%.+]], i8*** [[PARG]]
166*1fff1166SJoseph Huber // CK34-DAG: [[SARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 4
167*1fff1166SJoseph Huber // CK34-DAG: store i64* [[SIZES:%.+]], i64** [[SARG]]
168*1fff1166SJoseph Huber // CK34-DAG: [[MARG:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 7
169*1fff1166SJoseph Huber // CK34-DAG: store i8** [[MFGEP:%.+]], i8*** [[MARG]]
170*1fff1166SJoseph Huber // CK34-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
171*1fff1166SJoseph Huber // CK34-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
172*1fff1166SJoseph Huber // CK34-DAG: [[SIZES]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
173*1fff1166SJoseph Huber // CK34-DAG: [[MFGEP]] = bitcast [4 x i8*]* [[MF:%.+]] to i8**
1740caf736dSAlexey Bataev
1750caf736dSAlexey Bataev // pass TARGET_PARAM {&s, &s, ((void*)(&s+1)-(void*)&s)}
1760caf736dSAlexey Bataev
1770caf736dSAlexey Bataev // CK34-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1780caf736dSAlexey Bataev // CK34-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
179ca6fa71bSAlexey Bataev // CK34-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1800caf736dSAlexey Bataev // CK34-DAG: [[MF0:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 0
1810caf736dSAlexey Bataev
1820caf736dSAlexey Bataev // CK34-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to %class.S**
1830caf736dSAlexey Bataev // CK34-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to %class.S**
1840caf736dSAlexey Bataev
1850caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC0]],
1860caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC0]],
187ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[S_SIZE:%.+]], i64* [[S0]],
1880caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF0]],
1890caf736dSAlexey Bataev
1900caf736dSAlexey Bataev // CK34-DAG: [[S_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
1910caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_1_INTPTR:%.+]], [[S_INTPTR:%.+]]
1920caf736dSAlexey Bataev // CK34-DAG: [[S_1_INTPTR]] = ptrtoint i8* [[S_1_VOID:%.+]] to i64
1930caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64
1940caf736dSAlexey Bataev // CK34-DAG: [[S_1_VOID]] = bitcast %class.S* [[S_1:%.+]] to i8*
1950caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
1960caf736dSAlexey Bataev // CK34-DAG: [[S_1]] = getelementptr %class.S, %class.S* [[S_ADDR]], i32 1
1970caf736dSAlexey Bataev
1980caf736dSAlexey Bataev // pass MEMBER_OF_1 | FROM {&s, &s, ((void*)(&s.a+1)-(void*)&s)} to copy the data of s.a.
1990caf736dSAlexey Bataev
2000caf736dSAlexey Bataev // CK34-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2010caf736dSAlexey Bataev // CK34-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
202ca6fa71bSAlexey Bataev // CK34-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2030caf736dSAlexey Bataev // CK34-DAG: [[MF1:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 1
2040caf736dSAlexey Bataev
2050caf736dSAlexey Bataev // CK34-DAG: [[BPC1:%.+]] = bitcast i8** [[BP1]] to %class.S**
2060caf736dSAlexey Bataev // CK34-DAG: [[PC1:%.+]] = bitcast i8** [[P1]] to %class.S**
2070caf736dSAlexey Bataev
2080caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC1]],
2090caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC1]],
210ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[A_SIZE:%.+]], i64* [[S1]],
2110caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF1]],
2120caf736dSAlexey Bataev
2130caf736dSAlexey Bataev // CK34-DAG: [[A_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
2140caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[C_BEGIN_INTPTR:%.+]], [[S_INTPTR:%.+]]
2150caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64
2160caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_INTPTR]] = ptrtoint i8* [[C_BEGIN_VOID:%.+]] to i64
2170caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
2180caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_VOID]] = bitcast %class.C* [[C_ADDR:%.+]] to i8*
2190caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2
2200caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1
2210caf736dSAlexey Bataev
2220caf736dSAlexey 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.
2230caf736dSAlexey Bataev
2240caf736dSAlexey Bataev // CK34-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2250caf736dSAlexey Bataev // CK34-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
226ca6fa71bSAlexey Bataev // CK34-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2270caf736dSAlexey Bataev // CK34-DAG: [[MF2:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 2
2280caf736dSAlexey Bataev
2290caf736dSAlexey Bataev // CK34-DAG: [[BPC2:%.+]] = bitcast i8** [[BP2]] to %class.S**
2300caf736dSAlexey Bataev // CK34-DAG: [[PC2:%.+]] = bitcast i8** [[P2]] to %class.C**
2310caf736dSAlexey Bataev
2320caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC2]],
2330caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_END:%.+]], %class.C** [[PC2]],
234ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[B_SIZE:%.+]], i64* [[S2]],
2350caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF2]],
2360caf736dSAlexey Bataev
2370caf736dSAlexey Bataev // CK34-DAG: [[C_END]] = getelementptr %class.C, %class.C* [[C_ADDR]], i{{.+}} 1
2380caf736dSAlexey Bataev
2390caf736dSAlexey Bataev // CK34-DAG: [[B_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64)
2400caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_END_INTPTR:%.+]], [[C_END_INTPTR:%.+]]
2410caf736dSAlexey Bataev // CK34-DAG: [[C_END_INTPTR]] = ptrtoint i8* [[C_END_VOID:%.+]] to i64
2420caf736dSAlexey Bataev // CK34-DAG: [[S_END_INTPTR]] = ptrtoint i8* [[S_END_VOID:%.+]] to i64
2430caf736dSAlexey Bataev // CK34-DAG: [[C_END_VOID]] = bitcast %class.C* [[C_END]] to i8*
2440caf736dSAlexey Bataev // CK34-DAG: [[S_END_VOID]] = getelementptr i8, i8* [[S_LAST:%.+]], i{{.+}} 1
2450caf736dSAlexey Bataev // CK34-64-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i64 31
2460caf736dSAlexey Bataev // CK34-32-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i32 15
2470caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8*
2480caf736dSAlexey Bataev
2490caf736dSAlexey Bataev // pass MEMBER_OF_1 | FROM | IMPLICIT | MAPPER {&s, &s.c, 16} to copy the data of s.c.
2500caf736dSAlexey Bataev
2510caf736dSAlexey Bataev // CK34-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
2520caf736dSAlexey Bataev // CK34-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
2530caf736dSAlexey Bataev // CK34-DAG: [[MF3:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 3
2540caf736dSAlexey Bataev
2550caf736dSAlexey Bataev // CK34-DAG: [[BPC3:%.+]] = bitcast i8** [[BP3]] to %class.S**
2560caf736dSAlexey Bataev // CK34-DAG: [[PC3:%.+]] = bitcast i8** [[P3]] to %class.C**
2570caf736dSAlexey Bataev
2580caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC3]],
2590caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_ADDR:%.+]], %class.C** [[PC3]],
2600caf736dSAlexey Bataev // CK34-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[C_DEFAULT_MAPPER]] to i8*), i8** [[MF3]],
2610caf736dSAlexey Bataev
2620caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2
2630caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1
2640caf736dSAlexey Bataev
2650caf736dSAlexey Bataev #pragma omp target map(from: s)
2660caf736dSAlexey Bataev s.foo();
2670caf736dSAlexey Bataev }
2680caf736dSAlexey Bataev
2690caf736dSAlexey Bataev #endif // CK34
2700caf736dSAlexey Bataev #endif
271