10caf736dSAlexey Bataev // expected-no-diagnostics 20caf736dSAlexey Bataev #ifndef HEADER 30caf736dSAlexey Bataev #define HEADER 40caf736dSAlexey Bataev 50caf736dSAlexey Bataev ///==========================================================================/// 6*532dc62bSNikita 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 7*532dc62bSNikita 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 8*532dc62bSNikita 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 9*532dc62bSNikita 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 10*532dc62bSNikita 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 11*532dc62bSNikita 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 13*532dc62bSNikita 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 14*532dc62bSNikita 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 15*532dc62bSNikita 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 16*532dc62bSNikita 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 17*532dc62bSNikita 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 18*532dc62bSNikita 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 490caf736dSAlexey Bataev void default_mapper() { 500caf736dSAlexey Bataev S s; 510caf736dSAlexey Bataev 52ca6fa71bSAlexey 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:%.+]]) 530caf736dSAlexey Bataev // CK34-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] 540caf736dSAlexey Bataev // CK34-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] 55ca6fa71bSAlexey Bataev // CK34-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] 560caf736dSAlexey Bataev // CK34-DAG: [[GEPMF]] = bitcast [4 x i8*]* [[MF:%.+]] to i8** 570caf736dSAlexey Bataev 580caf736dSAlexey Bataev // pass TARGET_PARAM {&s, &s, ((void*)(&s+1)-(void*)&s)} 590caf736dSAlexey Bataev 600caf736dSAlexey Bataev // CK34-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 610caf736dSAlexey Bataev // CK34-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 62ca6fa71bSAlexey Bataev // CK34-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 630caf736dSAlexey Bataev // CK34-DAG: [[MF0:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 0 640caf736dSAlexey Bataev 650caf736dSAlexey Bataev // CK34-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to %class.S** 660caf736dSAlexey Bataev // CK34-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to %class.S** 670caf736dSAlexey Bataev 680caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR:%.+]], %class.S** [[BPC0]], 690caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC0]], 70ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[S_SIZE:%.+]], i64* [[S0]], 710caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF0]], 720caf736dSAlexey Bataev 730caf736dSAlexey Bataev // CK34-DAG: [[S_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 740caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_1_INTPTR:%.+]], [[S_INTPTR:%.+]] 750caf736dSAlexey Bataev // CK34-DAG: [[S_1_INTPTR]] = ptrtoint i8* [[S_1_VOID:%.+]] to i64 760caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64 770caf736dSAlexey Bataev // CK34-DAG: [[S_1_VOID]] = bitcast %class.S* [[S_1:%.+]] to i8* 780caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 790caf736dSAlexey Bataev // CK34-DAG: [[S_1]] = getelementptr %class.S, %class.S* [[S_ADDR]], i32 1 800caf736dSAlexey Bataev 810caf736dSAlexey Bataev // pass MEMBER_OF_1 | TO {&s, &s, ((void*)(&s.a+1)-(void*)&s)} to copy the data of s.a. 820caf736dSAlexey Bataev 830caf736dSAlexey Bataev // CK34-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 840caf736dSAlexey Bataev // CK34-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 85ca6fa71bSAlexey Bataev // CK34-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 860caf736dSAlexey Bataev // CK34-DAG: [[MF1:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 1 870caf736dSAlexey Bataev 880caf736dSAlexey Bataev // CK34-DAG: [[BPC1:%.+]] = bitcast i8** [[BP1]] to %class.S** 890caf736dSAlexey Bataev // CK34-DAG: [[PC1:%.+]] = bitcast i8** [[P1]] to %class.S** 900caf736dSAlexey Bataev 910caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC1]], 920caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC1]], 93ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[A_SIZE:%.+]], i64* [[S1]], 940caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF1]], 950caf736dSAlexey Bataev 960caf736dSAlexey Bataev // CK34-DAG: [[A_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 970caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[C_BEGIN_INTPTR:%.+]], [[S_INTPTR:%.+]] 980caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64 990caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_INTPTR]] = ptrtoint i8* [[C_BEGIN_VOID:%.+]] to i64 1000caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 1010caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_VOID]] = bitcast %class.C* [[C_ADDR:%.+]] to i8* 1020caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2 1030caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1 1040caf736dSAlexey Bataev 1050caf736dSAlexey 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. 1060caf736dSAlexey Bataev 1070caf736dSAlexey Bataev // CK34-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 1080caf736dSAlexey Bataev // CK34-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 109ca6fa71bSAlexey Bataev // CK34-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 1100caf736dSAlexey Bataev // CK34-DAG: [[MF2:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 2 1110caf736dSAlexey Bataev 1120caf736dSAlexey Bataev // CK34-DAG: [[BPC2:%.+]] = bitcast i8** [[BP2]] to %class.S** 1130caf736dSAlexey Bataev // CK34-DAG: [[PC2:%.+]] = bitcast i8** [[P2]] to %class.C** 1140caf736dSAlexey Bataev 1150caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC2]], 1160caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_END:%.+]], %class.C** [[PC2]], 117ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[B_SIZE:%.+]], i64* [[S2]], 1180caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF2]], 1190caf736dSAlexey Bataev 1200caf736dSAlexey Bataev // CK34-DAG: [[C_END]] = getelementptr %class.C, %class.C* [[C_ADDR]], i{{.+}} 1 1210caf736dSAlexey Bataev 1220caf736dSAlexey Bataev // CK34-DAG: [[B_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 1230caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_END_INTPTR:%.+]], [[C_END_INTPTR:%.+]] 1240caf736dSAlexey Bataev // CK34-DAG: [[C_END_INTPTR]] = ptrtoint i8* [[C_END_VOID:%.+]] to i64 1250caf736dSAlexey Bataev // CK34-DAG: [[S_END_INTPTR]] = ptrtoint i8* [[S_END_VOID:%.+]] to i64 1260caf736dSAlexey Bataev // CK34-DAG: [[C_END_VOID]] = bitcast %class.C* [[C_END]] to i8* 1270caf736dSAlexey Bataev // CK34-DAG: [[S_END_VOID]] = getelementptr i8, i8* [[S_LAST:%.+]], i{{.+}} 1 1280caf736dSAlexey Bataev // CK34-64-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i64 31 1290caf736dSAlexey Bataev // CK34-32-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i32 15 1300caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 1310caf736dSAlexey Bataev 1320caf736dSAlexey Bataev // pass MEMBER_OF_1 | TO | IMPLICIT | MAPPER {&s, &s.c, 16} to copy the data of s.c. 1330caf736dSAlexey Bataev 1340caf736dSAlexey Bataev // CK34-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 1350caf736dSAlexey Bataev // CK34-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 1360caf736dSAlexey Bataev // CK34-DAG: [[MF3:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 3 1370caf736dSAlexey Bataev 1380caf736dSAlexey Bataev // CK34-DAG: [[BPC3:%.+]] = bitcast i8** [[BP3]] to %class.S** 1390caf736dSAlexey Bataev // CK34-DAG: [[PC3:%.+]] = bitcast i8** [[P3]] to %class.C** 1400caf736dSAlexey Bataev 1410caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC3]], 1420caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_ADDR:%.+]], %class.C** [[PC3]], 1430caf736dSAlexey Bataev // CK34-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[C_DEFAULT_MAPPER:@.+]] to i8*), i8** [[MF3]], 1440caf736dSAlexey Bataev 1450caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2 1460caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1 1470caf736dSAlexey Bataev 1480caf736dSAlexey Bataev #pragma omp target map(to: s) 1490caf736dSAlexey Bataev s.foo(); 1500caf736dSAlexey Bataev 1510caf736dSAlexey Bataev // CK34 : call void 1520caf736dSAlexey Bataev 153ca6fa71bSAlexey 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:%.+]]) 1540caf736dSAlexey Bataev // CK34-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] 1550caf736dSAlexey Bataev // CK34-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] 156ca6fa71bSAlexey Bataev // CK34-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] 1570caf736dSAlexey Bataev // CK34-DAG: [[GEPMF]] = bitcast [4 x i8*]* [[MF:%.+]] to i8** 1580caf736dSAlexey Bataev 1590caf736dSAlexey Bataev // pass TARGET_PARAM {&s, &s, ((void*)(&s+1)-(void*)&s)} 1600caf736dSAlexey Bataev 1610caf736dSAlexey Bataev // CK34-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 1620caf736dSAlexey Bataev // CK34-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 163ca6fa71bSAlexey Bataev // CK34-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 1640caf736dSAlexey Bataev // CK34-DAG: [[MF0:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 0 1650caf736dSAlexey Bataev 1660caf736dSAlexey Bataev // CK34-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to %class.S** 1670caf736dSAlexey Bataev // CK34-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to %class.S** 1680caf736dSAlexey Bataev 1690caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC0]], 1700caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC0]], 171ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[S_SIZE:%.+]], i64* [[S0]], 1720caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF0]], 1730caf736dSAlexey Bataev 1740caf736dSAlexey Bataev // CK34-DAG: [[S_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 1750caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_1_INTPTR:%.+]], [[S_INTPTR:%.+]] 1760caf736dSAlexey Bataev // CK34-DAG: [[S_1_INTPTR]] = ptrtoint i8* [[S_1_VOID:%.+]] to i64 1770caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64 1780caf736dSAlexey Bataev // CK34-DAG: [[S_1_VOID]] = bitcast %class.S* [[S_1:%.+]] to i8* 1790caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 1800caf736dSAlexey Bataev // CK34-DAG: [[S_1]] = getelementptr %class.S, %class.S* [[S_ADDR]], i32 1 1810caf736dSAlexey Bataev 1820caf736dSAlexey Bataev // pass MEMBER_OF_1 | FROM {&s, &s, ((void*)(&s.a+1)-(void*)&s)} to copy the data of s.a. 1830caf736dSAlexey Bataev 1840caf736dSAlexey Bataev // CK34-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 1850caf736dSAlexey Bataev // CK34-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 186ca6fa71bSAlexey Bataev // CK34-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 1870caf736dSAlexey Bataev // CK34-DAG: [[MF1:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 1 1880caf736dSAlexey Bataev 1890caf736dSAlexey Bataev // CK34-DAG: [[BPC1:%.+]] = bitcast i8** [[BP1]] to %class.S** 1900caf736dSAlexey Bataev // CK34-DAG: [[PC1:%.+]] = bitcast i8** [[P1]] to %class.S** 1910caf736dSAlexey Bataev 1920caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC1]], 1930caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC1]], 194ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[A_SIZE:%.+]], i64* [[S1]], 1950caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF1]], 1960caf736dSAlexey Bataev 1970caf736dSAlexey Bataev // CK34-DAG: [[A_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 1980caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[C_BEGIN_INTPTR:%.+]], [[S_INTPTR:%.+]] 1990caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64 2000caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_INTPTR]] = ptrtoint i8* [[C_BEGIN_VOID:%.+]] to i64 2010caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 2020caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_VOID]] = bitcast %class.C* [[C_ADDR:%.+]] to i8* 2030caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2 2040caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1 2050caf736dSAlexey Bataev 2060caf736dSAlexey 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. 2070caf736dSAlexey Bataev 2080caf736dSAlexey Bataev // CK34-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 2090caf736dSAlexey Bataev // CK34-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 210ca6fa71bSAlexey Bataev // CK34-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 2110caf736dSAlexey Bataev // CK34-DAG: [[MF2:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 2 2120caf736dSAlexey Bataev 2130caf736dSAlexey Bataev // CK34-DAG: [[BPC2:%.+]] = bitcast i8** [[BP2]] to %class.S** 2140caf736dSAlexey Bataev // CK34-DAG: [[PC2:%.+]] = bitcast i8** [[P2]] to %class.C** 2150caf736dSAlexey Bataev 2160caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC2]], 2170caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_END:%.+]], %class.C** [[PC2]], 218ca6fa71bSAlexey Bataev // CK34-DAG: store i64 [[B_SIZE:%.+]], i64* [[S2]], 2190caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF2]], 2200caf736dSAlexey Bataev 2210caf736dSAlexey Bataev // CK34-DAG: [[C_END]] = getelementptr %class.C, %class.C* [[C_ADDR]], i{{.+}} 1 2220caf736dSAlexey Bataev 2230caf736dSAlexey Bataev // CK34-DAG: [[B_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 2240caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_END_INTPTR:%.+]], [[C_END_INTPTR:%.+]] 2250caf736dSAlexey Bataev // CK34-DAG: [[C_END_INTPTR]] = ptrtoint i8* [[C_END_VOID:%.+]] to i64 2260caf736dSAlexey Bataev // CK34-DAG: [[S_END_INTPTR]] = ptrtoint i8* [[S_END_VOID:%.+]] to i64 2270caf736dSAlexey Bataev // CK34-DAG: [[C_END_VOID]] = bitcast %class.C* [[C_END]] to i8* 2280caf736dSAlexey Bataev // CK34-DAG: [[S_END_VOID]] = getelementptr i8, i8* [[S_LAST:%.+]], i{{.+}} 1 2290caf736dSAlexey Bataev // CK34-64-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i64 31 2300caf736dSAlexey Bataev // CK34-32-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i32 15 2310caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 2320caf736dSAlexey Bataev 2330caf736dSAlexey Bataev // pass MEMBER_OF_1 | FROM | IMPLICIT | MAPPER {&s, &s.c, 16} to copy the data of s.c. 2340caf736dSAlexey Bataev 2350caf736dSAlexey Bataev // CK34-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 2360caf736dSAlexey Bataev // CK34-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 2370caf736dSAlexey Bataev // CK34-DAG: [[MF3:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 3 2380caf736dSAlexey Bataev 2390caf736dSAlexey Bataev // CK34-DAG: [[BPC3:%.+]] = bitcast i8** [[BP3]] to %class.S** 2400caf736dSAlexey Bataev // CK34-DAG: [[PC3:%.+]] = bitcast i8** [[P3]] to %class.C** 2410caf736dSAlexey Bataev 2420caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC3]], 2430caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_ADDR:%.+]], %class.C** [[PC3]], 2440caf736dSAlexey Bataev // CK34-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[C_DEFAULT_MAPPER]] to i8*), i8** [[MF3]], 2450caf736dSAlexey Bataev 2460caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2 2470caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1 2480caf736dSAlexey Bataev 2490caf736dSAlexey Bataev #pragma omp target map(from: s) 2500caf736dSAlexey Bataev s.foo(); 2510caf736dSAlexey Bataev } 2520caf736dSAlexey Bataev 2530caf736dSAlexey Bataev #endif // CK34 2540caf736dSAlexey Bataev #endif 255