1*0caf736dSAlexey Bataev // expected-no-diagnostics 2*0caf736dSAlexey Bataev #ifndef HEADER 3*0caf736dSAlexey Bataev #define HEADER 4*0caf736dSAlexey Bataev 5*0caf736dSAlexey Bataev ///==========================================================================/// 6*0caf736dSAlexey 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 7*0caf736dSAlexey 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 8*0caf736dSAlexey 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 9*0caf736dSAlexey 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 10*0caf736dSAlexey 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 11*0caf736dSAlexey 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 12*0caf736dSAlexey Bataev 13*0caf736dSAlexey 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 14*0caf736dSAlexey 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 15*0caf736dSAlexey 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 16*0caf736dSAlexey 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 17*0caf736dSAlexey 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 18*0caf736dSAlexey 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 19*0caf736dSAlexey Bataev // SIMD-ONLY32-NOT: {{__kmpc|__tgt}} 20*0caf736dSAlexey Bataev #ifdef CK34 21*0caf736dSAlexey Bataev 22*0caf736dSAlexey Bataev class C { 23*0caf736dSAlexey Bataev public: 24*0caf736dSAlexey Bataev int a; 25*0caf736dSAlexey Bataev double *b; 26*0caf736dSAlexey Bataev }; 27*0caf736dSAlexey Bataev 28*0caf736dSAlexey Bataev #pragma omp declare mapper(C s) map(s.a, s.b[0:2]) 29*0caf736dSAlexey Bataev 30*0caf736dSAlexey Bataev class S { 31*0caf736dSAlexey Bataev int a; 32*0caf736dSAlexey Bataev C c; 33*0caf736dSAlexey Bataev int b; 34*0caf736dSAlexey Bataev public: 35*0caf736dSAlexey Bataev void foo(); 36*0caf736dSAlexey Bataev }; 37*0caf736dSAlexey Bataev 38*0caf736dSAlexey Bataev // TARGET_PARAM = 0x20 39*0caf736dSAlexey Bataev // MEMBER_OF_1 | TO = 0x1000000000001 40*0caf736dSAlexey Bataev // MEMBER_OF_1 | IMPLICIT | TO = 0x1000000000201 41*0caf736dSAlexey Bataev // CK34-DAG: [[MTYPE_TO:@.+]] = {{.+}}constant [4 x i64] [i64 [[#0x20]], i64 [[#0x1000000000001]], i64 [[#0x1000000000001]], i64 [[#0x1000000000201]]] 42*0caf736dSAlexey Bataev // TARGET_PARAM = 0x20 43*0caf736dSAlexey Bataev // MEMBER_OF_1 | FROM = 0x1000000000002 44*0caf736dSAlexey Bataev // MEMBER_OF_1 | IMPLICIT | FROM = 0x1000000000202 45*0caf736dSAlexey Bataev // CK34-DAG: [[MTYPE_FROM:@.+]] = {{.+}}constant [4 x i64] [i64 [[#0x20]], i64 [[#0x1000000000002]], i64 [[#0x1000000000002]], i64 [[#0x1000000000202]]] 46*0caf736dSAlexey Bataev 47*0caf736dSAlexey Bataev void default_mapper() { 48*0caf736dSAlexey Bataev S s; 49*0caf736dSAlexey Bataev 50*0caf736dSAlexey 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:%.+]]) 51*0caf736dSAlexey Bataev // CK34-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] 52*0caf736dSAlexey Bataev // CK34-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] 53*0caf736dSAlexey Bataev // CK34-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] 54*0caf736dSAlexey Bataev // CK34-DAG: [[GEPMF]] = bitcast [4 x i8*]* [[MF:%.+]] to i8** 55*0caf736dSAlexey Bataev 56*0caf736dSAlexey Bataev // pass TARGET_PARAM {&s, &s, ((void*)(&s+1)-(void*)&s)} 57*0caf736dSAlexey Bataev 58*0caf736dSAlexey Bataev // CK34-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 59*0caf736dSAlexey Bataev // CK34-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 60*0caf736dSAlexey Bataev // CK34-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 61*0caf736dSAlexey Bataev // CK34-DAG: [[MF0:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 0 62*0caf736dSAlexey Bataev 63*0caf736dSAlexey Bataev // CK34-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to %class.S** 64*0caf736dSAlexey Bataev // CK34-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to %class.S** 65*0caf736dSAlexey Bataev 66*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR:%.+]], %class.S** [[BPC0]], 67*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC0]], 68*0caf736dSAlexey Bataev // CK34-DAG: store i64 [[S_SIZE:%.+]], i64* [[S0]], 69*0caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF0]], 70*0caf736dSAlexey Bataev 71*0caf736dSAlexey Bataev // CK34-DAG: [[S_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 72*0caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_1_INTPTR:%.+]], [[S_INTPTR:%.+]] 73*0caf736dSAlexey Bataev // CK34-DAG: [[S_1_INTPTR]] = ptrtoint i8* [[S_1_VOID:%.+]] to i64 74*0caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64 75*0caf736dSAlexey Bataev // CK34-DAG: [[S_1_VOID]] = bitcast %class.S* [[S_1:%.+]] to i8* 76*0caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 77*0caf736dSAlexey Bataev // CK34-DAG: [[S_1]] = getelementptr %class.S, %class.S* [[S_ADDR]], i32 1 78*0caf736dSAlexey Bataev 79*0caf736dSAlexey Bataev // pass MEMBER_OF_1 | TO {&s, &s, ((void*)(&s.a+1)-(void*)&s)} to copy the data of s.a. 80*0caf736dSAlexey Bataev 81*0caf736dSAlexey Bataev // CK34-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 82*0caf736dSAlexey Bataev // CK34-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 83*0caf736dSAlexey Bataev // CK34-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 84*0caf736dSAlexey Bataev // CK34-DAG: [[MF1:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 1 85*0caf736dSAlexey Bataev 86*0caf736dSAlexey Bataev // CK34-DAG: [[BPC1:%.+]] = bitcast i8** [[BP1]] to %class.S** 87*0caf736dSAlexey Bataev // CK34-DAG: [[PC1:%.+]] = bitcast i8** [[P1]] to %class.S** 88*0caf736dSAlexey Bataev 89*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC1]], 90*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC1]], 91*0caf736dSAlexey Bataev // CK34-DAG: store i64 [[A_SIZE:%.+]], i64* [[S1]], 92*0caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF1]], 93*0caf736dSAlexey Bataev 94*0caf736dSAlexey Bataev // CK34-DAG: [[A_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 95*0caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[C_BEGIN_INTPTR:%.+]], [[S_INTPTR:%.+]] 96*0caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64 97*0caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_INTPTR]] = ptrtoint i8* [[C_BEGIN_VOID:%.+]] to i64 98*0caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 99*0caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_VOID]] = bitcast %class.C* [[C_ADDR:%.+]] to i8* 100*0caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2 101*0caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1 102*0caf736dSAlexey Bataev 103*0caf736dSAlexey 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. 104*0caf736dSAlexey Bataev 105*0caf736dSAlexey Bataev // CK34-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 106*0caf736dSAlexey Bataev // CK34-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 107*0caf736dSAlexey Bataev // CK34-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 108*0caf736dSAlexey Bataev // CK34-DAG: [[MF2:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 2 109*0caf736dSAlexey Bataev 110*0caf736dSAlexey Bataev // CK34-DAG: [[BPC2:%.+]] = bitcast i8** [[BP2]] to %class.S** 111*0caf736dSAlexey Bataev // CK34-DAG: [[PC2:%.+]] = bitcast i8** [[P2]] to %class.C** 112*0caf736dSAlexey Bataev 113*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC2]], 114*0caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_END:%.+]], %class.C** [[PC2]], 115*0caf736dSAlexey Bataev // CK34-DAG: store i64 [[B_SIZE:%.+]], i64* [[S2]], 116*0caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF2]], 117*0caf736dSAlexey Bataev 118*0caf736dSAlexey Bataev // CK34-DAG: [[C_END]] = getelementptr %class.C, %class.C* [[C_ADDR]], i{{.+}} 1 119*0caf736dSAlexey Bataev 120*0caf736dSAlexey Bataev // CK34-DAG: [[B_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 121*0caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_END_INTPTR:%.+]], [[C_END_INTPTR:%.+]] 122*0caf736dSAlexey Bataev // CK34-DAG: [[C_END_INTPTR]] = ptrtoint i8* [[C_END_VOID:%.+]] to i64 123*0caf736dSAlexey Bataev // CK34-DAG: [[S_END_INTPTR]] = ptrtoint i8* [[S_END_VOID:%.+]] to i64 124*0caf736dSAlexey Bataev // CK34-DAG: [[C_END_VOID]] = bitcast %class.C* [[C_END]] to i8* 125*0caf736dSAlexey Bataev // CK34-DAG: [[S_END_VOID]] = getelementptr i8, i8* [[S_LAST:%.+]], i{{.+}} 1 126*0caf736dSAlexey Bataev // CK34-64-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i64 31 127*0caf736dSAlexey Bataev // CK34-32-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i32 15 128*0caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 129*0caf736dSAlexey Bataev 130*0caf736dSAlexey Bataev // pass MEMBER_OF_1 | TO | IMPLICIT | MAPPER {&s, &s.c, 16} to copy the data of s.c. 131*0caf736dSAlexey Bataev 132*0caf736dSAlexey Bataev // CK34-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 133*0caf736dSAlexey Bataev // CK34-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 134*0caf736dSAlexey Bataev // CK34-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3 135*0caf736dSAlexey Bataev // CK34-DAG: [[MF3:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 3 136*0caf736dSAlexey Bataev 137*0caf736dSAlexey Bataev // CK34-DAG: [[BPC3:%.+]] = bitcast i8** [[BP3]] to %class.S** 138*0caf736dSAlexey Bataev // CK34-DAG: [[PC3:%.+]] = bitcast i8** [[P3]] to %class.C** 139*0caf736dSAlexey Bataev 140*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC3]], 141*0caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_ADDR:%.+]], %class.C** [[PC3]], 142*0caf736dSAlexey Bataev // CK34-64-DAG: store i64 16, i64* [[S3]], 143*0caf736dSAlexey Bataev // CK34-32-DAG: store i64 8, i64* [[S3]], 144*0caf736dSAlexey Bataev // CK34-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[C_DEFAULT_MAPPER:@.+]] to i8*), i8** [[MF3]], 145*0caf736dSAlexey Bataev 146*0caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2 147*0caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1 148*0caf736dSAlexey Bataev 149*0caf736dSAlexey Bataev #pragma omp target map(to: s) 150*0caf736dSAlexey Bataev s.foo(); 151*0caf736dSAlexey Bataev 152*0caf736dSAlexey Bataev // CK34 : call void 153*0caf736dSAlexey Bataev 154*0caf736dSAlexey 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:%.+]]) 155*0caf736dSAlexey Bataev // CK34-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] 156*0caf736dSAlexey Bataev // CK34-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] 157*0caf736dSAlexey Bataev // CK34-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]] 158*0caf736dSAlexey Bataev // CK34-DAG: [[GEPMF]] = bitcast [4 x i8*]* [[MF:%.+]] to i8** 159*0caf736dSAlexey Bataev 160*0caf736dSAlexey Bataev // pass TARGET_PARAM {&s, &s, ((void*)(&s+1)-(void*)&s)} 161*0caf736dSAlexey Bataev 162*0caf736dSAlexey Bataev // CK34-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 163*0caf736dSAlexey Bataev // CK34-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 164*0caf736dSAlexey Bataev // CK34-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0 165*0caf736dSAlexey Bataev // CK34-DAG: [[MF0:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 0 166*0caf736dSAlexey Bataev 167*0caf736dSAlexey Bataev // CK34-DAG: [[BPC0:%.+]] = bitcast i8** [[BP0]] to %class.S** 168*0caf736dSAlexey Bataev // CK34-DAG: [[PC0:%.+]] = bitcast i8** [[P0]] to %class.S** 169*0caf736dSAlexey Bataev 170*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC0]], 171*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC0]], 172*0caf736dSAlexey Bataev // CK34-DAG: store i64 [[S_SIZE:%.+]], i64* [[S0]], 173*0caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF0]], 174*0caf736dSAlexey Bataev 175*0caf736dSAlexey Bataev // CK34-DAG: [[S_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 176*0caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_1_INTPTR:%.+]], [[S_INTPTR:%.+]] 177*0caf736dSAlexey Bataev // CK34-DAG: [[S_1_INTPTR]] = ptrtoint i8* [[S_1_VOID:%.+]] to i64 178*0caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64 179*0caf736dSAlexey Bataev // CK34-DAG: [[S_1_VOID]] = bitcast %class.S* [[S_1:%.+]] to i8* 180*0caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 181*0caf736dSAlexey Bataev // CK34-DAG: [[S_1]] = getelementptr %class.S, %class.S* [[S_ADDR]], i32 1 182*0caf736dSAlexey Bataev 183*0caf736dSAlexey Bataev // pass MEMBER_OF_1 | FROM {&s, &s, ((void*)(&s.a+1)-(void*)&s)} to copy the data of s.a. 184*0caf736dSAlexey Bataev 185*0caf736dSAlexey Bataev // CK34-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1 186*0caf736dSAlexey Bataev // CK34-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1 187*0caf736dSAlexey Bataev // CK34-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1 188*0caf736dSAlexey Bataev // CK34-DAG: [[MF1:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 1 189*0caf736dSAlexey Bataev 190*0caf736dSAlexey Bataev // CK34-DAG: [[BPC1:%.+]] = bitcast i8** [[BP1]] to %class.S** 191*0caf736dSAlexey Bataev // CK34-DAG: [[PC1:%.+]] = bitcast i8** [[P1]] to %class.S** 192*0caf736dSAlexey Bataev 193*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC1]], 194*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[PC1]], 195*0caf736dSAlexey Bataev // CK34-DAG: store i64 [[A_SIZE:%.+]], i64* [[S1]], 196*0caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF1]], 197*0caf736dSAlexey Bataev 198*0caf736dSAlexey Bataev // CK34-DAG: [[A_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 199*0caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[C_BEGIN_INTPTR:%.+]], [[S_INTPTR:%.+]] 200*0caf736dSAlexey Bataev // CK34-DAG: [[S_INTPTR]] = ptrtoint i8* [[S_VOID:%.+]] to i64 201*0caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_INTPTR]] = ptrtoint i8* [[C_BEGIN_VOID:%.+]] to i64 202*0caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 203*0caf736dSAlexey Bataev // CK34-DAG: [[C_BEGIN_VOID]] = bitcast %class.C* [[C_ADDR:%.+]] to i8* 204*0caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2 205*0caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1 206*0caf736dSAlexey Bataev 207*0caf736dSAlexey 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. 208*0caf736dSAlexey Bataev 209*0caf736dSAlexey Bataev // CK34-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2 210*0caf736dSAlexey Bataev // CK34-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2 211*0caf736dSAlexey Bataev // CK34-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2 212*0caf736dSAlexey Bataev // CK34-DAG: [[MF2:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 2 213*0caf736dSAlexey Bataev 214*0caf736dSAlexey Bataev // CK34-DAG: [[BPC2:%.+]] = bitcast i8** [[BP2]] to %class.S** 215*0caf736dSAlexey Bataev // CK34-DAG: [[PC2:%.+]] = bitcast i8** [[P2]] to %class.C** 216*0caf736dSAlexey Bataev 217*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC2]], 218*0caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_END:%.+]], %class.C** [[PC2]], 219*0caf736dSAlexey Bataev // CK34-DAG: store i64 [[B_SIZE:%.+]], i64* [[S2]], 220*0caf736dSAlexey Bataev // CK34-DAG: store i8* null, i8** [[MF2]], 221*0caf736dSAlexey Bataev 222*0caf736dSAlexey Bataev // CK34-DAG: [[C_END]] = getelementptr %class.C, %class.C* [[C_ADDR]], i{{.+}} 1 223*0caf736dSAlexey Bataev 224*0caf736dSAlexey Bataev // CK34-DAG: [[B_SIZE]] = sdiv exact i64 [[SZ:%.+]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 225*0caf736dSAlexey Bataev // CK34-DAG: [[SZ]] = sub i64 [[S_END_INTPTR:%.+]], [[C_END_INTPTR:%.+]] 226*0caf736dSAlexey Bataev // CK34-DAG: [[C_END_INTPTR]] = ptrtoint i8* [[C_END_VOID:%.+]] to i64 227*0caf736dSAlexey Bataev // CK34-DAG: [[S_END_INTPTR]] = ptrtoint i8* [[S_END_VOID:%.+]] to i64 228*0caf736dSAlexey Bataev // CK34-DAG: [[C_END_VOID]] = bitcast %class.C* [[C_END]] to i8* 229*0caf736dSAlexey Bataev // CK34-DAG: [[S_END_VOID]] = getelementptr i8, i8* [[S_LAST:%.+]], i{{.+}} 1 230*0caf736dSAlexey Bataev // CK34-64-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i64 31 231*0caf736dSAlexey Bataev // CK34-32-DAG: [[S_LAST]] = getelementptr i8, i8* [[S_VOID:%.+]], i32 15 232*0caf736dSAlexey Bataev // CK34-DAG: [[S_VOID]] = bitcast %class.S* [[S_ADDR]] to i8* 233*0caf736dSAlexey Bataev 234*0caf736dSAlexey Bataev // pass MEMBER_OF_1 | FROM | IMPLICIT | MAPPER {&s, &s.c, 16} to copy the data of s.c. 235*0caf736dSAlexey Bataev 236*0caf736dSAlexey Bataev // CK34-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3 237*0caf736dSAlexey Bataev // CK34-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3 238*0caf736dSAlexey Bataev // CK34-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3 239*0caf736dSAlexey Bataev // CK34-DAG: [[MF3:%.+]] = getelementptr inbounds {{.+}}[[MF]], i{{.+}} 0, i{{.+}} 3 240*0caf736dSAlexey Bataev 241*0caf736dSAlexey Bataev // CK34-DAG: [[BPC3:%.+]] = bitcast i8** [[BP3]] to %class.S** 242*0caf736dSAlexey Bataev // CK34-DAG: [[PC3:%.+]] = bitcast i8** [[P3]] to %class.C** 243*0caf736dSAlexey Bataev 244*0caf736dSAlexey Bataev // CK34-DAG: store %class.S* [[S_ADDR]], %class.S** [[BPC3]], 245*0caf736dSAlexey Bataev // CK34-DAG: store %class.C* [[C_ADDR:%.+]], %class.C** [[PC3]], 246*0caf736dSAlexey Bataev // CK34-64-DAG: store i64 16, i64* [[S3]], 247*0caf736dSAlexey Bataev // CK34-32-DAG: store i64 8, i64* [[S3]], 248*0caf736dSAlexey Bataev // CK34-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[C_DEFAULT_MAPPER]] to i8*), i8** [[MF3]], 249*0caf736dSAlexey Bataev 250*0caf736dSAlexey Bataev // CK34-64-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 2 251*0caf736dSAlexey Bataev // CK34-32-DAG: [[C_ADDR]] = getelementptr inbounds %class.S, %class.S* [[S_ADDR]], i32 0, i32 1 252*0caf736dSAlexey Bataev 253*0caf736dSAlexey Bataev #pragma omp target map(from: s) 254*0caf736dSAlexey Bataev s.foo(); 255*0caf736dSAlexey Bataev } 256*0caf736dSAlexey Bataev 257*0caf736dSAlexey Bataev #endif // CK34 258*0caf736dSAlexey Bataev #endif 259