14304e9d1SMichael Kruse // SIMD-ONLY0-NOT: {{__kmpc|__tgt}} 24304e9d1SMichael Kruse 34304e9d1SMichael Kruse // expected-no-diagnostics 44304e9d1SMichael Kruse #ifndef HEADER 54304e9d1SMichael Kruse #define HEADER 64304e9d1SMichael Kruse 7d47b9438SMichael Kruse ///==========================================================================/// 8*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix CK0 --check-prefix CK0-64 %s 9*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 10*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix CK0 --check-prefix CK0-64 %s 11*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix CK0 --check-prefix CK0-32 %s 12*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 13*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix CK0 --check-prefix CK0-32 %s 14d47b9438SMichael Kruse 15*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s 16*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 17*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s 18*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s 19*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 20*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK0 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s 21d47b9438SMichael Kruse 22d47b9438SMichael Kruse #ifdef CK0 23537b16e9SGeorge Rokos // Mapper function code generation and runtime interface. 24d47b9438SMichael Kruse 25ebb1092aSShilei Tian // CK0: [[IDENT_T:%.+]] = type { i32, i32, i32, i32, i8* } 26ebb1092aSShilei Tian // CK0: [[ENTRY:%.+]] = type { i8*, i8*, i[[SZ:32|64]], i32, i32 } 27ebb1092aSShilei Tian // CK0: [[ANON_T:%.+]] = type { %class.C* } 28ebb1092aSShilei Tian // CK0: [[ANON_T_0:%.+]] = type { %class.C* } 29ebb1092aSShilei Tian // CK0: [[KMP_TASK_T_WITH_PRIVATES:%.+]] = type { [[KMP_TASK_T:%[^,]+]], [[KMP_PRIVATES_T:%.+]] } 30ebb1092aSShilei Tian // CK0: [[KMP_TASK_T]] = type { i8*, i32 (i32, i8*)*, i32, %{{[^,]+}}, %{{[^,]+}} } 31ebb1092aSShilei Tian // CK0-32: [[KMP_PRIVATES_T]] = type { [1 x i64], [1 x i8*], [1 x i8*], [1 x i8*] } 32ebb1092aSShilei Tian // CK0-64: [[KMP_PRIVATES_T]] = type { [1 x i8*], [1 x i8*], [1 x i64], [1 x i8*] } 33ebb1092aSShilei Tian // CK0: [[KMP_TASK_T_WITH_PRIVATES_1:%.+]] = type { [[KMP_TASK_T]], [[KMP_PRIVATES_T_2:%.+]] } 34ebb1092aSShilei Tian // CK0-32: [[KMP_PRIVATES_T_2]] = type { [1 x i64], [1 x i8*], [1 x i8*], [1 x i8*] } 35ebb1092aSShilei Tian // CK0-64: [[KMP_PRIVATES_T_2]] = type { [1 x i8*], [1 x i8*], [1 x i64], [1 x i8*] } 360661328dSShilei Tian // CK0: [[KMP_TASK_T_WITH_PRIVATES_4:%.+]] = type { [[KMP_TASK_T]], [[KMP_PRIVATES_T_5:%.+]] } 370661328dSShilei Tian // CK0-32: [[KMP_PRIVATES_T_5]] = type { [1 x i64], [1 x i8*], [1 x i8*], [1 x i8*] } 380661328dSShilei Tian // CK0-64: [[KMP_PRIVATES_T_5]] = type { [1 x i8*], [1 x i8*], [1 x i64], [1 x i8*] } 390661328dSShilei Tian // CK0: [[KMP_TASK_T_WITH_PRIVATES_7:%.+]] = type { [[KMP_TASK_T]], [[KMP_PRIVATES_T_8:%.+]] } 400661328dSShilei Tian // CK0-32: [[KMP_PRIVATES_T_8]] = type { [1 x i64], [1 x i8*], [1 x i8*], [1 x i8*] } 410661328dSShilei Tian // CK0-64: [[KMP_PRIVATES_T_8]] = type { [1 x i8*], [1 x i8*], [1 x i64], [1 x i8*] } 420661328dSShilei Tian // CK0: [[KMP_TASK_T_WITH_PRIVATES_10:%.+]] = type { [[KMP_TASK_T]], [[KMP_PRIVATES_T_11:%.+]] } 430661328dSShilei Tian // CK0-32: [[KMP_PRIVATES_T_11]] = type { [1 x i64], [1 x i8*], [1 x i8*], [1 x i8*] } 440661328dSShilei Tian // CK0-64: [[KMP_PRIVATES_T_11]] = type { [1 x i8*], [1 x i8*], [1 x i64], [1 x i8*] } 45ebb1092aSShilei Tian 46d47b9438SMichael Kruse // CK0-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}.region_id = weak constant i8 0 47d47b9438SMichael Kruse // CK0-64: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 48d47b9438SMichael Kruse // CK0-32: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 49d47b9438SMichael Kruse // CK0: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 35] 50537b16e9SGeorge Rokos // CK0-64: [[NWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 51537b16e9SGeorge Rokos // CK0-32: [[NWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 52537b16e9SGeorge Rokos // CK0: [[NWTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 35] 53537b16e9SGeorge Rokos // CK0-64: [[TEAMSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 54537b16e9SGeorge Rokos // CK0-32: [[TEAMSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 55537b16e9SGeorge Rokos // CK0: [[TEAMTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 33] 56537b16e9SGeorge Rokos // CK0-64: [[TEAMNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 57537b16e9SGeorge Rokos // CK0-32: [[TEAMNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 58537b16e9SGeorge Rokos // CK0: [[TEAMNWTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 33] 59537b16e9SGeorge Rokos // CK0-64: [[EDSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 60537b16e9SGeorge Rokos // CK0-32: [[EDSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 61b272698dSAlexey Bataev // CK0: [[EDTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 1] 62537b16e9SGeorge Rokos // CK0-64: [[EDNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 63537b16e9SGeorge Rokos // CK0-32: [[EDNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 64b272698dSAlexey Bataev // CK0: [[EDNWTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 1] 65537b16e9SGeorge Rokos // CK0-64: [[EXDSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 66537b16e9SGeorge Rokos // CK0-32: [[EXDSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 67b272698dSAlexey Bataev // CK0: [[EXDTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 2] 68537b16e9SGeorge Rokos // CK0-64: [[EXDNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 69537b16e9SGeorge Rokos // CK0-32: [[EXDNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 70b272698dSAlexey Bataev // CK0: [[EXDNWTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 2] 71d47b9438SMichael Kruse // CK0-64: [[TSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 72d47b9438SMichael Kruse // CK0-32: [[TSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 73b272698dSAlexey Bataev // CK0: [[TTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 1] 74d47b9438SMichael Kruse // CK0-64: [[FSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 75d47b9438SMichael Kruse // CK0-32: [[FSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 76b272698dSAlexey Bataev // CK0: [[FTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 2] 77537b16e9SGeorge Rokos // CK0-64: [[FNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 78537b16e9SGeorge Rokos // CK0-32: [[FNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 79b272698dSAlexey Bataev // CK0: [[FNWTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 2] 80d47b9438SMichael Kruse 814304e9d1SMichael Kruse class C { 824304e9d1SMichael Kruse public: 834304e9d1SMichael Kruse int a; 84d47b9438SMichael Kruse double *b; 854304e9d1SMichael Kruse }; 864304e9d1SMichael Kruse 87d47b9438SMichael Kruse #pragma omp declare mapper(id: C s) map(s.a, s.b[0:2]) 884304e9d1SMichael Kruse 89e4eaf9d8SJoseph Huber // CK0: define {{.*}}void [[MPRFUNC:@[.]omp_mapper[.].*C[.]id]](i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}, i8*{{.*}}) 90d47b9438SMichael Kruse // CK0: store i8* %{{[^,]+}}, i8** [[HANDLEADDR:%[^,]+]] 91d47b9438SMichael Kruse // CK0: store i8* %{{[^,]+}}, i8** [[BPTRADDR:%[^,]+]] 92d47b9438SMichael Kruse // CK0: store i8* %{{[^,]+}}, i8** [[VPTRADDR:%[^,]+]] 93d47b9438SMichael Kruse // CK0: store i64 %{{[^,]+}}, i{{64|32}}* [[SIZEADDR:%[^,]+]] 94d47b9438SMichael Kruse // CK0: store i64 %{{[^,]+}}, i64* [[TYPEADDR:%[^,]+]] 95537b16e9SGeorge Rokos // CK0-DAG: [[BYTESIZE:%.+]] = load i64, i64* [[SIZEADDR]] 96537b16e9SGeorge Rokos // CK0-64-DAG: [[SIZE:%.+]] = udiv exact i64 [[BYTESIZE]], 16 97537b16e9SGeorge Rokos // CK0-32-DAG: [[SIZE:%.+]] = udiv exact i64 [[BYTESIZE]], 8 98d47b9438SMichael Kruse // CK0-DAG: [[TYPE:%.+]] = load i64, i64* [[TYPEADDR]] 99d47b9438SMichael Kruse // CK0-DAG: [[HANDLE:%.+]] = load i8*, i8** [[HANDLEADDR]] 100d47b9438SMichael Kruse // CK0-DAG: [[BPTR:%.+]] = load i8*, i8** [[BPTRADDR]] 101d47b9438SMichael Kruse // CK0-DAG: [[BEGIN:%.+]] = load i8*, i8** [[VPTRADDR]] 10260d71a28SAlexey Bataev // CK0-DAG: [[ISARRAY:%.+]] = icmp sgt i64 [[SIZE]], 1 10360d71a28SAlexey Bataev // CK0-DAG: [[PTRBEGIN:%.+]] = bitcast i8* [[BEGIN]] to %class.C* 10460d71a28SAlexey Bataev // CK0-DAG: [[PTREND:%.+]] = getelementptr %class.C, %class.C* [[PTRBEGIN]], i64 [[SIZE]] 105caff8591SNikita Popov // CK0-DAG: [[PTRSNE:%.+]] = icmp ne i8* [[BPTR]], [[BEGIN]] 1060caf736dSAlexey Bataev // CK0-DAG: [[PTRANDOBJ:%.+]] = and i64 [[TYPE]], 16 1070caf736dSAlexey Bataev // CK0-DAG: [[ISPTRANDOBJ:%.+]] = icmp ne i64 [[PTRANDOBJ]], 0 1080caf736dSAlexey Bataev // CK0-DAG: [[CMPA:%.+]] = and i1 [[PTRSNE]], [[ISPTRANDOBJ]] 1090caf736dSAlexey Bataev // CK0-DAG: [[CMP:%.+]] = or i1 [[ISARRAY]], [[CMPA]] 11060d71a28SAlexey Bataev // CK0-DAG: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 11160d71a28SAlexey Bataev // CK0-DAG: [[ISNOTDEL:%.+]] = icmp eq i64 [[TYPEDEL]], 0 11260d71a28SAlexey Bataev // CK0-DAG: [[CMP1:%.+]] = and i1 [[CMP]], [[ISNOTDEL]] 11360d71a28SAlexey Bataev // CK0: br i1 [[CMP1]], label %[[INIT:[^,]+]], label %[[LHEAD:[^,]+]] 114d47b9438SMichael Kruse // CK0: [[INIT]] 115d47b9438SMichael Kruse // CK0-64-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 116d47b9438SMichael Kruse // CK0-32-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 8 11707988422SAlexey Bataev 11807988422SAlexey Bataev // Remove movement mappings and mark as implicit 11907988422SAlexey Bataev // CK0-DAG: [[ITYPE:%.+]] = and i64 [[TYPE]], -4 12007988422SAlexey Bataev // CK0-DAG: [[ITYPE1:%.+]] = or i64 [[ITYPE]], 512 12107988422SAlexey Bataev // CK0: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[ITYPE1]], {{.*}}) 122d47b9438SMichael Kruse // CK0: br label %[[LHEAD:[^,]+]] 1234304e9d1SMichael Kruse 124d47b9438SMichael Kruse // CK0: [[LHEAD]] 12560d71a28SAlexey Bataev // CK0: [[ISEMPTY:%.+]] = icmp eq %class.C* [[PTRBEGIN]], [[PTREND]] 126d47b9438SMichael Kruse // CK0: br i1 [[ISEMPTY]], label %[[DONE:[^,]+]], label %[[LBODY:[^,]+]] 127d47b9438SMichael Kruse // CK0: [[LBODY]] 12860d71a28SAlexey Bataev // CK0: [[PTR:%.+]] = phi %class.C* [ [[PTRBEGIN]], %{{.+}} ], [ [[PTRNEXT:%.+]], %[[LCORRECT:[^,]+]] ] 12960d71a28SAlexey Bataev // CK0-DAG: [[ABEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[PTR]], i32 0, i32 0 13060d71a28SAlexey Bataev // CK0-DAG: [[BBEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[PTR]], i32 0, i32 1 13160d71a28SAlexey Bataev // CK0-DAG: [[BBEGIN2:%.+]] = getelementptr inbounds %class.C, %class.C* [[PTR]], i32 0, i32 1 132d47b9438SMichael Kruse // CK0-DAG: [[BARRBEGIN:%.+]] = load double*, double** [[BBEGIN2]] 133d47b9438SMichael Kruse // CK0-DAG: [[BARRBEGINGEP:%.+]] = getelementptr inbounds double, double* [[BARRBEGIN]], i[[sz:64|32]] 0 134d47b9438SMichael Kruse // CK0-DAG: [[BEND:%.+]] = getelementptr double*, double** [[BBEGIN]], i32 1 135d47b9438SMichael Kruse // CK0-DAG: [[ABEGINV:%.+]] = bitcast i32* [[ABEGIN]] to i8* 136d47b9438SMichael Kruse // CK0-DAG: [[BENDV:%.+]] = bitcast double** [[BEND]] to i8* 137d47b9438SMichael Kruse // CK0-DAG: [[ABEGINI:%.+]] = ptrtoint i8* [[ABEGINV]] to i64 138d47b9438SMichael Kruse // CK0-DAG: [[BENDI:%.+]] = ptrtoint i8* [[BENDV]] to i64 139d47b9438SMichael Kruse // CK0-DAG: [[CSIZE:%.+]] = sub i64 [[BENDI]], [[ABEGINI]] 140d47b9438SMichael Kruse // CK0-DAG: [[CUSIZE:%.+]] = sdiv exact i64 [[CSIZE]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 141d47b9438SMichael Kruse // CK0-DAG: [[PRESIZE:%.+]] = call i64 @__tgt_mapper_num_components(i8* [[HANDLE]]) 142d47b9438SMichael Kruse // CK0-DAG: [[SHIPRESIZE:%.+]] = shl i64 [[PRESIZE]], 48 14360d71a28SAlexey Bataev // CK0-DAG: [[BPTRADDR0BC:%.+]] = bitcast %class.C* [[PTR]] to i8* 14460d71a28SAlexey Bataev // CK0-DAG: [[PTRADDR0BC:%.+]] = bitcast i32* [[ABEGIN]] to i8* 14560d71a28SAlexey Bataev // CK0-DAG: [[MEMBERTYPE:%.+]] = add nuw i64 0, [[SHIPRESIZE]] 146d47b9438SMichael Kruse // CK0-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 147d47b9438SMichael Kruse // CK0-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 148d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 149d47b9438SMichael Kruse // CK0-DAG: [[ALLOC]] 150d47b9438SMichael Kruse // CK0-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 151d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND:[^,]+]] 152d47b9438SMichael Kruse // CK0-DAG: [[ALLOCELSE]] 153d47b9438SMichael Kruse // CK0-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 154d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 155d47b9438SMichael Kruse // CK0-DAG: [[TO]] 156d47b9438SMichael Kruse // CK0-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 157d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 158d47b9438SMichael Kruse // CK0-DAG: [[TOELSE]] 159d47b9438SMichael Kruse // CK0-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 160d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 161d47b9438SMichael Kruse // CK0-DAG: [[FROM]] 162d47b9438SMichael Kruse // CK0-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 163d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 164d47b9438SMichael Kruse // CK0-DAG: [[TYEND]] 165d47b9438SMichael Kruse // CK0-DAG: [[PHITYPE0:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 166e4eaf9d8SJoseph Huber // CK0: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR0BC]], i8* [[PTRADDR0BC]], i64 [[CUSIZE]], i64 [[PHITYPE0]], {{.*}}) 16760d71a28SAlexey Bataev // CK0-DAG: [[BPTRADDR1BC:%.+]] = bitcast %class.C* [[PTR]] to i8* 168d47b9438SMichael Kruse // CK0-DAG: [[PTRADDR1BC:%.+]] = bitcast i32* [[ABEGIN]] to i8* 169d47b9438SMichael Kruse // 281474976710659 == 0x1,000,000,003 17060d71a28SAlexey Bataev // CK0-DAG: [[MEMBERTYPE:%.+]] = add nuw i64 281474976710659, [[SHIPRESIZE]] 171d47b9438SMichael Kruse // CK0-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 172d47b9438SMichael Kruse // CK0-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 173d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 174d47b9438SMichael Kruse // CK0-DAG: [[ALLOC]] 175d47b9438SMichael Kruse // CK0-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 176d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND:[^,]+]] 177d47b9438SMichael Kruse // CK0-DAG: [[ALLOCELSE]] 178d47b9438SMichael Kruse // CK0-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 179d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 180d47b9438SMichael Kruse // CK0-DAG: [[TO]] 181d47b9438SMichael Kruse // CK0-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 182d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 183d47b9438SMichael Kruse // CK0-DAG: [[TOELSE]] 184d47b9438SMichael Kruse // CK0-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 185d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 186d47b9438SMichael Kruse // CK0-DAG: [[FROM]] 187d47b9438SMichael Kruse // CK0-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 188d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 189d47b9438SMichael Kruse // CK0-DAG: [[TYEND]] 190d47b9438SMichael Kruse // CK0-DAG: [[TYPE1:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 191e4eaf9d8SJoseph Huber // CK0: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR1BC]], i8* [[PTRADDR1BC]], i64 4, i64 [[TYPE1]], {{.*}}) 192d47b9438SMichael Kruse // CK0-DAG: [[BPTRADDR2BC:%.+]] = bitcast double** [[BBEGIN]] to i8* 193d47b9438SMichael Kruse // CK0-DAG: [[PTRADDR2BC:%.+]] = bitcast double* [[BARRBEGINGEP]] to i8* 194d47b9438SMichael Kruse // 281474976710675 == 0x1,000,000,013 19560d71a28SAlexey Bataev // CK0-DAG: [[MEMBERTYPE:%.+]] = add nuw i64 281474976710675, [[SHIPRESIZE]] 196d47b9438SMichael Kruse // CK0-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 197d47b9438SMichael Kruse // CK0-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 198d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 199d47b9438SMichael Kruse // CK0-DAG: [[ALLOC]] 200d47b9438SMichael Kruse // CK0-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 201d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND:[^,]+]] 202d47b9438SMichael Kruse // CK0-DAG: [[ALLOCELSE]] 203d47b9438SMichael Kruse // CK0-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 204d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 205d47b9438SMichael Kruse // CK0-DAG: [[TO]] 206d47b9438SMichael Kruse // CK0-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 207d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 208d47b9438SMichael Kruse // CK0-DAG: [[TOELSE]] 209d47b9438SMichael Kruse // CK0-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 210d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 211d47b9438SMichael Kruse // CK0-DAG: [[FROM]] 212d47b9438SMichael Kruse // CK0-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 213d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 214d47b9438SMichael Kruse // CK0-DAG: [[TYEND]] 215d47b9438SMichael Kruse // CK0-DAG: [[TYPE2:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 216e4eaf9d8SJoseph Huber // CK0: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR2BC]], i8* [[PTRADDR2BC]], i64 16, i64 [[TYPE2]], {{.*}}) 21760d71a28SAlexey Bataev // CK0: [[PTRNEXT]] = getelementptr %class.C, %class.C* [[PTR]], i32 1 21860d71a28SAlexey Bataev // CK0: [[ISDONE:%.+]] = icmp eq %class.C* [[PTRNEXT]], [[PTREND]] 219d47b9438SMichael Kruse // CK0: br i1 [[ISDONE]], label %[[LEXIT:[^,]+]], label %[[LBODY]] 220d47b9438SMichael Kruse 221d47b9438SMichael Kruse // CK0: [[LEXIT]] 22260d71a28SAlexey Bataev // CK0: [[ISARRAY:%.+]] = icmp sgt i64 [[SIZE]], 1 223d47b9438SMichael Kruse // CK0: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 22460d71a28SAlexey Bataev // CK0: [[ISNOTDEL:%.+]] = icmp ne i64 [[TYPEDEL]], 0 2250caf736dSAlexey Bataev // CK0: [[CMP1:%.+]] = and i1 [[ISARRAY]], [[ISNOTDEL]] 22660d71a28SAlexey Bataev // CK0: br i1 [[CMP1]], label %[[EVALDEL:[^,]+]], label %[[DONE]] 22760d71a28SAlexey Bataev // CK0: [[EVALDEL]] 228d47b9438SMichael Kruse // CK0-64-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 229d47b9438SMichael Kruse // CK0-32-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 8 23007988422SAlexey Bataev 23107988422SAlexey Bataev // Remove movement mappings and mark as implicit 23207988422SAlexey Bataev // CK0-DAG: [[DTYPE:%.+]] = and i64 [[TYPE]], -4 23307988422SAlexey Bataev // CK0-DAG: [[DTYPE1:%.+]] = or i64 [[DTYPE]], 512 23407988422SAlexey Bataev // CK0: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[DTYPE1]], {{.*}}) 235d47b9438SMichael Kruse // CK0: br label %[[DONE]] 236d47b9438SMichael Kruse // CK0: [[DONE]] 237d47b9438SMichael Kruse // CK0: ret void 238d47b9438SMichael Kruse 239d47b9438SMichael Kruse 240d47b9438SMichael Kruse // CK0-LABEL: define {{.*}}void @{{.*}}foo{{.*}} 2414304e9d1SMichael Kruse void foo(int a){ 2424304e9d1SMichael Kruse int i = a; 2434304e9d1SMichael Kruse C c; 2444304e9d1SMichael Kruse c.a = a; 2454304e9d1SMichael Kruse 246da8bec47SJoseph Huber // CK0-DAG: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null, i8** [[MPRGEP:%.+]]) 247d47b9438SMichael Kruse // CK0-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 248d47b9438SMichael Kruse // CK0-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 249537b16e9SGeorge Rokos // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%[^,]+]] to i8** 250d47b9438SMichael Kruse // CK0-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 251d47b9438SMichael Kruse // CK0-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 252537b16e9SGeorge Rokos // CK0-DAG: [[MPR1:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i[[sz]] 0, i[[sz]] 0 253d47b9438SMichael Kruse // CK0-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to %class.C** 254d47b9438SMichael Kruse // CK0-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to %class.C** 255d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL:%[^,]+]], %class.C** [[CBP1]] 256d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL]], %class.C** [[CP1]] 257e4eaf9d8SJoseph Huber // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[MPR1]] 258ebb1092aSShilei Tian // CK0: call void [[KERNEL_1:@.+]](%class.C* [[VAL]]) 2594304e9d1SMichael Kruse #pragma omp target map(mapper(id),tofrom: c) 2604304e9d1SMichael Kruse { 2614304e9d1SMichael Kruse ++c.a; 2624304e9d1SMichael Kruse } 26301f670dfSMichael Kruse 264ebb1092aSShilei Tian // CK0: [[BP2GEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[OFFLOAD_BP2:%[^,]+]], i32 0, i32 0 265ebb1092aSShilei Tian // CK0: [[BP2CAST:%.+]] = bitcast i8** [[BP2GEP]] to %class.C** 266ebb1092aSShilei Tian // CK0: store %class.C* [[CADDR:%[^,]+]], %class.C** [[BP2CAST]], align 267ebb1092aSShilei Tian // CK0: [[P2GEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[OFFLOAD_P2:%[^,]+]], i32 0, i32 0 268ebb1092aSShilei Tian // CK0: [[P2CAST:%.+]] = bitcast i8** [[P2GEP]] to %class.C** 269ebb1092aSShilei Tian // CK0: store %class.C* [[CADDR]], %class.C** [[P2CAST]], align 270ebb1092aSShilei Tian // CK0: [[MAPPER2GEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[OFFLOAD_MAPPER2:%[^,]+]], i[[SZ]] 0, i[[SZ]] 0 271e4eaf9d8SJoseph Huber // CK0: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[MAPPER2GEP]], align 272ebb1092aSShilei Tian // CK0: [[BP2:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[OFFLOAD_BP2]], i32 0, i32 0 273ebb1092aSShilei Tian // CK0: [[P2:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[OFFLOAD_P2]], i32 0, i32 0 274ebb1092aSShilei Tian // CK0: [[MAPPER2:%.+]] = bitcast [1 x i8*]* [[OFFLOAD_MAPPER2]] to i8** 275ebb1092aSShilei Tian // CK0-32: [[TASK:%.+]] = call i8* @__kmpc_omp_target_task_alloc([[IDENT_T]]* {{@.+}}, i32 {{%.+}}, i32 1, i32 40, i32 4, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T_WITH_PRIVATES]]*)* [[TASK_ENTRY:@.+]] to i32 (i32, i8*)*), i64 -1) 276ebb1092aSShilei Tian // CK0-64: [[TASK:%.+]] = call i8* @__kmpc_omp_target_task_alloc([[IDENT_T]]* {{@.+}}, i32 {{%.+}}, i32 1, i64 72, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T_WITH_PRIVATES]]*)* [[TASK_ENTRY:@.+]] to i32 (i32, i8*)*), i64 -1) 277ebb1092aSShilei Tian // CK0: [[TASK_CAST:%.+]] = bitcast i8* [[TASK]] to [[KMP_TASK_T_WITH_PRIVATES]]* 278ebb1092aSShilei Tian // CK0: [[TASK_WITH_PRIVATES:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES]], [[KMP_TASK_T_WITH_PRIVATES]]* [[TASK_CAST]], i32 0, i32 1 279ebb1092aSShilei Tian // CK0: {{.+}} = call i32 @__kmpc_omp_task([[IDENT_T]]* @1, i32 {{.+}}, i8* [[TASK]]) 280537b16e9SGeorge Rokos #pragma omp target map(mapper(id),tofrom: c) nowait 281537b16e9SGeorge Rokos { 282537b16e9SGeorge Rokos ++c.a; 283537b16e9SGeorge Rokos } 284537b16e9SGeorge Rokos 285da8bec47SJoseph Huber // CK0-DAG: call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[TEAMSIZES]]{{.+}}, {{.+}}[[TEAMTYPES]]{{.+}}, i8** null, i8** [[MPRGEP:%.+]], i32 0, i32 0) 286537b16e9SGeorge Rokos // CK0-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 287537b16e9SGeorge Rokos // CK0-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 288537b16e9SGeorge Rokos // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%[^,]+]] to i8** 289537b16e9SGeorge Rokos // CK0-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 290537b16e9SGeorge Rokos // CK0-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 291537b16e9SGeorge Rokos // CK0-DAG: [[MPR1:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i[[sz]] 0, i[[sz]] 0 292537b16e9SGeorge Rokos // CK0-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to %class.C** 293537b16e9SGeorge Rokos // CK0-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to %class.C** 294537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL:%[^,]+]], %class.C** [[CBP1]] 295537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL]], %class.C** [[CP1]] 296e4eaf9d8SJoseph Huber // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[MPR1]] 297ebb1092aSShilei Tian // CK0: call void [[KERNEL_3:@.+]](%class.C* [[VAL]]) 298537b16e9SGeorge Rokos #pragma omp target teams map(mapper(id),to: c) 299537b16e9SGeorge Rokos { 300537b16e9SGeorge Rokos ++c.a; 301537b16e9SGeorge Rokos } 302537b16e9SGeorge Rokos 303ebb1092aSShilei Tian // CK0-32: [[TASK_1:%.+]] = call i8* @__kmpc_omp_target_task_alloc([[IDENT_T]]* {{@.+}}, i32 {{%.+}}, i32 1, i32 40, i32 4, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T_WITH_PRIVATES_1]]*)* [[TASK_ENTRY_1:@.+]] to i32 (i32, i8*)*), i64 -1) 304ebb1092aSShilei Tian // CK0-64: [[TASK_1:%.+]] = call i8* @__kmpc_omp_target_task_alloc([[IDENT_T]]* {{@.+}}, i32 {{%.+}}, i32 1, i64 72, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T_WITH_PRIVATES_1]]*)* [[TASK_ENTRY_1:@.+]] to i32 (i32, i8*)*), i64 -1) 305ebb1092aSShilei Tian // CK0: [[TASK_CAST_1:%.+]] = bitcast i8* [[TASK_1]] to [[KMP_TASK_T_WITH_PRIVATES_1]]* 306ebb1092aSShilei Tian // CK0: [[TASK_CAST_GET_1:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES_1]], [[KMP_TASK_T_WITH_PRIVATES_1]]* [[TASK_CAST_1]], i32 0, i32 0 307ebb1092aSShilei Tian // CK0: {{.+}} = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_CAST_GET_1]], i32 0, i32 0 308ebb1092aSShilei Tian // CK0: {{.+}} = call i32 @__kmpc_omp_task([[IDENT_T]]* @1, i32 {{.+}}, i8* [[TASK_1]]) 309537b16e9SGeorge Rokos #pragma omp target teams map(mapper(id),to: c) nowait 310537b16e9SGeorge Rokos { 311537b16e9SGeorge Rokos ++c.a; 312537b16e9SGeorge Rokos } 313537b16e9SGeorge Rokos 314da8bec47SJoseph Huber // CK0-DAG: call void @__tgt_target_data_begin_mapper(%struct.ident_t* @{{.+}}, i64 {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[EDSIZES]]{{.+}}, {{.+}}[[EDTYPES]]{{.+}}, i8** null, i8** [[MPRGEP:%.+]]) 315537b16e9SGeorge Rokos // CK0-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 316537b16e9SGeorge Rokos // CK0-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 317537b16e9SGeorge Rokos // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%[^,]+]] to i8** 318537b16e9SGeorge Rokos // CK0-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 319537b16e9SGeorge Rokos // CK0-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 320537b16e9SGeorge Rokos // CK0-DAG: [[MPR1:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i[[sz]] 0, i[[sz]] 0 321537b16e9SGeorge Rokos // CK0-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to %class.C** 322537b16e9SGeorge Rokos // CK0-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to %class.C** 323537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL:%[^,]+]], %class.C** [[CBP1]] 324537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL]], %class.C** [[CP1]] 325e4eaf9d8SJoseph Huber // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[MPR1]] 326537b16e9SGeorge Rokos #pragma omp target enter data map(mapper(id),to: c) 327537b16e9SGeorge Rokos 3280661328dSShilei Tian // CK0-DAG: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{[^,]+}}, i32 %{{[^,]+}}, i8* [[TASK_2:%.+]]) 3290661328dSShilei Tian // CK0-DAG: [[TASK_2]] = call i8* @__kmpc_omp_target_task_alloc([[IDENT_T]]* @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i[[sz]] {{40|72}}, i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T_WITH_PRIVATES_4]]*)* [[OMP_TASK_ENTRY_18:@[^,]+]] to i32 (i32, i8*)*), i64 -1) 3300661328dSShilei Tian // CK0-DAG: [[TASK_WITH_PRIVATES:%.+]] = bitcast i8* [[TASK_2]] to [[KMP_TASK_T_WITH_PRIVATES_4]]* 3310661328dSShilei Tian // CK0-DAG: [[PRIVATES:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES_4]], [[KMP_TASK_T_WITH_PRIVATES_4]]* [[TASK_WITH_PRIVATES]], i32 0, i32 1 3320661328dSShilei Tian // CK0-32-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 1 3330661328dSShilei Tian // CK0-64-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 0 3340661328dSShilei Tian // CK0-DAG: [[FPBPADDR:%.+]] = bitcast [1 x i8*]* [[FPBPGEP]] to i8* 3350661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP:%.+]] to i8* 3360661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPBPADDR]], i8* align {{4|8}} [[BPADDR]], i[[sz]] {{4|8}}, i1 false) 3370661328dSShilei Tian // CK0-DAG: [[BPGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0 3380661328dSShilei Tian // CK0-DAG: [[BPGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0 3390661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP]] to %class.C** 3400661328dSShilei Tian // CK0-DAG: store %class.C* [[C:%[^,]+]], %class.C** [[BPADDR]], align 3410661328dSShilei Tian // CK0-32-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 2 3420661328dSShilei Tian // CK0-64-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 1 3430661328dSShilei Tian // CK0-DAG: [[FPPADDR:%.+]] = bitcast [1 x i8*]* [[FPPGEP]] to i8* 3440661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP:%.+]] to i8* 3450661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPPADDR]], i8* align {{4|8}} [[PADDR]], i[[sz]] {{4|8}}, i1 false) 3460661328dSShilei Tian // CK0-DAG: [[PGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0 3470661328dSShilei Tian // CK0-DAG: [[PGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0 3480661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP]] to %class.C** 3490661328dSShilei Tian // CK0-DAG: store %class.C* [[C]], %class.C** [[PADDR]], align 3500661328dSShilei Tian // CK0-32-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 0 3510661328dSShilei Tian // CK0-64-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 2 3520661328dSShilei Tian // CK0-DAG: [[FPSZADDR:%.+]] = bitcast [1 x i64]* [[FPSZGEP]] to i8* 3530661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPSZADDR]], i8* align {{4|8}} bitcast ([1 x i64]* [[EDNWSIZES]] to i8*), i[[sz]] {{4|8}}, i1 false) 3540661328dSShilei Tian // CK0-DAG: [[FPMPRGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 3 3550661328dSShilei Tian // CK0-DAG: [[FPMPRADDR:%.+]] = bitcast [1 x i8*]* [[FPMPRGEP]] to i8* 3560661328dSShilei Tian // CK0-DAG: [[MPRADDR:%.+]] = bitcast i8** [[MPRGEP:%.+]] to i8* 3570661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPMPRADDR]], i8* align {{4|8}} [[MPRADDR]], i[[sz]] {{4|8}}, i1 false) 3580661328dSShilei Tian // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%.+]] to i8** 3590661328dSShilei Tian // CK0-DAG: [[MPRGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPR]], i[[sz]] 0, i[[sz]] 0 360e4eaf9d8SJoseph Huber // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[MPRGEP]], align 361537b16e9SGeorge Rokos #pragma omp target enter data map(mapper(id),to: c) nowait 362537b16e9SGeorge Rokos 363da8bec47SJoseph Huber // CK0-DAG: call void @__tgt_target_data_end_mapper(%struct.ident_t* @{{.+}}, i64 {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[EXDSIZES]]{{.+}}, {{.+}}[[EXDTYPES]]{{.+}}, i8** null, i8** [[MPRGEP:%.+]]) 364537b16e9SGeorge Rokos // CK0-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 365537b16e9SGeorge Rokos // CK0-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 366537b16e9SGeorge Rokos // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%[^,]+]] to i8** 367537b16e9SGeorge Rokos // CK0-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 368537b16e9SGeorge Rokos // CK0-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 369537b16e9SGeorge Rokos // CK0-DAG: [[MPR1:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i[[sz]] 0, i[[sz]] 0 370537b16e9SGeorge Rokos // CK0-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to %class.C** 371537b16e9SGeorge Rokos // CK0-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to %class.C** 372537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL:%[^,]+]], %class.C** [[CBP1]] 373537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL]], %class.C** [[CP1]] 374e4eaf9d8SJoseph Huber // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[MPR1]] 375537b16e9SGeorge Rokos #pragma omp target exit data map(mapper(id),from: c) 376537b16e9SGeorge Rokos 3770661328dSShilei Tian // CK0-DAG: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{[^,]+}}, i32 %{{[^,]+}}, i8* [[TASK_3:%.+]]) 3780661328dSShilei Tian // CK0-DAG: [[TASK_3]] = call i8* @__kmpc_omp_target_task_alloc([[IDENT_T]]* @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i[[sz]] {{40|72}}, i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T_WITH_PRIVATES_7]]*)* [[OMP_TASK_ENTRY_25:@[^,]+]] to i32 (i32, i8*)*), i64 -1) 3790661328dSShilei Tian // CK0-DAG: [[TASK_WITH_PRIVATES:%.+]] = bitcast i8* [[TASK_3]] to [[KMP_TASK_T_WITH_PRIVATES_7]]* 3800661328dSShilei Tian // CK0-DAG: [[PRIVATES:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES_7]], [[KMP_TASK_T_WITH_PRIVATES_7]]* [[TASK_WITH_PRIVATES]], i32 0, i32 1 3810661328dSShilei Tian // CK0-32-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 1 3820661328dSShilei Tian // CK0-64-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 0 3830661328dSShilei Tian // CK0-DAG: [[FPBPADDR:%.+]] = bitcast [1 x i8*]* [[FPBPGEP]] to i8* 3840661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP:%.+]] to i8* 3850661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPBPADDR]], i8* align {{4|8}} [[BPADDR]], i[[sz]] {{4|8}}, i1 false) 3860661328dSShilei Tian // CK0-DAG: [[BPGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0 3870661328dSShilei Tian // CK0-DAG: [[BPGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0 3880661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP]] to %class.C** 3890661328dSShilei Tian // CK0-DAG: store %class.C* [[C:%[^,]+]], %class.C** [[BPADDR]], align 3900661328dSShilei Tian // CK0-32-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 2 3910661328dSShilei Tian // CK0-64-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 1 3920661328dSShilei Tian // CK0-DAG: [[FPPADDR:%.+]] = bitcast [1 x i8*]* [[FPPGEP]] to i8* 3930661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP:%.+]] to i8* 3940661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPPADDR]], i8* align {{4|8}} [[PADDR]], i[[sz]] {{4|8}}, i1 false) 3950661328dSShilei Tian // CK0-DAG: [[PGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0 3960661328dSShilei Tian // CK0-DAG: [[PGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0 3970661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP]] to %class.C** 3980661328dSShilei Tian // CK0-DAG: store %class.C* [[C]], %class.C** [[PADDR]], align 3990661328dSShilei Tian // CK0-32-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 0 4000661328dSShilei Tian // CK0-64-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 2 4010661328dSShilei Tian // CK0-DAG: [[FPSZADDR:%.+]] = bitcast [1 x i64]* [[FPSZGEP]] to i8* 4020661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPSZADDR]], i8* align {{4|8}} bitcast ([1 x i64]* [[EXDNWSIZES]] to i8*), i[[sz]] {{4|8}}, i1 false) 4030661328dSShilei Tian // CK0-DAG: [[FPMPRGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 3 4040661328dSShilei Tian // CK0-DAG: [[FPMPRADDR:%.+]] = bitcast [1 x i8*]* [[FPMPRGEP]] to i8* 4050661328dSShilei Tian // CK0-DAG: [[MPRADDR:%.+]] = bitcast i8** [[MPRGEP:%.+]] to i8* 4060661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPMPRADDR]], i8* align {{4|8}} [[MPRADDR]], i[[sz]] {{4|8}}, i1 false) 4070661328dSShilei Tian // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%.+]] to i8** 4080661328dSShilei Tian // CK0-DAG: [[MPRGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPR]], i[[sz]] 0, i[[sz]] 0 409e4eaf9d8SJoseph Huber // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[MPRGEP]], align 410537b16e9SGeorge Rokos #pragma omp target exit data map(mapper(id),from: c) nowait 411537b16e9SGeorge Rokos 412da8bec47SJoseph Huber // CK0-DAG: call void @__tgt_target_data_update_mapper(%struct.ident_t* @{{.+}}, i64 -1, i32 1, i8** [[TGEPBP:%.+]], i8** [[TGEPP:%.+]], i64* getelementptr {{.+}}[1 x i64]* [[TSIZES]], i32 0, i32 0), {{.+}}getelementptr {{.+}}[1 x i64]* [[TTYPES]]{{.+}}, i8** null, i8** [[TMPRGEP:%.+]]) 413d47b9438SMichael Kruse // CK0-DAG: [[TGEPBP]] = getelementptr inbounds {{.+}}[[TBP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 414d47b9438SMichael Kruse // CK0-DAG: [[TGEPP]] = getelementptr inbounds {{.+}}[[TP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 415537b16e9SGeorge Rokos // CK0-DAG: [[TMPRGEP]] = bitcast [1 x i8*]* [[TMPR:%[^,]+]] to i8** 416d47b9438SMichael Kruse // CK0-DAG: [[TBP0:%.+]] = getelementptr inbounds {{.+}}[[TBP]], i{{.+}} 0, i{{.+}} 0 417d47b9438SMichael Kruse // CK0-DAG: [[TP0:%.+]] = getelementptr inbounds {{.+}}[[TP]], i{{.+}} 0, i{{.+}} 0 418537b16e9SGeorge Rokos // CK0-DAG: [[TMPR1:%.+]] = getelementptr inbounds {{.+}}[[TMPR]], i[[sz]] 0, i[[sz]] 0 419d47b9438SMichael Kruse // CK0-DAG: [[TCBP0:%.+]] = bitcast i8** [[TBP0]] to %class.C** 420d47b9438SMichael Kruse // CK0-DAG: [[TCP0:%.+]] = bitcast i8** [[TP0]] to %class.C** 421d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL]], %class.C** [[TCBP0]] 422d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL]], %class.C** [[TCP0]] 423e4eaf9d8SJoseph Huber // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[TMPR1]] 42401f670dfSMichael Kruse #pragma omp target update to(mapper(id): c) 4250336c75cSMichael Kruse 426da8bec47SJoseph Huber // CK0-DAG: call void @__tgt_target_data_update_mapper(%struct.ident_t* @{{.+}}, i64 -1, i32 1, i8** [[FGEPBP:%.+]], i8** [[FGEPP:%.+]], i64* getelementptr {{.+}}[1 x i64]* [[FSIZES]], i32 0, i32 0), {{.+}}getelementptr {{.+}}[1 x i64]* [[FTYPES]]{{.+}}, i8** null, i8** [[FMPRGEP:%.+]]) 427d47b9438SMichael Kruse // CK0-DAG: [[FGEPBP]] = getelementptr inbounds {{.+}}[[FBP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 428d47b9438SMichael Kruse // CK0-DAG: [[FGEPP]] = getelementptr inbounds {{.+}}[[FP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 429537b16e9SGeorge Rokos // CK0-DAG: [[FMPRGEP]] = bitcast [1 x i8*]* [[FMPR:%[^,]+]] to i8** 430d47b9438SMichael Kruse // CK0-DAG: [[FBP0:%.+]] = getelementptr inbounds {{.+}}[[FBP]], i{{.+}} 0, i{{.+}} 0 431d47b9438SMichael Kruse // CK0-DAG: [[FP0:%.+]] = getelementptr inbounds {{.+}}[[FP]], i{{.+}} 0, i{{.+}} 0 432537b16e9SGeorge Rokos // CK0-DAG: [[FMPR1:%.+]] = getelementptr inbounds {{.+}}[[FMPR]], i[[sz]] 0, i[[sz]] 0 433d47b9438SMichael Kruse // CK0-DAG: [[FCBP0:%.+]] = bitcast i8** [[FBP0]] to %class.C** 434d47b9438SMichael Kruse // CK0-DAG: [[FCP0:%.+]] = bitcast i8** [[FP0]] to %class.C** 435d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL]], %class.C** [[FCBP0]] 436d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL]], %class.C** [[FCP0]] 437e4eaf9d8SJoseph Huber // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[FMPR1]] 4380336c75cSMichael Kruse #pragma omp target update from(mapper(id): c) 439537b16e9SGeorge Rokos 4400661328dSShilei Tian // CK0-DAG: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{[^,]+}}, i32 %{{[^,]+}}, i8* [[TASK_4:%.+]]) 4410661328dSShilei Tian // CK0-DAG: [[TASK_4]] = call i8* @__kmpc_omp_target_task_alloc([[IDENT_T]]* @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i[[sz]] {{40|72}}, i[[sz]] 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T_WITH_PRIVATES_10]]*)* [[OMP_TASK_ENTRY_34:@[^,]+]] to i32 (i32, i8*)*), i64 -1) 4420661328dSShilei Tian // CK0-DAG: [[TASK_WITH_PRIVATES:%.+]] = bitcast i8* [[TASK_4]] to [[KMP_TASK_T_WITH_PRIVATES_10]]* 4430661328dSShilei Tian // CK0-DAG: [[PRIVATES:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES_10]], [[KMP_TASK_T_WITH_PRIVATES_10]]* [[TASK_WITH_PRIVATES]], i32 0, i32 1 4440661328dSShilei Tian // CK0-32-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 1 4450661328dSShilei Tian // CK0-64-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 0 4460661328dSShilei Tian // CK0-DAG: [[FPBPADDR:%.+]] = bitcast [1 x i8*]* [[FPBPGEP]] to i8* 4470661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP:%.+]] to i8* 4480661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPBPADDR]], i8* align {{4|8}} [[BPADDR]], i[[sz]] {{4|8}}, i1 false) 4490661328dSShilei Tian // CK0-DAG: [[BPGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0 4500661328dSShilei Tian // CK0-DAG: [[BPGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0 4510661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP]] to %class.C** 4520661328dSShilei Tian // CK0-DAG: store %class.C* [[C:%[^,]+]], %class.C** [[BPADDR]], align 4530661328dSShilei Tian // CK0-32-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 2 4540661328dSShilei Tian // CK0-64-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 1 4550661328dSShilei Tian // CK0-DAG: [[FPPADDR:%.+]] = bitcast [1 x i8*]* [[FPPGEP]] to i8* 4560661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP:%.+]] to i8* 4570661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPPADDR]], i8* align {{4|8}} [[PADDR]], i[[sz]] {{4|8}}, i1 false) 4580661328dSShilei Tian // CK0-DAG: [[PGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0 4590661328dSShilei Tian // CK0-DAG: [[PGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0 4600661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP]] to %class.C** 4610661328dSShilei Tian // CK0-DAG: store %class.C* [[C]], %class.C** [[PADDR]], align 4620661328dSShilei Tian // CK0-32-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 0 4630661328dSShilei Tian // CK0-64-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 2 4640661328dSShilei Tian // CK0-DAG: [[FPSZADDR:%.+]] = bitcast [1 x i64]* [[FPSZGEP]] to i8* 4650661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPSZADDR]], i8* align {{4|8}} bitcast ([1 x i64]* [[FNWSIZES]] to i8*), i[[sz]] {{4|8}}, i1 false) 4660661328dSShilei Tian // CK0-DAG: [[FPMPRGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 3 4670661328dSShilei Tian // CK0-DAG: [[FPMPRADDR:%.+]] = bitcast [1 x i8*]* [[FPMPRGEP]] to i8* 4680661328dSShilei Tian // CK0-DAG: [[MPRADDR:%.+]] = bitcast i8** [[MPRGEP:%.+]] to i8* 4690661328dSShilei Tian // CK0-DAG: call void @llvm.memcpy.p0i8.p0i8.i[[sz]](i8* align {{4|8}} [[FPMPRADDR]], i8* align {{4|8}} [[MPRADDR]], i[[sz]] {{4|8}}, i1 false) 4700661328dSShilei Tian // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%.+]] to i8** 4710661328dSShilei Tian // CK0-DAG: [[MPRGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPR]], i[[sz]] 0, i[[sz]] 0 472e4eaf9d8SJoseph Huber // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[MPRGEP]], align 473537b16e9SGeorge Rokos #pragma omp target update from(mapper(id): c) nowait 4744304e9d1SMichael Kruse } 4754304e9d1SMichael Kruse 4764304e9d1SMichael Kruse 477ebb1092aSShilei Tian // CK0: define internal void [[KERNEL_1]](%class.C* {{.+}}[[ARG:%.+]]) 478d47b9438SMichael Kruse // CK0: [[ADDR:%.+]] = alloca %class.C*, 479d47b9438SMichael Kruse // CK0: store %class.C* [[ARG]], %class.C** [[ADDR]] 480d47b9438SMichael Kruse // CK0: [[CADDR:%.+]] = load %class.C*, %class.C** [[ADDR]] 481d47b9438SMichael Kruse // CK0: [[CAADDR:%.+]] = getelementptr inbounds %class.C, %class.C* [[CADDR]], i32 0, i32 0 482d47b9438SMichael Kruse // CK0: [[VAL:%[^,]+]] = load i32, i32* [[CAADDR]] 483d47b9438SMichael Kruse // CK0: {{.+}} = add nsw i32 [[VAL]], 1 484d47b9438SMichael Kruse // CK0: } 485d47b9438SMichael Kruse 486ebb1092aSShilei Tian // CK0: define internal void [[KERNEL_2:@.+]](%class.C* {{.+}}[[ARG:%.+]]) 487ebb1092aSShilei Tian // CK0: [[ADDR:%.+]] = alloca %class.C*, 488ebb1092aSShilei Tian // CK0: store %class.C* [[ARG]], %class.C** [[ADDR]] 489ebb1092aSShilei Tian // CK0: [[CADDR:%.+]] = load %class.C*, %class.C** [[ADDR]] 490ebb1092aSShilei Tian // CK0: [[CAADDR:%.+]] = getelementptr inbounds %class.C, %class.C* [[CADDR]], i32 0, i32 0 491ebb1092aSShilei Tian // CK0: [[VAL:%[^,]+]] = load i32, i32* [[CAADDR]] 492ebb1092aSShilei Tian // CK0: {{.+}} = add nsw i32 [[VAL]], 1 493ebb1092aSShilei Tian // CK0: } 494ebb1092aSShilei Tian 4951b1c8d83Shyeongyu kim // CK0: define internal void [[OUTLINED:@.+]](i32 {{.*}}{{[^,]+}}, [[ANON_T]]* noalias noundef [[CTXARG:%.+]]) 496b88a68c4SAlexey Bataev // CK0-DAG: call i32 @__tgt_target_nowait_mapper(%struct.ident_t* @{{.+}}, i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZEGEP:%[0-9]+]], {{.+}}[[NWTYPES]]{{.+}}, i8** null, i8** [[MPRGEP:%.+]], i32 0, i8* null, i32 0, i8* null) 497ebb1092aSShilei Tian // CK0-DAG: [[BPGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 498ebb1092aSShilei Tian // CK0-DAG: [[PGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 499ebb1092aSShilei Tian // CK0-DAG: [[SIZEGEP]] = getelementptr inbounds [1 x i64], [1 x i64]* [[SIZEFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 500ebb1092aSShilei Tian // CK0-DAG: [[MPRGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPRFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 501ebb1092aSShilei Tian // CK0-DAG: [[BPFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_BP:%.+]], align 502ebb1092aSShilei Tian // CK0-DAG: [[PFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_P:%.+]], align 503ebb1092aSShilei Tian // CK0-DAG: [[SIZEFPADDR]] = load [1 x i64]*, [1 x i64]** [[FPPTRADDR_SIZE:%.+]], align 504ebb1092aSShilei Tian // CK0-DAG: [[MPRFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_MPR:%.+]], align 505a28e835eSAlexey Bataev // CK0-DAG: [[FN:%.+]] = bitcast void (i8*, ...)* %1 to void (i8*, [1 x i8*]**, [1 x i8*]**, [1 x i64]**, [1 x i8*]**)* 506a28e835eSAlexey Bataev // CK0-DAG: call void [[FN]](i8* %2, {{.+}}[[FPPTRADDR_BP]], {{.+}}[[FPPTRADDR_P]], {{.+}}[[FPPTRADDR_SIZE]], {{.+}}[[FPPTRADDR_MPR]]) 507ebb1092aSShilei Tian // CK0-DAG: call void [[KERNEL_2:@.+]](%class.C* [[KERNELARG:%.+]]) 508ebb1092aSShilei Tian // CK0-DAG: [[KERNELARG]] = load %class.C*, %class.C** [[KERNELARGGEP:%.+]], align 509ebb1092aSShilei Tian // CK0-DAG: [[KERNELARGGEP]] = getelementptr inbounds [[ANON_T]], [[ANON_T]]* [[CTX:%.+]], i32 0, i32 0 510ebb1092aSShilei Tian // CK0-DAG: [[CTX]] = load [[ANON_T]]*, [[ANON_T]]** [[CTXADDR:%.+]], align 511ebb1092aSShilei Tian // CK0-DAG: store [[ANON_T]]* [[CTXARG]], [[ANON_T]]** [[CTXADDR]], align 512ebb1092aSShilei Tian // CK0: } 513ebb1092aSShilei Tian 5141b1c8d83Shyeongyu kim // CK0: define internal {{.*}}i32 [[TASK_ENTRY]](i32 {{.*}}%0, [[KMP_TASK_T_WITH_PRIVATES]]* noalias noundef %1) 515ebb1092aSShilei Tian // CK0: store [[KMP_TASK_T_WITH_PRIVATES]]* %1, [[KMP_TASK_T_WITH_PRIVATES]]** [[ADDR:%.+]], align 516ebb1092aSShilei Tian // CK0: [[TASK_T_WITH_PRIVATES:%.+]] = load [[KMP_TASK_T_WITH_PRIVATES]]*, [[KMP_TASK_T_WITH_PRIVATES]]** [[ADDR]], align 517ebb1092aSShilei Tian // CK0: [[TASKGEP:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES]], [[KMP_TASK_T_WITH_PRIVATES]]* [[TASK_T_WITH_PRIVATES]], i32 0, i32 0 518ebb1092aSShilei Tian // CK0: [[SHAREDSGEP:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASKGEP]], i32 0, i32 0 519ebb1092aSShilei Tian // CK0: [[SHAREDS:%.+]] = load i8*, i8** [[SHAREDSGEP]], align 520ebb1092aSShilei Tian // CK0: [[ANON:%.+]] = bitcast i8* [[SHAREDS]] to [[ANON_T]]* 521ebb1092aSShilei Tian // CK0: [[PRIVATESGEP:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES]], [[KMP_TASK_T_WITH_PRIVATES]]* [[TASK_T_WITH_PRIVATES]], i32 0, i32 1 522ebb1092aSShilei Tian // CK0: [[PRIVATES:%.+]] = bitcast [[KMP_PRIVATES_T]]* [[PRIVATESGEP]] to i8* 523ebb1092aSShilei Tian // CK0: [[TASK_WITH_PRIVATES:%.+]] = bitcast [[KMP_TASK_T_WITH_PRIVATES]]* [[TASK_T_WITH_PRIVATES]] to i8* 524ebb1092aSShilei Tian // CK0: call void [[OUTLINED]](i32 {{%.+}}, i32* {{%.+}}, i8* [[PRIVATES]], {{.+}}, i8* [[TASK_WITH_PRIVATES]], [[ANON_T]]* [[ANON]]) 525ebb1092aSShilei Tian // CK0: } 526ebb1092aSShilei Tian 5271b1c8d83Shyeongyu kim // CK0: define internal void [[OUTLINE_1:@.+]](i32 {{.*}}%.global_tid.{{.+}}, [[ANON_T_0]]* noalias noundef [[CTXARG:%.+]]) 528b88a68c4SAlexey Bataev // CK0-DAG: call i32 @__tgt_target_teams_nowait_mapper(%struct.ident_t* @{{.+}}, i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SIZEGEP:%[0-9]+]], {{.+}}[[TEAMNWTYPES]]{{.+}}, i8** null, i8** [[MPRGEP:%.+]], i32 0, i32 0, i32 0, i8* null, i32 0, i8* null) 529ebb1092aSShilei Tian // CK0-DAG: [[BPGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 530ebb1092aSShilei Tian // CK0-DAG: [[PGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 531ebb1092aSShilei Tian // CK0-DAG: [[SIZEGEP]] = getelementptr inbounds [1 x i64], [1 x i64]* [[SIZEFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 532ebb1092aSShilei Tian // CK0-DAG: [[MPRGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPRFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 533ebb1092aSShilei Tian // CK0-DAG: [[BPFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_BP:%.+]], align 534ebb1092aSShilei Tian // CK0-DAG: [[PFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_P:%.+]], align 535ebb1092aSShilei Tian // CK0-DAG: [[SIZEFPADDR]] = load [1 x i64]*, [1 x i64]** [[FPPTRADDR_SIZE:%.+]], align 536ebb1092aSShilei Tian // CK0-DAG: [[MPRFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_MPR:%.+]], align 537a28e835eSAlexey Bataev // CK0-DAG: [[FN:%.+]] = bitcast void (i8*, ...)* %1 to void (i8*, 538a28e835eSAlexey Bataev // CK0-DAG: call void [[FN]](i8* %2, {{.+}}[[FPPTRADDR_BP]], {{.+}}[[FPPTRADDR_P]], {{.+}}[[FPPTRADDR_SIZE]], {{.+}}[[FPPTRADDR_MPR]]) 539ebb1092aSShilei Tian // CK0-DAG: call void [[KERNEL_2:@.+]](%class.C* [[KERNELARG:%.+]]) 540ebb1092aSShilei Tian // CK0-DAG: [[KERNELARG]] = load %class.C*, %class.C** [[KERNELARGGEP:%.+]], align 541ebb1092aSShilei Tian // CK0-DAG: [[KERNELARGGEP]] = getelementptr inbounds [[ANON_T_0]], [[ANON_T_0]]* [[CTX:%.+]], i32 0, i32 0 542ebb1092aSShilei Tian // CK0-DAG: [[CTX]] = load [[ANON_T_0]]*, [[ANON_T_0]]** [[CTXADDR:%.+]], align 543ebb1092aSShilei Tian // CK0-DAG: store [[ANON_T_0]]* [[CTXARG]], [[ANON_T_0]]** [[CTXADDR]], align 544ebb1092aSShilei Tian // CK0: } 545ebb1092aSShilei Tian 5461b1c8d83Shyeongyu kim // CK0: define internal {{.*}}i32 [[TASK_ENTRY_1]](i32 {{.*}}%0, [[KMP_TASK_T_WITH_PRIVATES_1]]* noalias noundef %1) 547ebb1092aSShilei Tian // CK0: store [[KMP_TASK_T_WITH_PRIVATES_1]]* %1, [[KMP_TASK_T_WITH_PRIVATES_1]]** [[ADDR:%.+]], align 548ebb1092aSShilei Tian // CK0: [[TASK_T_WITH_PRIVATES:%.+]] = load [[KMP_TASK_T_WITH_PRIVATES_1]]*, [[KMP_TASK_T_WITH_PRIVATES_1]]** [[ADDR]], align 549ebb1092aSShilei Tian // CK0: [[TASKGEP:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES_1]], [[KMP_TASK_T_WITH_PRIVATES_1]]* [[TASK_T_WITH_PRIVATES]], i32 0, i32 0 550ebb1092aSShilei Tian // CK0: [[SHAREDSGEP:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASKGEP]], i32 0, i32 0 551ebb1092aSShilei Tian // CK0: [[SHAREDS:%.+]] = load i8*, i8** [[SHAREDSGEP]], align 552ebb1092aSShilei Tian // CK0: [[ANON:%.+]] = bitcast i8* [[SHAREDS]] to [[ANON_T_0]]* 553ebb1092aSShilei Tian // CK0: [[PRIVATESGEP:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES_1]], [[KMP_TASK_T_WITH_PRIVATES_1]]* [[TASK_T_WITH_PRIVATES]], i32 0, i32 1 554ebb1092aSShilei Tian // CK0: [[PRIVATES:%.+]] = bitcast [[KMP_PRIVATES_T_2]]* [[PRIVATESGEP]] to i8* 555ebb1092aSShilei Tian // CK0: [[TASK_WITH_PRIVATES:%.+]] = bitcast [[KMP_TASK_T_WITH_PRIVATES_1]]* [[TASK_T_WITH_PRIVATES]] to i8* 556ebb1092aSShilei Tian // CK0: call void [[OUTLINE_1]](i32 {{%.+}}, i32* {{%.+}}, i8* [[PRIVATES]], {{.+}}, i8* [[TASK_WITH_PRIVATES]], [[ANON_T_0]]* [[ANON]]) 557ebb1092aSShilei Tian // CK0: } 558ebb1092aSShilei Tian 5591b1c8d83Shyeongyu kim // CK0: define internal void [[OMP_OUTLINED_16:@.+]](i32{{.*}} %{{[^,]+}}, i32* noalias noundef %{{[^,]+}}, i8* noalias noundef %{{[^,]+}} 560da8bec47SJoseph Huber // CK0-DAG: call void @__tgt_target_data_begin_nowait_mapper(%struct.ident_t* @{{.+}}, i64 -1, i32 1, i8** [[BP:%[^,]+]], i8** [[P:%[^,]+]], i64* [[SZ:%[^,]+]], i64* getelementptr inbounds ([1 x i64], [1 x i64]* [[EDNWTYPES]], i32 0, i32 0), i8** null, i8** [[MPR:%.+]]) 5610661328dSShilei Tian // CK0-DAG: [[BP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 5620661328dSShilei Tian // CK0-DAG: [[P]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 5630661328dSShilei Tian // CK0-DAG: [[SZ]] = getelementptr inbounds [1 x i64], [1 x i64]* [[SZADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 5640661328dSShilei Tian // CK0-DAG: [[MPR]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPRADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 5650661328dSShilei Tian // CK0-DAG: [[BPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPBPADDR:%[^,]+]], align 5660661328dSShilei Tian // CK0-DAG: [[PADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPADDR:%[^,]+]], align 5670661328dSShilei Tian // CK0-DAG: [[SZADDR]] = load [1 x i64]*, [1 x i64]** [[FPSZADDR:%[^,]+]], align 5680661328dSShilei Tian // CK0-DAG: [[MPRADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPMPRADDR:%[^,]+]], align 569a28e835eSAlexey Bataev // CK0-DAG: [[FN:%.+]] = bitcast void (i8*, ...)* %{{.+}} to void (i8*, 570a28e835eSAlexey Bataev // CK0-DAG: call void [[FN]](i8* %{{[^,]+}}, [1 x i8*]** [[FPBPADDR]], [1 x i8*]** [[FPPADDR]], [1 x i64]** [[FPSZADDR]], [1 x i8*]** [[FPMPRADDR]]) 5710661328dSShilei Tian // CK0: ret void 5720661328dSShilei Tian // CK0: } 5730661328dSShilei Tian 5741b1c8d83Shyeongyu kim // CK0: define internal {{.*}}i32 [[OMP_TASK_ENTRY_18]](i32 {{.*}}%{{[^,]+}}, [[KMP_TASK_T_WITH_PRIVATES_4]]* noalias noundef %{{[^,]+}}) 5750661328dSShilei Tian // CK0: call void [[OMP_OUTLINED_16]] 5760661328dSShilei Tian // CK0: ret i32 0 5770661328dSShilei Tian // CK0: } 5780661328dSShilei Tian 5791b1c8d83Shyeongyu kim // CK0: define internal void [[OMP_OUTLINED_23:@.+]](i32{{.*}} %{{[^,]+}}, i32* noalias noundef %{{[^,]+}}, i8* noalias noundef %{{[^,]+}} 580da8bec47SJoseph Huber // CK0-DAG: call void @__tgt_target_data_end_nowait_mapper(%struct.ident_t* @{{.+}}, i64 -1, i32 1, i8** [[BP:%[^,]+]], i8** [[P:%[^,]+]], i64* [[SZ:%[^,]+]], i64* getelementptr inbounds ([1 x i64], [1 x i64]* [[EXDNWTYPES]], i32 0, i32 0), i8** null, i8** [[MPR:%.+]]) 5810661328dSShilei Tian // CK0-DAG: [[BP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 5820661328dSShilei Tian // CK0-DAG: [[P]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 5830661328dSShilei Tian // CK0-DAG: [[SZ]] = getelementptr inbounds [1 x i64], [1 x i64]* [[SZADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 5840661328dSShilei Tian // CK0-DAG: [[MPR]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPRADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 5850661328dSShilei Tian // CK0-DAG: [[BPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPBPADDR:%[^,]+]], align 5860661328dSShilei Tian // CK0-DAG: [[PADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPADDR:%[^,]+]], align 5870661328dSShilei Tian // CK0-DAG: [[SZADDR]] = load [1 x i64]*, [1 x i64]** [[FPSZADDR:%[^,]+]], align 5880661328dSShilei Tian // CK0-DAG: [[MPRADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPMPRADDR:%[^,]+]], align 589a28e835eSAlexey Bataev // CK0-DAG: [[FN:%.+]] = bitcast void (i8*, ...)* %{{.+}} to void (i8*, 590a28e835eSAlexey Bataev // CK0-DAG: call void [[FN]](i8* %{{[^,]+}}, [1 x i8*]** [[FPBPADDR]], [1 x i8*]** [[FPPADDR]], [1 x i64]** [[FPSZADDR]], [1 x i8*]** [[FPMPRADDR]]) 5910661328dSShilei Tian // CK0: } 5920661328dSShilei Tian 5931b1c8d83Shyeongyu kim // CK0: define internal {{.*}}i32 [[OMP_TASK_ENTRY_25]](i32 {{.*}}%{{[^,]+}}, [[KMP_TASK_T_WITH_PRIVATES_7]]* noalias noundef %{{[^,]+}}) 5940661328dSShilei Tian // CK0: call void [[OMP_OUTLINED_23]] 5950661328dSShilei Tian // CK0: ret i32 0 5960661328dSShilei Tian // CK0: } 5970661328dSShilei Tian 5981b1c8d83Shyeongyu kim // CK0: define internal void [[OMP_OUTLINED_32:@.+]](i32{{.*}} %{{[^,]+}}, i32* noalias noundef %{{[^,]+}}, i8* noalias noundef %{{[^,]+}} 599da8bec47SJoseph Huber // CK0-DAG: call void @__tgt_target_data_update_nowait_mapper(%struct.ident_t* @{{.+}}, i64 -1, i32 1, i8** [[BP:%[^,]+]], i8** [[P:%[^,]+]], i64* [[SZ:%[^,]+]], i64* getelementptr inbounds ([1 x i64], [1 x i64]* [[FNWTYPES]], i32 0, i32 0), i8** null, i8** [[MPR:%.+]]) 6000661328dSShilei Tian // CK0-DAG: [[BP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 6010661328dSShilei Tian // CK0-DAG: [[P]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 6020661328dSShilei Tian // CK0-DAG: [[SZ]] = getelementptr inbounds [1 x i64], [1 x i64]* [[SZADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 6030661328dSShilei Tian // CK0-DAG: [[MPR]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPRADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 6040661328dSShilei Tian // CK0-DAG: [[BPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPBPADDR:%[^,]+]], align 6050661328dSShilei Tian // CK0-DAG: [[PADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPADDR:%[^,]+]], align 6060661328dSShilei Tian // CK0-DAG: [[SZADDR]] = load [1 x i64]*, [1 x i64]** [[FPSZADDR:%[^,]+]], align 6070661328dSShilei Tian // CK0-DAG: [[MPRADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPMPRADDR:%[^,]+]], align 608a28e835eSAlexey Bataev // CK0-DAG: [[FN:%.+]] = bitcast void (i8*, ...)* %{{.+}} to void (i8*, 609a28e835eSAlexey Bataev // CK0-DAG: call void [[FN]](i8* %{{[^,]+}}, [1 x i8*]** [[FPBPADDR]], [1 x i8*]** [[FPPADDR]], [1 x i64]** [[FPSZADDR]], [1 x i8*]** [[FPMPRADDR]]) 6100661328dSShilei Tian // CK0: } 6110661328dSShilei Tian 6121b1c8d83Shyeongyu kim // CK0: define internal {{.*}}i32 [[OMP_TASK_ENTRY_34]](i32 {{.*}}%{{[^,]+}}, [[KMP_TASK_T_WITH_PRIVATES_10]]* noalias noundef %{{[^,]+}}) 6130661328dSShilei Tian // CK0: call void [[OMP_OUTLINED_32]] 6140661328dSShilei Tian // CK0: ret i32 0 6150661328dSShilei Tian // CK0: } 6160661328dSShilei Tian 617537b16e9SGeorge Rokos #endif // CK0 618d47b9438SMichael Kruse 619d47b9438SMichael Kruse 620d47b9438SMichael Kruse ///==========================================================================/// 621*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix CK1 --check-prefix CK1-64 %s 622*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 623*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix CK1 --check-prefix CK1-64 %s 624*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix CK1 --check-prefix CK1-32 %s 625*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 626*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix CK1 --check-prefix CK1-32 %s 627d47b9438SMichael Kruse 628*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s 629*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 630*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s 631*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s 632*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 633*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s 634d47b9438SMichael Kruse 635d47b9438SMichael Kruse #ifdef CK1 636537b16e9SGeorge Rokos // C++ template 637d47b9438SMichael Kruse 638d47b9438SMichael Kruse template <class T> 639d47b9438SMichael Kruse class C { 640d47b9438SMichael Kruse public: 641d47b9438SMichael Kruse T a; 642d47b9438SMichael Kruse }; 643d47b9438SMichael Kruse 644d47b9438SMichael Kruse #pragma omp declare mapper(id: C<int> s) map(s.a) 645d47b9438SMichael Kruse 646e4eaf9d8SJoseph Huber // CK1-LABEL: define {{.*}}void @.omp_mapper.{{.*}}C{{.*}}.id{{.*}}(i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}, i8*{{.*}}) 647d47b9438SMichael Kruse // CK1: store i8* %{{[^,]+}}, i8** [[HANDLEADDR:%[^,]+]] 648d47b9438SMichael Kruse // CK1: store i8* %{{[^,]+}}, i8** [[BPTRADDR:%[^,]+]] 649d47b9438SMichael Kruse // CK1: store i8* %{{[^,]+}}, i8** [[VPTRADDR:%[^,]+]] 650d47b9438SMichael Kruse // CK1: store i64 %{{[^,]+}}, i{{64|32}}* [[SIZEADDR:%[^,]+]] 651d47b9438SMichael Kruse // CK1: store i64 %{{[^,]+}}, i64* [[TYPEADDR:%[^,]+]] 652537b16e9SGeorge Rokos // CK1-DAG: [[BYTESIZE:%.+]] = load i64, i64* [[SIZEADDR]] 653537b16e9SGeorge Rokos // CK1-DAG: [[SIZE:%.+]] = udiv exact i64 [[BYTESIZE]], 4 654d47b9438SMichael Kruse // CK1-DAG: [[TYPE:%.+]] = load i64, i64* [[TYPEADDR]] 655d47b9438SMichael Kruse // CK1-DAG: [[HANDLE:%.+]] = load i8*, i8** [[HANDLEADDR]] 656d47b9438SMichael Kruse // CK1-DAG: [[BPTR:%.+]] = load i8*, i8** [[BPTRADDR]] 657d47b9438SMichael Kruse // CK1-DAG: [[BEGIN:%.+]] = load i8*, i8** [[VPTRADDR]] 65860d71a28SAlexey Bataev // CK1-DAG: [[PTRBEGIN:%.+]] = bitcast i8* [[BEGIN]] to %class.C* 65960d71a28SAlexey Bataev // CK1-DAG: [[PTREND:%.+]] = getelementptr %class.C, %class.C* [[PTRBEGIN]], i64 [[SIZE]] 66060d71a28SAlexey Bataev // CK1-DAG: [[ISARRAY:%.+]] = icmp sgt i64 [[SIZE]], 1 661caff8591SNikita Popov // CK1-DAG: [[PTRSNE:%.+]] = icmp ne i8* [[BPTR]], [[BEGIN]] 6620caf736dSAlexey Bataev // CK1-DAG: [[PTRANDOBJ:%.+]] = and i64 [[TYPE]], 16 6630caf736dSAlexey Bataev // CK1-DAG: [[ISPTRANDOBJ:%.+]] = icmp ne i64 [[PTRANDOBJ]], 0 6640caf736dSAlexey Bataev // CK1-DAG: [[CMPA:%.+]] = and i1 [[PTRSNE]], [[ISPTRANDOBJ]] 6650caf736dSAlexey Bataev // CK1-DAG: [[CMP:%.+]] = or i1 [[ISARRAY]], [[CMPA]] 66660d71a28SAlexey Bataev // CK1-DAG: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 66760d71a28SAlexey Bataev // CK1-DAG: [[ISNOTDEL:%.+]] = icmp eq i64 [[TYPEDEL]], 0 66860d71a28SAlexey Bataev // CK1-DAG: [[CMP1:%.+]] = and i1 [[CMP]], [[ISNOTDEL]] 66960d71a28SAlexey Bataev // CK1: br i1 [[CMP1]], label %[[INITEVALDEL:[^,]+]], label %[[LHEAD:[^,]+]] 670d47b9438SMichael Kruse 671d47b9438SMichael Kruse // CK1: [[INITEVALDEL]] 672d47b9438SMichael Kruse // CK1-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 4 67307988422SAlexey Bataev 67407988422SAlexey Bataev // Remove movement mappings and mark as implicit 67507988422SAlexey Bataev // CK1-DAG: [[ITYPE:%.+]] = and i64 [[TYPE]], -4 67607988422SAlexey Bataev // CK1-DAG: [[ITYPE1:%.+]] = or i64 [[ITYPE]], 512 67707988422SAlexey Bataev // CK1: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[ITYPE1]], {{.*}}) 678d47b9438SMichael Kruse // CK1: br label %[[LHEAD:[^,]+]] 679d47b9438SMichael Kruse 680d47b9438SMichael Kruse // CK1: [[LHEAD]] 68160d71a28SAlexey Bataev // CK1: [[ISEMPTY:%.+]] = icmp eq %class.C* [[PTRBEGIN]], [[PTREND]] 682d47b9438SMichael Kruse // CK1: br i1 [[ISEMPTY]], label %[[DONE:[^,]+]], label %[[LBODY:[^,]+]] 683d47b9438SMichael Kruse // CK1: [[LBODY]] 68460d71a28SAlexey Bataev // CK1: [[PTR:%.+]] = phi %class.C* [ [[PTRBEGIN]], %{{.+}} ], [ [[PTRNEXT:%.+]], %[[LCORRECT:[^,]+]] ] 68560d71a28SAlexey Bataev // CK1-DAG: [[ABEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[PTR]], i32 0, i32 0 686d47b9438SMichael Kruse // CK1-DAG: [[PRESIZE:%.+]] = call i64 @__tgt_mapper_num_components(i8* [[HANDLE]]) 687d47b9438SMichael Kruse // CK1-DAG: [[SHIPRESIZE:%.+]] = shl i64 [[PRESIZE]], 48 68860d71a28SAlexey Bataev // CK1-DAG: [[BPTRADDR1BC:%.+]] = bitcast %class.C* [[PTR]] to i8* 689d47b9438SMichael Kruse // CK1-DAG: [[PTRADDR1BC:%.+]] = bitcast i32* [[ABEGIN]] to i8* 69060d71a28SAlexey Bataev // CK1-DAG: [[MEMBERTYPE:%.+]] = add nuw i64 3, [[SHIPRESIZE]] 691d47b9438SMichael Kruse // CK1-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 692d47b9438SMichael Kruse // CK1-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 693d47b9438SMichael Kruse // CK1-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 694d47b9438SMichael Kruse // CK1-DAG: [[ALLOC]] 695d47b9438SMichael Kruse // CK1-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 696d47b9438SMichael Kruse // CK1-DAG: br label %[[TYEND:[^,]+]] 697d47b9438SMichael Kruse // CK1-DAG: [[ALLOCELSE]] 698d47b9438SMichael Kruse // CK1-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 699d47b9438SMichael Kruse // CK1-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 700d47b9438SMichael Kruse // CK1-DAG: [[TO]] 701d47b9438SMichael Kruse // CK1-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 702d47b9438SMichael Kruse // CK1-DAG: br label %[[TYEND]] 703d47b9438SMichael Kruse // CK1-DAG: [[TOELSE]] 704d47b9438SMichael Kruse // CK1-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 705d47b9438SMichael Kruse // CK1-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 706d47b9438SMichael Kruse // CK1-DAG: [[FROM]] 707d47b9438SMichael Kruse // CK1-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 708d47b9438SMichael Kruse // CK1-DAG: br label %[[TYEND]] 709d47b9438SMichael Kruse // CK1-DAG: [[TYEND]] 710d47b9438SMichael Kruse // CK1-DAG: [[TYPE1:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 711e4eaf9d8SJoseph Huber // CK1: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR1BC]], i8* [[PTRADDR1BC]], i64 4, i64 [[TYPE1]], {{.*}}) 71260d71a28SAlexey Bataev // CK1: [[PTRNEXT]] = getelementptr %class.C, %class.C* [[PTR]], i32 1 71360d71a28SAlexey Bataev // CK1: [[ISDONE:%.+]] = icmp eq %class.C* [[PTRNEXT]], [[PTREND]] 714d47b9438SMichael Kruse // CK1: br i1 [[ISDONE]], label %[[LEXIT:[^,]+]], label %[[LBODY]] 715d47b9438SMichael Kruse 716d47b9438SMichael Kruse // CK1: [[LEXIT]] 71760d71a28SAlexey Bataev // CK1: [[ISARRAY:%.+]] = icmp sgt i64 [[SIZE]], 1 718d47b9438SMichael Kruse // CK1: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 71960d71a28SAlexey Bataev // CK1: [[ISNOTDEL:%.+]] = icmp ne i64 [[TYPEDEL]], 0 7200caf736dSAlexey Bataev // CK1: [[CMP1:%.+]] = and i1 [[ISARRAY]], [[ISNOTDEL]] 721d47b9438SMichael Kruse // CK1-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 4 72207988422SAlexey Bataev 72307988422SAlexey Bataev // Remove movement mappings and mark as implicit 72407988422SAlexey Bataev // CK1-DAG: [[DTYPE:%.+]] = and i64 [[TYPE]], -4 72507988422SAlexey Bataev // CK1-DAG: [[DTYPE1:%.+]] = or i64 [[DTYPE]], 512 72607988422SAlexey Bataev // CK1: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[DTYPE1]], {{.*}}) 727d47b9438SMichael Kruse // CK1: br label %[[DONE]] 728d47b9438SMichael Kruse // CK1: [[DONE]] 729d47b9438SMichael Kruse // CK1: ret void 730d47b9438SMichael Kruse 731537b16e9SGeorge Rokos #endif // CK1 7324304e9d1SMichael Kruse 733537b16e9SGeorge Rokos 734537b16e9SGeorge Rokos ///==========================================================================/// 735*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix CK2 --check-prefix CK2-64 %s 736*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 737*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix CK2 --check-prefix CK2-64 %s 738*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix CK2 --check-prefix CK2-32 %s 739*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 740*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix CK2 --check-prefix CK2-32 %s 741537b16e9SGeorge Rokos 742*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s 743*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 744*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s 745*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s 746*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 747*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK2 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s 748537b16e9SGeorge Rokos 749537b16e9SGeorge Rokos #ifdef CK2 750537b16e9SGeorge Rokos // Nested mappers. 751537b16e9SGeorge Rokos 752537b16e9SGeorge Rokos class B { 753537b16e9SGeorge Rokos public: 754537b16e9SGeorge Rokos double a; 755537b16e9SGeorge Rokos }; 756537b16e9SGeorge Rokos 757537b16e9SGeorge Rokos class C { 758537b16e9SGeorge Rokos public: 759537b16e9SGeorge Rokos double a; 760537b16e9SGeorge Rokos B b; 761537b16e9SGeorge Rokos }; 762537b16e9SGeorge Rokos 763537b16e9SGeorge Rokos #pragma omp declare mapper(B s) map(s.a) 764537b16e9SGeorge Rokos 765537b16e9SGeorge Rokos #pragma omp declare mapper(id: C s) map(s.b) 766537b16e9SGeorge Rokos 767e4eaf9d8SJoseph Huber // CK2: define {{.*}}void [[BMPRFUNC:@[.]omp_mapper[.].*B[.]default]](i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}, i8*{{.*}}) 768537b16e9SGeorge Rokos 769e4eaf9d8SJoseph Huber // CK2-LABEL: define {{.*}}void @.omp_mapper.{{.*}}C{{.*}}.id(i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}, i8*{{.*}}) 770537b16e9SGeorge Rokos // CK2: store i8* %{{[^,]+}}, i8** [[HANDLEADDR:%[^,]+]] 771537b16e9SGeorge Rokos // CK2: store i8* %{{[^,]+}}, i8** [[BPTRADDR:%[^,]+]] 772537b16e9SGeorge Rokos // CK2: store i8* %{{[^,]+}}, i8** [[VPTRADDR:%[^,]+]] 773537b16e9SGeorge Rokos // CK2: store i64 %{{[^,]+}}, i{{64|32}}* [[SIZEADDR:%[^,]+]] 774537b16e9SGeorge Rokos // CK2: store i64 %{{[^,]+}}, i64* [[TYPEADDR:%[^,]+]] 775537b16e9SGeorge Rokos // CK2-DAG: [[BYTESIZE:%.+]] = load i64, i64* [[SIZEADDR]] 776537b16e9SGeorge Rokos // CK2-DAG: [[SIZE:%.+]] = udiv exact i64 [[BYTESIZE]], 16 777537b16e9SGeorge Rokos // CK2-DAG: [[TYPE:%.+]] = load i64, i64* [[TYPEADDR]] 778537b16e9SGeorge Rokos // CK2-DAG: [[HANDLE:%.+]] = load i8*, i8** [[HANDLEADDR]] 779537b16e9SGeorge Rokos // CK2-DAG: [[BPTR:%.+]] = load i8*, i8** [[BPTRADDR]] 780537b16e9SGeorge Rokos // CK2-DAG: [[BEGIN:%.+]] = load i8*, i8** [[VPTRADDR]] 78160d71a28SAlexey Bataev // CK2-DAG: [[PTRBEGIN:%.+]] = bitcast i8* [[BEGIN]] to %class.C* 78260d71a28SAlexey Bataev // CK2-DAG: [[PTREND:%.+]] = getelementptr %class.C, %class.C* [[PTRBEGIN]], i64 [[SIZE]] 78360d71a28SAlexey Bataev // CK2-DAG: [[ISARRAY:%.+]] = icmp sgt i64 [[SIZE]], 1 784caff8591SNikita Popov // CK2-DAG: [[PTRSNE:%.+]] = icmp ne i8* [[BPTR]], [[BEGIN]] 7850caf736dSAlexey Bataev // CK2-DAG: [[PTRANDOBJ:%.+]] = and i64 [[TYPE]], 16 7860caf736dSAlexey Bataev // CK2-DAG: [[ISPTRANDOBJ:%.+]] = icmp ne i64 [[PTRANDOBJ]], 0 7870caf736dSAlexey Bataev // CK2-DAG: [[CMPA:%.+]] = and i1 [[PTRSNE]], [[ISPTRANDOBJ]] 7880caf736dSAlexey Bataev // CK2-DAG: [[CMP:%.+]] = or i1 [[ISARRAY]], [[CMPA]] 78960d71a28SAlexey Bataev // CK2-DAG: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 79060d71a28SAlexey Bataev // CK2-DAG: [[ISNOTDEL:%.+]] = icmp eq i64 [[TYPEDEL]], 0 79160d71a28SAlexey Bataev // CK2-DAG: [[CMP1:%.+]] = and i1 [[CMP]], [[ISNOTDEL]] 79260d71a28SAlexey Bataev // CK2: br i1 [[CMP1]], label %[[INITEVALDEL:[^,]+]], label %[[LHEAD:[^,]+]] 793537b16e9SGeorge Rokos 794537b16e9SGeorge Rokos // CK2: [[INITEVALDEL]] 795537b16e9SGeorge Rokos // CK2-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 79607988422SAlexey Bataev 79707988422SAlexey Bataev // Remove movement mappings and mark as implicit 79807988422SAlexey Bataev // CK2-DAG: [[ITYPE:%.+]] = and i64 [[TYPE]], -4 79907988422SAlexey Bataev // CK2-DAG: [[ITYPE1:%.+]] = or i64 [[ITYPE]], 512 80007988422SAlexey Bataev // CK2: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[ITYPE1]], {{.*}}) 801537b16e9SGeorge Rokos // CK2: br label %[[LHEAD:[^,]+]] 802537b16e9SGeorge Rokos 803537b16e9SGeorge Rokos // CK2: [[LHEAD]] 80460d71a28SAlexey Bataev // CK2: [[ISEMPTY:%.+]] = icmp eq %class.C* [[PTRBEGIN]], [[PTREND]] 805537b16e9SGeorge Rokos // CK2: br i1 [[ISEMPTY]], label %[[DONE:[^,]+]], label %[[LBODY:[^,]+]] 806537b16e9SGeorge Rokos // CK2: [[LBODY]] 80760d71a28SAlexey Bataev // CK2: [[PTR:%.+]] = phi %class.C* [ [[PTRBEGIN]], %{{.+}} ], [ [[PTRNEXT:%.+]], %[[LCORRECT:[^,]+]] ] 80860d71a28SAlexey Bataev // CK2-DAG: [[BBEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[PTR]], i32 0, i32 1 809537b16e9SGeorge Rokos // CK2-DAG: [[PRESIZE:%.+]] = call i64 @__tgt_mapper_num_components(i8* [[HANDLE]]) 810537b16e9SGeorge Rokos // CK2-DAG: [[SHIPRESIZE:%.+]] = shl i64 [[PRESIZE]], 48 81160d71a28SAlexey Bataev // CK2-DAG: [[BPTRADDR1BC:%.+]] = bitcast %class.C* [[PTR]] to i8* 812537b16e9SGeorge Rokos // CK2-DAG: [[PTRADDR1BC:%.+]] = bitcast %class.B* [[BBEGIN]] to i8* 81360d71a28SAlexey Bataev // CK2-DAG: [[MEMBERTYPE:%.+]] = add nuw i64 3, [[SHIPRESIZE]] 814537b16e9SGeorge Rokos // CK2-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 815537b16e9SGeorge Rokos // CK2-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 816537b16e9SGeorge Rokos // CK2-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 817537b16e9SGeorge Rokos // CK2-DAG: [[ALLOC]] 818537b16e9SGeorge Rokos // CK2-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 819537b16e9SGeorge Rokos // CK2-DAG: br label %[[TYEND:[^,]+]] 820537b16e9SGeorge Rokos // CK2-DAG: [[ALLOCELSE]] 821537b16e9SGeorge Rokos // CK2-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 822537b16e9SGeorge Rokos // CK2-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 823537b16e9SGeorge Rokos // CK2-DAG: [[TO]] 824537b16e9SGeorge Rokos // CK2-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 825537b16e9SGeorge Rokos // CK2-DAG: br label %[[TYEND]] 826537b16e9SGeorge Rokos // CK2-DAG: [[TOELSE]] 827537b16e9SGeorge Rokos // CK2-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 828537b16e9SGeorge Rokos // CK2-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 829537b16e9SGeorge Rokos // CK2-DAG: [[FROM]] 830537b16e9SGeorge Rokos // CK2-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 831537b16e9SGeorge Rokos // CK2-DAG: br label %[[TYEND]] 832537b16e9SGeorge Rokos // CK2-DAG: [[TYEND]] 833537b16e9SGeorge Rokos // CK2-DAG: [[TYPE1:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 834e4eaf9d8SJoseph Huber // CK2: call void [[BMPRFUNC]](i8* [[HANDLE]], i8* [[BPTRADDR1BC]], i8* [[PTRADDR1BC]], i64 8, i64 [[TYPE1]], {{.*}}) 83560d71a28SAlexey Bataev // CK2: [[PTRNEXT]] = getelementptr %class.C, %class.C* [[PTR]], i32 1 83660d71a28SAlexey Bataev // CK2: [[ISDONE:%.+]] = icmp eq %class.C* [[PTRNEXT]], [[PTREND]] 837537b16e9SGeorge Rokos // CK2: br i1 [[ISDONE]], label %[[LEXIT:[^,]+]], label %[[LBODY]] 838537b16e9SGeorge Rokos 839537b16e9SGeorge Rokos // CK2: [[LEXIT]] 84060d71a28SAlexey Bataev // CK2: [[ISARRAY:%.+]] = icmp sgt i64 [[SIZE]], 1 841537b16e9SGeorge Rokos // CK2: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 84260d71a28SAlexey Bataev // CK2: [[ISNOTDEL:%.+]] = icmp ne i64 [[TYPEDEL]], 0 8430caf736dSAlexey Bataev // CK2: [[CMP1:%.+]] = and i1 [[ISARRAY]], [[ISNOTDEL]] 84460d71a28SAlexey Bataev // CK2: br i1 [[CMP1]], label %[[EVALDEL:[^,]+]], label %[[DONE]] 84560d71a28SAlexey Bataev // CK2: [[EVALDEL]] 846537b16e9SGeorge Rokos // CK2-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 84707988422SAlexey Bataev 84807988422SAlexey Bataev // Remove movement mappings and mark as implicit 84907988422SAlexey Bataev // CK2-DAG: [[DTYPE:%.+]] = and i64 [[TYPE]], -4 85007988422SAlexey Bataev // CK2-DAG: [[DTYPE1:%.+]] = or i64 [[DTYPE]], 512 85107988422SAlexey Bataev // CK2: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[DTYPE1]], {{.*}}) 852537b16e9SGeorge Rokos // CK2: br label %[[DONE]] 853537b16e9SGeorge Rokos // CK2: [[DONE]] 854537b16e9SGeorge Rokos // CK2: ret void 855537b16e9SGeorge Rokos 856537b16e9SGeorge Rokos #endif // CK2 857537b16e9SGeorge Rokos 858537b16e9SGeorge Rokos 859537b16e9SGeorge Rokos ///==========================================================================/// 860*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix CK3 %s 861*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 862*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix CK3 %s 863*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix CK3 %s 864*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 865*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix CK3 %s 866537b16e9SGeorge Rokos 867*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s 868*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 869*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s 870*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s 871*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 872*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK3 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s 873537b16e9SGeorge Rokos 874537b16e9SGeorge Rokos #ifdef CK3 875537b16e9SGeorge Rokos // map of array sections and nested components. 876537b16e9SGeorge Rokos 877537b16e9SGeorge Rokos // CK3-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}.region_id = weak constant i8 0 8785292187aSAlexey Bataev // CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [2 x i64] [i64 {{8|16}}, i64 {{80|160}}] 8795292187aSAlexey Bataev // CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [2 x i64] [i64 35, i64 35] 880537b16e9SGeorge Rokos 881537b16e9SGeorge Rokos class C { 882537b16e9SGeorge Rokos public: 883537b16e9SGeorge Rokos int a; 884537b16e9SGeorge Rokos double *b; 885537b16e9SGeorge Rokos }; 886537b16e9SGeorge Rokos 887537b16e9SGeorge Rokos class B { 888537b16e9SGeorge Rokos public: 889537b16e9SGeorge Rokos C c; 890537b16e9SGeorge Rokos }; 891537b16e9SGeorge Rokos 892537b16e9SGeorge Rokos #pragma omp declare mapper(id: C s) map(s.a, s.b[0:2]) 893537b16e9SGeorge Rokos 894e4eaf9d8SJoseph Huber // CK3: define {{.*}}void [[MPRFUNC:@[.]omp_mapper[.].*C[.]id]](i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}, i8*{{.*}}) 895537b16e9SGeorge Rokos 896537b16e9SGeorge Rokos // CK3-LABEL: define {{.*}}void @{{.*}}foo{{.*}} 897537b16e9SGeorge Rokos void foo(int a){ 898537b16e9SGeorge Rokos // CK3-DAG: [[CVAL:%.+]] = alloca [10 x %class.C] 899537b16e9SGeorge Rokos // CK3-DAG: [[BVAL:%.+]] = alloca %class.B 900537b16e9SGeorge Rokos C c[10]; 901537b16e9SGeorge Rokos B b; 902537b16e9SGeorge Rokos 903537b16e9SGeorge Rokos // CK3-DAG: [[BC:%.+]] = getelementptr inbounds %class.B, %class.B* [[BVAL]], i32 0, i32 0 904537b16e9SGeorge Rokos 905da8bec47SJoseph Huber // CK3-DAG: call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** null, i8** [[MPRGEP:%.+]]) 906537b16e9SGeorge Rokos // CK3-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 907537b16e9SGeorge Rokos // CK3-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 9085292187aSAlexey Bataev // CK3-DAG: [[MPRGEP]] = bitcast [2 x i8*]* [[MPR:%[^,]+]] to i8** 909537b16e9SGeorge Rokos // CK3-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 910537b16e9SGeorge Rokos // CK3-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 911537b16e9SGeorge Rokos // CK3-DAG: [[MPR1:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i{{64|32}} 0, i{{64|32}} 0 912537b16e9SGeorge Rokos // CK3-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to %class.B** 913537b16e9SGeorge Rokos // CK3-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to %class.C** 914537b16e9SGeorge Rokos // CK3-DAG: store %class.B* [[BVAL]], %class.B** [[CBP1]] 915537b16e9SGeorge Rokos // CK3-DAG: store %class.C* [[BC]], %class.C** [[CP1]] 916e4eaf9d8SJoseph Huber // CK3-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[MPR1]] 917537b16e9SGeorge Rokos // CK3-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 918537b16e9SGeorge Rokos // CK3-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 919537b16e9SGeorge Rokos // CK3-DAG: [[MPR2:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i{{64|32}} 0, i{{64|32}} 1 9205292187aSAlexey Bataev // CK3-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [10 x %class.C]** 921537b16e9SGeorge Rokos // CK3-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to %class.C** 9225292187aSAlexey Bataev // CK3-DAG: store [10 x %class.C]* [[CVAL]], [10 x %class.C]** [[CBP2]] 923537b16e9SGeorge Rokos // CK3-DAG: [[CVALGEP:%.+]] = getelementptr inbounds {{.+}}[[CVAL]], i{{64|32}} 0, i{{64|32}} 0 9245292187aSAlexey Bataev // CK3-DAG: store %class.C* [[CVALGEP]], %class.C** [[CP2]] 925e4eaf9d8SJoseph Huber // CK3-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[MPR2]] 926537b16e9SGeorge Rokos // CK3: call void [[KERNEL:@.+]](%class.B* [[BVAL]], [10 x %class.C]* [[CVAL]]) 927537b16e9SGeorge Rokos #pragma omp target map(mapper(id),tofrom: c[0:10], b.c) 928537b16e9SGeorge Rokos for (int i = 0; i < 10; i++) { 929537b16e9SGeorge Rokos b.c.a += ++c[i].a; 930537b16e9SGeorge Rokos } 931537b16e9SGeorge Rokos } 932537b16e9SGeorge Rokos 933537b16e9SGeorge Rokos 934537b16e9SGeorge Rokos // CK3: define internal void [[KERNEL]](%class.B* {{[^,]+}}, [10 x %class.C]* {{[^,]+}}) 935537b16e9SGeorge Rokos 936537b16e9SGeorge Rokos #endif // CK3 937537b16e9SGeorge Rokos 9389f2f3b9dSJoel E. Denny ///==========================================================================/// 939*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix CK4 --check-prefix CK4-64 %s 940*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 941*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -fopenmp -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix CK4 --check-prefix CK4-64 %s 942*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -verify -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix CK4 --check-prefix CK4-32 %s 943*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 944*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -fopenmp -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix CK4 --check-prefix CK4-32 %s 9459f2f3b9dSJoel E. Denny 946*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s 947*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 948*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s 949*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -verify -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm -femit-all-decls -disable-llvm-passes %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s 950*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -femit-all-decls -disable-llvm-passes -o %t %s 951*532dc62bSNikita Popov // RUN: %clang_cc1 -no-opaque-pointers -DCK4 -fopenmp-simd -fopenmp-version=51 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -femit-all-decls -disable-llvm-passes -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s 9529f2f3b9dSJoel E. Denny 9539f2f3b9dSJoel E. Denny #ifdef CK4 9549f2f3b9dSJoel E. Denny // Mapper function code generation and runtime interface. 9559f2f3b9dSJoel E. Denny 9569f2f3b9dSJoel E. Denny // CK4-64: [[TSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 9579f2f3b9dSJoel E. Denny // CK4-32: [[TSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 958b272698dSAlexey Bataev // PRESENT=0x1000 | TO=0x1 = 0x1001 959b272698dSAlexey Bataev // CK4: [[TTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 [[#0x1001]]] 9609f2f3b9dSJoel E. Denny 9619f2f3b9dSJoel E. Denny // CK4-64: [[FSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 9629f2f3b9dSJoel E. Denny // CK4-32: [[FSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 963b272698dSAlexey Bataev // PRESENT=0x1000 | FROM=0x2 = 0x1002 964b272698dSAlexey Bataev // CK4: [[FTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 [[#0x1002]]] 9659f2f3b9dSJoel E. Denny 9669f2f3b9dSJoel E. Denny class C { 9679f2f3b9dSJoel E. Denny public: 9689f2f3b9dSJoel E. Denny int a; 9699f2f3b9dSJoel E. Denny double *b; 9709f2f3b9dSJoel E. Denny }; 9719f2f3b9dSJoel E. Denny 9729f2f3b9dSJoel E. Denny #pragma omp declare mapper(id: C s) map(s.a, s.b[0:2]) 9739f2f3b9dSJoel E. Denny 974e4eaf9d8SJoseph Huber // CK4: define {{.*}}void [[MPRFUNC:@[.]omp_mapper[.].*C[.]id]](i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}, i8*{{.*}}) 9759f2f3b9dSJoel E. Denny // CK4: store i8* %{{[^,]+}}, i8** [[HANDLEADDR:%[^,]+]] 9769f2f3b9dSJoel E. Denny // CK4: store i8* %{{[^,]+}}, i8** [[BPTRADDR:%[^,]+]] 9779f2f3b9dSJoel E. Denny // CK4: store i8* %{{[^,]+}}, i8** [[VPTRADDR:%[^,]+]] 9789f2f3b9dSJoel E. Denny // CK4: store i64 %{{[^,]+}}, i{{64|32}}* [[SIZEADDR:%[^,]+]] 9799f2f3b9dSJoel E. Denny // CK4: store i64 %{{[^,]+}}, i64* [[TYPEADDR:%[^,]+]] 9809f2f3b9dSJoel E. Denny // CK4-DAG: [[BYTESIZE:%.+]] = load i64, i64* [[SIZEADDR]] 9819f2f3b9dSJoel E. Denny // CK4-64-DAG: [[SIZE:%.+]] = udiv exact i64 [[BYTESIZE]], 16 9829f2f3b9dSJoel E. Denny // CK4-32-DAG: [[SIZE:%.+]] = udiv exact i64 [[BYTESIZE]], 8 9839f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPE:%.+]] = load i64, i64* [[TYPEADDR]] 9849f2f3b9dSJoel E. Denny // CK4-DAG: [[HANDLE:%.+]] = load i8*, i8** [[HANDLEADDR]] 9859f2f3b9dSJoel E. Denny // CK4-DAG: [[BPTR:%.+]] = load i8*, i8** [[BPTRADDR]] 9869f2f3b9dSJoel E. Denny // CK4-DAG: [[BEGIN:%.+]] = load i8*, i8** [[VPTRADDR]] 98760d71a28SAlexey Bataev // CK4-DAG: [[PTRBEGIN:%.+]] = bitcast i8* [[BEGIN]] to %class.C* 98860d71a28SAlexey Bataev // CK4-DAG: [[PTREND:%.+]] = getelementptr %class.C, %class.C* [[PTRBEGIN]], i64 [[SIZE]] 98960d71a28SAlexey Bataev // CK4-DAG: [[ISARRAY:%.+]] = icmp sgt i64 [[SIZE]], 1 990caff8591SNikita Popov // CK4-DAG: [[PTRSNE:%.+]] = icmp ne i8* [[BPTR]], [[BEGIN]] 9910caf736dSAlexey Bataev // CK4-DAG: [[PTRANDOBJ:%.+]] = and i64 [[TYPE]], 16 9920caf736dSAlexey Bataev // CK4-DAG: [[ISPTRANDOBJ:%.+]] = icmp ne i64 [[PTRANDOBJ]], 0 9930caf736dSAlexey Bataev // CK4-DAG: [[CMPA:%.+]] = and i1 [[PTRSNE]], [[ISPTRANDOBJ]] 9940caf736dSAlexey Bataev // CK4-DAG: [[CMP:%.+]] = or i1 [[ISARRAY]], [[CMPA]] 99560d71a28SAlexey Bataev // CK4-DAG: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 99660d71a28SAlexey Bataev // CK4-DAG: [[ISNOTDEL:%.+]] = icmp eq i64 [[TYPEDEL]], 0 99760d71a28SAlexey Bataev // CK4-DAG: [[CMP1:%.+]] = and i1 [[CMP]], [[ISNOTDEL]] 99860d71a28SAlexey Bataev // CK4: br i1 [[CMP1]], label %[[INITEVALDEL:[^,]+]], label %[[LHEAD:[^,]+]] 9999f2f3b9dSJoel E. Denny 10009f2f3b9dSJoel E. Denny // CK4: [[INITEVALDEL]] 10019f2f3b9dSJoel E. Denny // CK4-64-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 10029f2f3b9dSJoel E. Denny // CK4-32-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 8 100307988422SAlexey Bataev 100407988422SAlexey Bataev // Remove movement mappings and mark as implicit 100507988422SAlexey Bataev // CK4-DAG: [[ITYPE:%.+]] = and i64 [[TYPE]], -4 100607988422SAlexey Bataev // CK4-DAG: [[ITYPE1:%.+]] = or i64 [[ITYPE]], 512 100707988422SAlexey Bataev // CK4: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[ITYPE1]], {{.*}}) 10089f2f3b9dSJoel E. Denny // CK4: br label %[[LHEAD:[^,]+]] 10099f2f3b9dSJoel E. Denny 10109f2f3b9dSJoel E. Denny // CK4: [[LHEAD]] 101160d71a28SAlexey Bataev // CK4: [[ISEMPTY:%.+]] = icmp eq %class.C* [[PTRBEGIN]], [[PTREND]] 10129f2f3b9dSJoel E. Denny // CK4: br i1 [[ISEMPTY]], label %[[DONE:[^,]+]], label %[[LBODY:[^,]+]] 10139f2f3b9dSJoel E. Denny // CK4: [[LBODY]] 101460d71a28SAlexey Bataev // CK4: [[PTR:%.+]] = phi %class.C* [ [[PTRBEGIN]], %{{.+}} ], [ [[PTRNEXT:%.+]], %[[LCORRECT:[^,]+]] ] 101560d71a28SAlexey Bataev // CK4-DAG: [[ABEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[PTR]], i32 0, i32 0 101660d71a28SAlexey Bataev // CK4-DAG: [[BBEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[PTR]], i32 0, i32 1 101760d71a28SAlexey Bataev // CK4-DAG: [[BBEGIN2:%.+]] = getelementptr inbounds %class.C, %class.C* [[PTR]], i32 0, i32 1 10189f2f3b9dSJoel E. Denny // CK4-DAG: [[BARRBEGIN:%.+]] = load double*, double** [[BBEGIN2]] 10199f2f3b9dSJoel E. Denny // CK4-DAG: [[BARRBEGINGEP:%.+]] = getelementptr inbounds double, double* [[BARRBEGIN]], i[[sz:64|32]] 0 10209f2f3b9dSJoel E. Denny // CK4-DAG: [[BEND:%.+]] = getelementptr double*, double** [[BBEGIN]], i32 1 10219f2f3b9dSJoel E. Denny // CK4-DAG: [[ABEGINV:%.+]] = bitcast i32* [[ABEGIN]] to i8* 10229f2f3b9dSJoel E. Denny // CK4-DAG: [[BENDV:%.+]] = bitcast double** [[BEND]] to i8* 10239f2f3b9dSJoel E. Denny // CK4-DAG: [[ABEGINI:%.+]] = ptrtoint i8* [[ABEGINV]] to i64 10249f2f3b9dSJoel E. Denny // CK4-DAG: [[BENDI:%.+]] = ptrtoint i8* [[BENDV]] to i64 10259f2f3b9dSJoel E. Denny // CK4-DAG: [[CSIZE:%.+]] = sub i64 [[BENDI]], [[ABEGINI]] 10269f2f3b9dSJoel E. Denny // CK4-DAG: [[CUSIZE:%.+]] = sdiv exact i64 [[CSIZE]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 102760d71a28SAlexey Bataev // CK4-DAG: [[BPTRADDR0BC:%.+]] = bitcast %class.C* [[PTR]] to i8* 10289f2f3b9dSJoel E. Denny // CK4-DAG: [[PTRADDR0BC:%.+]] = bitcast i32* [[ABEGIN]] to i8* 10299f2f3b9dSJoel E. Denny // CK4-DAG: [[PRESIZE:%.+]] = call i64 @__tgt_mapper_num_components(i8* [[HANDLE]]) 10309f2f3b9dSJoel E. Denny // CK4-DAG: [[SHIPRESIZE:%.+]] = shl i64 [[PRESIZE]], 48 103160d71a28SAlexey Bataev // CK4-DAG: [[MEMBERTYPE:%.+]] = add nuw i64 0, [[SHIPRESIZE]] 10329f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 10339f2f3b9dSJoel E. Denny // CK4-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 10349f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 10359f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOC]] 10369f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 10379f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND:[^,]+]] 10389f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCELSE]] 10399f2f3b9dSJoel E. Denny // CK4-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 10409f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 10419f2f3b9dSJoel E. Denny // CK4-DAG: [[TO]] 10429f2f3b9dSJoel E. Denny // CK4-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 10439f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 10449f2f3b9dSJoel E. Denny // CK4-DAG: [[TOELSE]] 10459f2f3b9dSJoel E. Denny // CK4-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 10469f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 10479f2f3b9dSJoel E. Denny // CK4-DAG: [[FROM]] 10489f2f3b9dSJoel E. Denny // CK4-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 10499f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 10509f2f3b9dSJoel E. Denny // CK4-DAG: [[TYEND]] 10519f2f3b9dSJoel E. Denny // CK4-DAG: [[PHITYPE0:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 1052e4eaf9d8SJoseph Huber // CK4: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR0BC]], i8* [[PTRADDR0BC]], i64 [[CUSIZE]], i64 [[PHITYPE0]], {{.*}}) 105360d71a28SAlexey Bataev // CK4-DAG: [[BPTRADDR1BC:%.+]] = bitcast %class.C* [[PTR]] to i8* 10549f2f3b9dSJoel E. Denny // CK4-DAG: [[PTRADDR1BC:%.+]] = bitcast i32* [[ABEGIN]] to i8* 10559f2f3b9dSJoel E. Denny // 281474976710659 == 0x1,000,000,003 105660d71a28SAlexey Bataev // CK4-DAG: [[MEMBERTYPE:%.+]] = add nuw i64 281474976710659, [[SHIPRESIZE]] 10579f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 10589f2f3b9dSJoel E. Denny // CK4-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 10599f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 10609f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOC]] 10619f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 10629f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND:[^,]+]] 10639f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCELSE]] 10649f2f3b9dSJoel E. Denny // CK4-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 10659f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 10669f2f3b9dSJoel E. Denny // CK4-DAG: [[TO]] 10679f2f3b9dSJoel E. Denny // CK4-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 10689f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 10699f2f3b9dSJoel E. Denny // CK4-DAG: [[TOELSE]] 10709f2f3b9dSJoel E. Denny // CK4-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 10719f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 10729f2f3b9dSJoel E. Denny // CK4-DAG: [[FROM]] 10739f2f3b9dSJoel E. Denny // CK4-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 10749f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 10759f2f3b9dSJoel E. Denny // CK4-DAG: [[TYEND]] 10769f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPE1:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 1077e4eaf9d8SJoseph Huber // CK4: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR1BC]], i8* [[PTRADDR1BC]], i64 4, i64 [[TYPE1]], {{.*}}) 10789f2f3b9dSJoel E. Denny // CK4-DAG: [[BPTRADDR2BC:%.+]] = bitcast double** [[BBEGIN]] to i8* 10799f2f3b9dSJoel E. Denny // CK4-DAG: [[PTRADDR2BC:%.+]] = bitcast double* [[BARRBEGINGEP]] to i8* 10809f2f3b9dSJoel E. Denny // 281474976710675 == 0x1,000,000,013 108160d71a28SAlexey Bataev // CK4-DAG: [[MEMBERTYPE:%.+]] = add nuw i64 281474976710675, [[SHIPRESIZE]] 10829f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 10839f2f3b9dSJoel E. Denny // CK4-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 10849f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 10859f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOC]] 10869f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 10879f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND:[^,]+]] 10889f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCELSE]] 10899f2f3b9dSJoel E. Denny // CK4-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 10909f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 10919f2f3b9dSJoel E. Denny // CK4-DAG: [[TO]] 10929f2f3b9dSJoel E. Denny // CK4-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 10939f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 10949f2f3b9dSJoel E. Denny // CK4-DAG: [[TOELSE]] 10959f2f3b9dSJoel E. Denny // CK4-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 10969f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 10979f2f3b9dSJoel E. Denny // CK4-DAG: [[FROM]] 10989f2f3b9dSJoel E. Denny // CK4-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 10999f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 11009f2f3b9dSJoel E. Denny // CK4-DAG: [[TYEND]] 11019f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPE2:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 1102e4eaf9d8SJoseph Huber // CK4: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR2BC]], i8* [[PTRADDR2BC]], i64 16, i64 [[TYPE2]], {{.*}}) 110360d71a28SAlexey Bataev // CK4: [[PTRNEXT]] = getelementptr %class.C, %class.C* [[PTR]], i32 1 110460d71a28SAlexey Bataev // CK4: [[ISDONE:%.+]] = icmp eq %class.C* [[PTRNEXT]], [[PTREND]] 11059f2f3b9dSJoel E. Denny // CK4: br i1 [[ISDONE]], label %[[LEXIT:[^,]+]], label %[[LBODY]] 11069f2f3b9dSJoel E. Denny 11079f2f3b9dSJoel E. Denny // CK4: [[LEXIT]] 110860d71a28SAlexey Bataev // CK4: [[ISARRAY:%.+]] = icmp sgt i64 [[SIZE]], 1 11099f2f3b9dSJoel E. Denny // CK4: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 111060d71a28SAlexey Bataev // CK4: [[ISNOTDEL:%.+]] = icmp ne i64 [[TYPEDEL]], 0 11110caf736dSAlexey Bataev // CK4: [[CMP1:%.+]] = and i1 [[ISARRAY]], [[ISNOTDEL]] 111260d71a28SAlexey Bataev // CK4: br i1 [[CMP1]], label %[[EVALDEL:[^,]+]], label %[[DONE]] 111360d71a28SAlexey Bataev // CK4: [[EVALDEL]] 11149f2f3b9dSJoel E. Denny // CK4-64-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 11159f2f3b9dSJoel E. Denny // CK4-32-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 8 111607988422SAlexey Bataev 111707988422SAlexey Bataev // Remove movement mappings and mark as implicit 111807988422SAlexey Bataev // CK4-DAG: [[DTYPE:%.+]] = and i64 [[TYPE]], -4 111907988422SAlexey Bataev // CK4-DAG: [[DTYPE1:%.+]] = or i64 [[DTYPE]], 512 112007988422SAlexey Bataev // CK4: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[DTYPE1]], {{.*}}) 11219f2f3b9dSJoel E. Denny // CK4: br label %[[DONE]] 11229f2f3b9dSJoel E. Denny // CK4: [[DONE]] 11239f2f3b9dSJoel E. Denny // CK4: ret void 11249f2f3b9dSJoel E. Denny 11259f2f3b9dSJoel E. Denny 11269f2f3b9dSJoel E. Denny // CK4-LABEL: define {{.*}}void @{{.*}}foo{{.*}} 11279f2f3b9dSJoel E. Denny void foo(int a){ 11289f2f3b9dSJoel E. Denny int i = a; 11299f2f3b9dSJoel E. Denny C c; 11309f2f3b9dSJoel E. Denny c.a = a; 11319f2f3b9dSJoel E. Denny 1132da8bec47SJoseph Huber // CK4-DAG: call void @__tgt_target_data_update_mapper(%struct.ident_t* @{{.+}}, i64 -1, i32 1, i8** [[TGEPBP:%.+]], i8** [[TGEPP:%.+]], i64* getelementptr {{.+}}[1 x i64]* [[TSIZES]], i32 0, i32 0), {{.+}}getelementptr {{.+}}[1 x i64]* [[TTYPES]]{{.+}}, i8** null, i8** [[TMPRGEP:%.+]]) 11339f2f3b9dSJoel E. Denny // CK4-DAG: [[TGEPBP]] = getelementptr inbounds {{.+}}[[TBP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 11349f2f3b9dSJoel E. Denny // CK4-DAG: [[TGEPP]] = getelementptr inbounds {{.+}}[[TP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 11359f2f3b9dSJoel E. Denny // CK4-DAG: [[TMPRGEP]] = bitcast [1 x i8*]* [[TMPR:%[^,]+]] to i8** 11369f2f3b9dSJoel E. Denny // CK4-DAG: [[TBP0:%.+]] = getelementptr inbounds {{.+}}[[TBP]], i{{.+}} 0, i{{.+}} 0 11379f2f3b9dSJoel E. Denny // CK4-DAG: [[TP0:%.+]] = getelementptr inbounds {{.+}}[[TP]], i{{.+}} 0, i{{.+}} 0 11389f2f3b9dSJoel E. Denny // CK4-DAG: [[TMPR1:%.+]] = getelementptr inbounds {{.+}}[[TMPR]], i[[sz]] 0, i[[sz]] 0 11399f2f3b9dSJoel E. Denny // CK4-DAG: [[TCBP0:%.+]] = bitcast i8** [[TBP0]] to %class.C** 11409f2f3b9dSJoel E. Denny // CK4-DAG: [[TCP0:%.+]] = bitcast i8** [[TP0]] to %class.C** 11419f2f3b9dSJoel E. Denny // CK4-DAG: store %class.C* [[VAL:%[^,]+]], %class.C** [[TCBP0]] 11429f2f3b9dSJoel E. Denny // CK4-DAG: store %class.C* [[VAL]], %class.C** [[TCP0]] 1143e4eaf9d8SJoseph Huber // CK4-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[TMPR1]] 11449f2f3b9dSJoel E. Denny #pragma omp target update to(present, mapper(id): c) 11459f2f3b9dSJoel E. Denny 1146da8bec47SJoseph Huber // CK4-DAG: call void @__tgt_target_data_update_mapper(%struct.ident_t* @{{.+}}, i64 -1, i32 1, i8** [[FGEPBP:%.+]], i8** [[FGEPP:%.+]], i64* getelementptr {{.+}}[1 x i64]* [[FSIZES]], i32 0, i32 0), {{.+}}getelementptr {{.+}}[1 x i64]* [[FTYPES]]{{.+}}, i8** null, i8** [[FMPRGEP:%.+]]) 11479f2f3b9dSJoel E. Denny // CK4-DAG: [[FGEPBP]] = getelementptr inbounds {{.+}}[[FBP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 11489f2f3b9dSJoel E. Denny // CK4-DAG: [[FGEPP]] = getelementptr inbounds {{.+}}[[FP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 11499f2f3b9dSJoel E. Denny // CK4-DAG: [[FMPRGEP]] = bitcast [1 x i8*]* [[FMPR:%[^,]+]] to i8** 11509f2f3b9dSJoel E. Denny // CK4-DAG: [[FBP0:%.+]] = getelementptr inbounds {{.+}}[[FBP]], i{{.+}} 0, i{{.+}} 0 11519f2f3b9dSJoel E. Denny // CK4-DAG: [[FP0:%.+]] = getelementptr inbounds {{.+}}[[FP]], i{{.+}} 0, i{{.+}} 0 11529f2f3b9dSJoel E. Denny // CK4-DAG: [[FMPR1:%.+]] = getelementptr inbounds {{.+}}[[FMPR]], i[[sz]] 0, i[[sz]] 0 11539f2f3b9dSJoel E. Denny // CK4-DAG: [[FCBP0:%.+]] = bitcast i8** [[FBP0]] to %class.C** 11549f2f3b9dSJoel E. Denny // CK4-DAG: [[FCP0:%.+]] = bitcast i8** [[FP0]] to %class.C** 11559f2f3b9dSJoel E. Denny // CK4-DAG: store %class.C* [[VAL]], %class.C** [[FCBP0]] 11569f2f3b9dSJoel E. Denny // CK4-DAG: store %class.C* [[VAL]], %class.C** [[FCP0]] 1157e4eaf9d8SJoseph Huber // CK4-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64, i8*)* [[MPRFUNC]] to i8*), i8** [[FMPR1]] 11589f2f3b9dSJoel E. Denny #pragma omp target update from(mapper(id), present: c) 11599f2f3b9dSJoel E. Denny } 11609f2f3b9dSJoel E. Denny 11619f2f3b9dSJoel E. Denny #endif // CK4 11629f2f3b9dSJoel E. Denny 1163537b16e9SGeorge Rokos #endif // HEADER 1164