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 ///==========================================================================/// 8d47b9438SMichael Kruse // RUN: %clang_cc1 -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 9d47b9438SMichael Kruse // RUN: %clang_cc1 -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 10d47b9438SMichael Kruse // RUN: %clang_cc1 -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 11d47b9438SMichael Kruse // RUN: %clang_cc1 -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 12d47b9438SMichael Kruse // RUN: %clang_cc1 -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 13d47b9438SMichael Kruse // RUN: %clang_cc1 -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 15d47b9438SMichael Kruse // RUN: %clang_cc1 -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 16d47b9438SMichael Kruse // RUN: %clang_cc1 -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 17d47b9438SMichael Kruse // RUN: %clang_cc1 -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 18d47b9438SMichael Kruse // RUN: %clang_cc1 -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 19d47b9438SMichael Kruse // RUN: %clang_cc1 -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 20d47b9438SMichael Kruse // RUN: %clang_cc1 -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*] } 36*0661328dSShilei Tian // CK0: [[KMP_TASK_T_WITH_PRIVATES_4:%.+]] = type { [[KMP_TASK_T]], [[KMP_PRIVATES_T_5:%.+]] } 37*0661328dSShilei Tian // CK0-32: [[KMP_PRIVATES_T_5]] = type { [1 x i64], [1 x i8*], [1 x i8*], [1 x i8*] } 38*0661328dSShilei Tian // CK0-64: [[KMP_PRIVATES_T_5]] = type { [1 x i8*], [1 x i8*], [1 x i64], [1 x i8*] } 39*0661328dSShilei Tian // CK0: [[KMP_TASK_T_WITH_PRIVATES_7:%.+]] = type { [[KMP_TASK_T]], [[KMP_PRIVATES_T_8:%.+]] } 40*0661328dSShilei Tian // CK0-32: [[KMP_PRIVATES_T_8]] = type { [1 x i64], [1 x i8*], [1 x i8*], [1 x i8*] } 41*0661328dSShilei Tian // CK0-64: [[KMP_PRIVATES_T_8]] = type { [1 x i8*], [1 x i8*], [1 x i64], [1 x i8*] } 42*0661328dSShilei Tian // CK0: [[KMP_TASK_T_WITH_PRIVATES_10:%.+]] = type { [[KMP_TASK_T]], [[KMP_PRIVATES_T_11:%.+]] } 43*0661328dSShilei Tian // CK0-32: [[KMP_PRIVATES_T_11]] = type { [1 x i64], [1 x i8*], [1 x i8*], [1 x i8*] } 44*0661328dSShilei 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] 61537b16e9SGeorge Rokos // CK0: [[EDTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 33] 62537b16e9SGeorge Rokos // CK0-64: [[EDNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 63537b16e9SGeorge Rokos // CK0-32: [[EDNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 64537b16e9SGeorge Rokos // CK0: [[EDNWTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 33] 65537b16e9SGeorge Rokos // CK0-64: [[EXDSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 66537b16e9SGeorge Rokos // CK0-32: [[EXDSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 67537b16e9SGeorge Rokos // CK0: [[EXDTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 34] 68537b16e9SGeorge Rokos // CK0-64: [[EXDNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 69537b16e9SGeorge Rokos // CK0-32: [[EXDNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 70537b16e9SGeorge Rokos // CK0: [[EXDNWTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 34] 71d47b9438SMichael Kruse // CK0-64: [[TSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 72d47b9438SMichael Kruse // CK0-32: [[TSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 73d47b9438SMichael Kruse // CK0: [[TTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 33] 74d47b9438SMichael Kruse // CK0-64: [[FSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 75d47b9438SMichael Kruse // CK0-32: [[FSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 76d47b9438SMichael Kruse // CK0: [[FTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 34] 77537b16e9SGeorge Rokos // CK0-64: [[FNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 78537b16e9SGeorge Rokos // CK0-32: [[FNWSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 79537b16e9SGeorge Rokos // CK0: [[FNWTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 34] 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 89537b16e9SGeorge Rokos // CK0: define {{.*}}void [[MPRFUNC:@[.]omp_mapper[.].*C[.]id]](i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}) 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: [[PTRBEGIN:%.+]] = bitcast i8** [[VPTRADDR]] to %class.C** 101d47b9438SMichael Kruse // CK0-DAG: [[PTREND:%.+]] = getelementptr %class.C*, %class.C** [[PTRBEGIN]], i64 [[SIZE]] 102d47b9438SMichael Kruse // CK0-DAG: [[BPTR:%.+]] = load i8*, i8** [[BPTRADDR]] 103d47b9438SMichael Kruse // CK0-DAG: [[BEGIN:%.+]] = load i8*, i8** [[VPTRADDR]] 104d47b9438SMichael Kruse // CK0: [[ISARRAY:%.+]] = icmp sge i64 [[SIZE]], 1 105d47b9438SMichael Kruse // CK0: br i1 [[ISARRAY]], label %[[INITEVALDEL:[^,]+]], label %[[LHEAD:[^,]+]] 1064304e9d1SMichael Kruse 107d47b9438SMichael Kruse // CK0: [[INITEVALDEL]] 108d47b9438SMichael Kruse // CK0: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 109d47b9438SMichael Kruse // CK0: [[ISNOTDEL:%.+]] = icmp eq i64 [[TYPEDEL]], 0 110d47b9438SMichael Kruse // CK0: br i1 [[ISNOTDEL]], label %[[INIT:[^,]+]], label %[[LHEAD:[^,]+]] 111d47b9438SMichael Kruse // CK0: [[INIT]] 112d47b9438SMichael Kruse // CK0-64-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 113d47b9438SMichael Kruse // CK0-32-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 8 114d47b9438SMichael Kruse // CK0-DAG: [[ITYPE:%.+]] = and i64 [[TYPE]], -4 115d47b9438SMichael Kruse // CK0: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[ITYPE]]) 116d47b9438SMichael Kruse // CK0: br label %[[LHEAD:[^,]+]] 1174304e9d1SMichael Kruse 118d47b9438SMichael Kruse // CK0: [[LHEAD]] 119d47b9438SMichael Kruse // CK0: [[ISEMPTY:%.+]] = icmp eq %class.C** [[PTRBEGIN]], [[PTREND]] 120d47b9438SMichael Kruse // CK0: br i1 [[ISEMPTY]], label %[[DONE:[^,]+]], label %[[LBODY:[^,]+]] 121d47b9438SMichael Kruse // CK0: [[LBODY]] 122d47b9438SMichael Kruse // CK0: [[PTR:%.+]] = phi %class.C** [ [[PTRBEGIN]], %[[LHEAD]] ], [ [[PTRNEXT:%.+]], %[[LCORRECT:[^,]+]] ] 123d47b9438SMichael Kruse // CK0: [[OBJ:%.+]] = load %class.C*, %class.C** [[PTR]] 124d47b9438SMichael Kruse // CK0-DAG: [[ABEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[OBJ]], i32 0, i32 0 125d47b9438SMichael Kruse // CK0-DAG: [[BBEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[OBJ]], i32 0, i32 1 126d47b9438SMichael Kruse // CK0-DAG: [[BBEGIN2:%.+]] = getelementptr inbounds %class.C, %class.C* [[OBJ]], i32 0, i32 1 127d47b9438SMichael Kruse // CK0-DAG: [[BARRBEGIN:%.+]] = load double*, double** [[BBEGIN2]] 128d47b9438SMichael Kruse // CK0-DAG: [[BARRBEGINGEP:%.+]] = getelementptr inbounds double, double* [[BARRBEGIN]], i[[sz:64|32]] 0 129d47b9438SMichael Kruse // CK0-DAG: [[BEND:%.+]] = getelementptr double*, double** [[BBEGIN]], i32 1 130d47b9438SMichael Kruse // CK0-DAG: [[ABEGINV:%.+]] = bitcast i32* [[ABEGIN]] to i8* 131d47b9438SMichael Kruse // CK0-DAG: [[BENDV:%.+]] = bitcast double** [[BEND]] to i8* 132d47b9438SMichael Kruse // CK0-DAG: [[ABEGINI:%.+]] = ptrtoint i8* [[ABEGINV]] to i64 133d47b9438SMichael Kruse // CK0-DAG: [[BENDI:%.+]] = ptrtoint i8* [[BENDV]] to i64 134d47b9438SMichael Kruse // CK0-DAG: [[CSIZE:%.+]] = sub i64 [[BENDI]], [[ABEGINI]] 135d47b9438SMichael Kruse // CK0-DAG: [[CUSIZE:%.+]] = sdiv exact i64 [[CSIZE]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 136d47b9438SMichael Kruse // CK0-DAG: [[BPTRADDR0BC:%.+]] = bitcast %class.C* [[OBJ]] to i8* 137d47b9438SMichael Kruse // CK0-DAG: [[PTRADDR0BC:%.+]] = bitcast i32* [[ABEGIN]] to i8* 138d47b9438SMichael Kruse // CK0-DAG: [[PRESIZE:%.+]] = call i64 @__tgt_mapper_num_components(i8* [[HANDLE]]) 139d47b9438SMichael Kruse // CK0-DAG: [[SHIPRESIZE:%.+]] = shl i64 [[PRESIZE]], 48 140d47b9438SMichael Kruse // CK0-DAG: br label %[[MEMBER:[^,]+]] 141d47b9438SMichael Kruse // CK0-DAG: [[MEMBER]] 142d47b9438SMichael Kruse // CK0-DAG: br i1 true, label %[[LTYPE:[^,]+]], label %[[MEMBERCOM:[^,]+]] 143d47b9438SMichael Kruse // CK0-DAG: [[MEMBERCOM]] 144d47b9438SMichael Kruse // CK0-DAG: [[MEMBERCOMTYPE:%.+]] = add nuw i64 32, [[SHIPRESIZE]] 145d47b9438SMichael Kruse // CK0-DAG: br label %[[LTYPE]] 146d47b9438SMichael Kruse // CK0-DAG: [[LTYPE]] 147d47b9438SMichael Kruse // CK0-DAG: [[MEMBERTYPE:%.+]] = phi i64 [ 32, %[[MEMBER]] ], [ [[MEMBERCOMTYPE]], %[[MEMBERCOM]] ] 148d47b9438SMichael Kruse // CK0-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 149d47b9438SMichael Kruse // CK0-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 150d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 151d47b9438SMichael Kruse // CK0-DAG: [[ALLOC]] 152d47b9438SMichael Kruse // CK0-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 153d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND:[^,]+]] 154d47b9438SMichael Kruse // CK0-DAG: [[ALLOCELSE]] 155d47b9438SMichael Kruse // CK0-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 156d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 157d47b9438SMichael Kruse // CK0-DAG: [[TO]] 158d47b9438SMichael Kruse // CK0-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 159d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 160d47b9438SMichael Kruse // CK0-DAG: [[TOELSE]] 161d47b9438SMichael Kruse // CK0-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 162d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 163d47b9438SMichael Kruse // CK0-DAG: [[FROM]] 164d47b9438SMichael Kruse // CK0-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 165d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 166d47b9438SMichael Kruse // CK0-DAG: [[TYEND]] 167d47b9438SMichael Kruse // CK0-DAG: [[PHITYPE0:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 168d47b9438SMichael Kruse // CK0: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR0BC]], i8* [[PTRADDR0BC]], i64 [[CUSIZE]], i64 [[PHITYPE0]]) 169d47b9438SMichael Kruse // CK0-DAG: [[BPTRADDR1BC:%.+]] = bitcast %class.C* [[OBJ]] to i8* 170d47b9438SMichael Kruse // CK0-DAG: [[PTRADDR1BC:%.+]] = bitcast i32* [[ABEGIN]] to i8* 171d47b9438SMichael Kruse // CK0-DAG: br label %[[MEMBER:[^,]+]] 172d47b9438SMichael Kruse // CK0-DAG: [[MEMBER]] 173d47b9438SMichael Kruse // CK0-DAG: br i1 false, label %[[LTYPE:[^,]+]], label %[[MEMBERCOM:[^,]+]] 174d47b9438SMichael Kruse // CK0-DAG: [[MEMBERCOM]] 175d47b9438SMichael Kruse // 281474976710659 == 0x1,000,000,003 176d47b9438SMichael Kruse // CK0-DAG: [[MEMBERCOMTYPE:%.+]] = add nuw i64 281474976710659, [[SHIPRESIZE]] 177d47b9438SMichael Kruse // CK0-DAG: br label %[[LTYPE]] 178d47b9438SMichael Kruse // CK0-DAG: [[LTYPE]] 179d47b9438SMichael Kruse // CK0-DAG: [[MEMBERTYPE:%.+]] = phi i64 [ 281474976710659, %[[MEMBER]] ], [ [[MEMBERCOMTYPE]], %[[MEMBERCOM]] ] 180d47b9438SMichael Kruse // CK0-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 181d47b9438SMichael Kruse // CK0-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 182d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 183d47b9438SMichael Kruse // CK0-DAG: [[ALLOC]] 184d47b9438SMichael Kruse // CK0-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 185d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND:[^,]+]] 186d47b9438SMichael Kruse // CK0-DAG: [[ALLOCELSE]] 187d47b9438SMichael Kruse // CK0-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 188d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 189d47b9438SMichael Kruse // CK0-DAG: [[TO]] 190d47b9438SMichael Kruse // CK0-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 191d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 192d47b9438SMichael Kruse // CK0-DAG: [[TOELSE]] 193d47b9438SMichael Kruse // CK0-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 194d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 195d47b9438SMichael Kruse // CK0-DAG: [[FROM]] 196d47b9438SMichael Kruse // CK0-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 197d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 198d47b9438SMichael Kruse // CK0-DAG: [[TYEND]] 199d47b9438SMichael Kruse // CK0-DAG: [[TYPE1:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 200d47b9438SMichael Kruse // CK0: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR1BC]], i8* [[PTRADDR1BC]], i64 4, i64 [[TYPE1]]) 201d47b9438SMichael Kruse // CK0-DAG: [[BPTRADDR2BC:%.+]] = bitcast double** [[BBEGIN]] to i8* 202d47b9438SMichael Kruse // CK0-DAG: [[PTRADDR2BC:%.+]] = bitcast double* [[BARRBEGINGEP]] to i8* 203d47b9438SMichael Kruse // CK0-DAG: br label %[[MEMBER:[^,]+]] 204d47b9438SMichael Kruse // CK0-DAG: [[MEMBER]] 205d47b9438SMichael Kruse // CK0-DAG: br i1 false, label %[[LTYPE:[^,]+]], label %[[MEMBERCOM:[^,]+]] 206d47b9438SMichael Kruse // CK0-DAG: [[MEMBERCOM]] 207d47b9438SMichael Kruse // 281474976710675 == 0x1,000,000,013 208d47b9438SMichael Kruse // CK0-DAG: [[MEMBERCOMTYPE:%.+]] = add nuw i64 281474976710675, [[SHIPRESIZE]] 209d47b9438SMichael Kruse // CK0-DAG: br label %[[LTYPE]] 210d47b9438SMichael Kruse // CK0-DAG: [[LTYPE]] 211d47b9438SMichael Kruse // CK0-DAG: [[MEMBERTYPE:%.+]] = phi i64 [ 281474976710675, %[[MEMBER]] ], [ [[MEMBERCOMTYPE]], %[[MEMBERCOM]] ] 212d47b9438SMichael Kruse // CK0-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 213d47b9438SMichael Kruse // CK0-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 214d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 215d47b9438SMichael Kruse // CK0-DAG: [[ALLOC]] 216d47b9438SMichael Kruse // CK0-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 217d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND:[^,]+]] 218d47b9438SMichael Kruse // CK0-DAG: [[ALLOCELSE]] 219d47b9438SMichael Kruse // CK0-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 220d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 221d47b9438SMichael Kruse // CK0-DAG: [[TO]] 222d47b9438SMichael Kruse // CK0-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 223d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 224d47b9438SMichael Kruse // CK0-DAG: [[TOELSE]] 225d47b9438SMichael Kruse // CK0-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 226d47b9438SMichael Kruse // CK0-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 227d47b9438SMichael Kruse // CK0-DAG: [[FROM]] 228d47b9438SMichael Kruse // CK0-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 229d47b9438SMichael Kruse // CK0-DAG: br label %[[TYEND]] 230d47b9438SMichael Kruse // CK0-DAG: [[TYEND]] 231d47b9438SMichael Kruse // CK0-DAG: [[TYPE2:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 232d47b9438SMichael Kruse // CK0: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR2BC]], i8* [[PTRADDR2BC]], i64 16, i64 [[TYPE2]]) 233d47b9438SMichael Kruse // CK0: [[PTRNEXT]] = getelementptr %class.C*, %class.C** [[PTR]], i32 1 234d47b9438SMichael Kruse // CK0: [[ISDONE:%.+]] = icmp eq %class.C** [[PTRNEXT]], [[PTREND]] 235d47b9438SMichael Kruse // CK0: br i1 [[ISDONE]], label %[[LEXIT:[^,]+]], label %[[LBODY]] 236d47b9438SMichael Kruse 237d47b9438SMichael Kruse // CK0: [[LEXIT]] 238d47b9438SMichael Kruse // CK0: [[ISARRAY:%.+]] = icmp sge i64 [[SIZE]], 1 239d47b9438SMichael Kruse // CK0: br i1 [[ISARRAY]], label %[[EVALDEL:[^,]+]], label %[[DONE]] 240d47b9438SMichael Kruse // CK0: [[EVALDEL]] 241d47b9438SMichael Kruse // CK0: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 242d47b9438SMichael Kruse // CK0: [[ISDEL:%.+]] = icmp ne i64 [[TYPEDEL]], 0 243d47b9438SMichael Kruse // CK0: br i1 [[ISDEL]], label %[[DEL:[^,]+]], label %[[DONE]] 244d47b9438SMichael Kruse // CK0: [[DEL]] 245d47b9438SMichael Kruse // CK0-64-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 246d47b9438SMichael Kruse // CK0-32-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 8 247d47b9438SMichael Kruse // CK0-DAG: [[DTYPE:%.+]] = and i64 [[TYPE]], -4 248d47b9438SMichael Kruse // CK0: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[DTYPE]]) 249d47b9438SMichael Kruse // CK0: br label %[[DONE]] 250d47b9438SMichael Kruse // CK0: [[DONE]] 251d47b9438SMichael Kruse // CK0: ret void 252d47b9438SMichael Kruse 253d47b9438SMichael Kruse 254d47b9438SMichael Kruse // CK0-LABEL: define {{.*}}void @{{.*}}foo{{.*}} 2554304e9d1SMichael Kruse void foo(int a){ 2564304e9d1SMichael Kruse int i = a; 2574304e9d1SMichael Kruse C c; 2584304e9d1SMichael Kruse c.a = a; 2594304e9d1SMichael Kruse 260537b16e9SGeorge Rokos // CK0-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i8** [[MPRGEP:%.+]]) 261d47b9438SMichael Kruse // CK0-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 262d47b9438SMichael Kruse // CK0-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 263537b16e9SGeorge Rokos // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%[^,]+]] to i8** 264d47b9438SMichael Kruse // CK0-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 265d47b9438SMichael Kruse // CK0-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 266537b16e9SGeorge Rokos // CK0-DAG: [[MPR1:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i[[sz]] 0, i[[sz]] 0 267d47b9438SMichael Kruse // CK0-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to %class.C** 268d47b9438SMichael Kruse // CK0-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to %class.C** 269d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL:%[^,]+]], %class.C** [[CBP1]] 270d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL]], %class.C** [[CP1]] 271537b16e9SGeorge Rokos // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[MPR1]] 272ebb1092aSShilei Tian // CK0: call void [[KERNEL_1:@.+]](%class.C* [[VAL]]) 2734304e9d1SMichael Kruse #pragma omp target map(mapper(id),tofrom: c) 2744304e9d1SMichael Kruse { 2754304e9d1SMichael Kruse ++c.a; 2764304e9d1SMichael Kruse } 27701f670dfSMichael Kruse 278ebb1092aSShilei Tian // CK0: [[BP2GEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[OFFLOAD_BP2:%[^,]+]], i32 0, i32 0 279ebb1092aSShilei Tian // CK0: [[BP2CAST:%.+]] = bitcast i8** [[BP2GEP]] to %class.C** 280ebb1092aSShilei Tian // CK0: store %class.C* [[CADDR:%[^,]+]], %class.C** [[BP2CAST]], align 281ebb1092aSShilei Tian // CK0: [[P2GEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[OFFLOAD_P2:%[^,]+]], i32 0, i32 0 282ebb1092aSShilei Tian // CK0: [[P2CAST:%.+]] = bitcast i8** [[P2GEP]] to %class.C** 283ebb1092aSShilei Tian // CK0: store %class.C* [[CADDR]], %class.C** [[P2CAST]], align 284ebb1092aSShilei Tian // CK0: [[MAPPER2GEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[OFFLOAD_MAPPER2:%[^,]+]], i[[SZ]] 0, i[[SZ]] 0 285ebb1092aSShilei Tian // CK0: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[MAPPER2GEP]], align 286ebb1092aSShilei Tian // CK0: [[BP2:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[OFFLOAD_BP2]], i32 0, i32 0 287ebb1092aSShilei Tian // CK0: [[P2:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[OFFLOAD_P2]], i32 0, i32 0 288ebb1092aSShilei Tian // CK0: [[MAPPER2:%.+]] = bitcast [1 x i8*]* [[OFFLOAD_MAPPER2]] to i8** 289ebb1092aSShilei 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) 290ebb1092aSShilei 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) 291ebb1092aSShilei Tian // CK0: [[TASK_CAST:%.+]] = bitcast i8* [[TASK]] to [[KMP_TASK_T_WITH_PRIVATES]]* 292ebb1092aSShilei Tian // CK0: [[TASK_WITH_PRIVATES:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES]], [[KMP_TASK_T_WITH_PRIVATES]]* [[TASK_CAST]], i32 0, i32 1 293ebb1092aSShilei Tian // CK0: {{.+}} = call i32 @__kmpc_omp_task([[IDENT_T]]* @1, i32 {{.+}}, i8* [[TASK]]) 294537b16e9SGeorge Rokos #pragma omp target map(mapper(id),tofrom: c) nowait 295537b16e9SGeorge Rokos { 296537b16e9SGeorge Rokos ++c.a; 297537b16e9SGeorge Rokos } 298537b16e9SGeorge Rokos 299537b16e9SGeorge Rokos // CK0-DAG: call i32 @__tgt_target_teams_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[TEAMSIZES]]{{.+}}, {{.+}}[[TEAMTYPES]]{{.+}}, i8** [[MPRGEP:%.+]], i32 0, i32 0) 300537b16e9SGeorge Rokos // CK0-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 301537b16e9SGeorge Rokos // CK0-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 302537b16e9SGeorge Rokos // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%[^,]+]] to i8** 303537b16e9SGeorge Rokos // CK0-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 304537b16e9SGeorge Rokos // CK0-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 305537b16e9SGeorge Rokos // CK0-DAG: [[MPR1:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i[[sz]] 0, i[[sz]] 0 306537b16e9SGeorge Rokos // CK0-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to %class.C** 307537b16e9SGeorge Rokos // CK0-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to %class.C** 308537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL:%[^,]+]], %class.C** [[CBP1]] 309537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL]], %class.C** [[CP1]] 310537b16e9SGeorge Rokos // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[MPR1]] 311ebb1092aSShilei Tian // CK0: call void [[KERNEL_3:@.+]](%class.C* [[VAL]]) 312537b16e9SGeorge Rokos #pragma omp target teams map(mapper(id),to: c) 313537b16e9SGeorge Rokos { 314537b16e9SGeorge Rokos ++c.a; 315537b16e9SGeorge Rokos } 316537b16e9SGeorge Rokos 317ebb1092aSShilei 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) 318ebb1092aSShilei 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) 319ebb1092aSShilei Tian // CK0: [[TASK_CAST_1:%.+]] = bitcast i8* [[TASK_1]] to [[KMP_TASK_T_WITH_PRIVATES_1]]* 320ebb1092aSShilei 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 321ebb1092aSShilei Tian // CK0: {{.+}} = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_CAST_GET_1]], i32 0, i32 0 322ebb1092aSShilei Tian // CK0: {{.+}} = call i32 @__kmpc_omp_task([[IDENT_T]]* @1, i32 {{.+}}, i8* [[TASK_1]]) 323537b16e9SGeorge Rokos #pragma omp target teams map(mapper(id),to: c) nowait 324537b16e9SGeorge Rokos { 325537b16e9SGeorge Rokos ++c.a; 326537b16e9SGeorge Rokos } 327537b16e9SGeorge Rokos 328537b16e9SGeorge Rokos // CK0-DAG: call void @__tgt_target_data_begin_mapper(i64 {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[EDSIZES]]{{.+}}, {{.+}}[[EDTYPES]]{{.+}}, i8** [[MPRGEP:%.+]]) 329537b16e9SGeorge Rokos // CK0-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 330537b16e9SGeorge Rokos // CK0-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 331537b16e9SGeorge Rokos // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%[^,]+]] to i8** 332537b16e9SGeorge Rokos // CK0-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 333537b16e9SGeorge Rokos // CK0-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 334537b16e9SGeorge Rokos // CK0-DAG: [[MPR1:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i[[sz]] 0, i[[sz]] 0 335537b16e9SGeorge Rokos // CK0-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to %class.C** 336537b16e9SGeorge Rokos // CK0-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to %class.C** 337537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL:%[^,]+]], %class.C** [[CBP1]] 338537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL]], %class.C** [[CP1]] 339537b16e9SGeorge Rokos // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[MPR1]] 340537b16e9SGeorge Rokos #pragma omp target enter data map(mapper(id),to: c) 341537b16e9SGeorge Rokos 342*0661328dSShilei Tian // CK0-DAG: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{[^,]+}}, i32 %{{[^,]+}}, i8* [[TASK_2:%.+]]) 343*0661328dSShilei 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) 344*0661328dSShilei Tian // CK0-DAG: [[TASK_WITH_PRIVATES:%.+]] = bitcast i8* [[TASK_2]] to [[KMP_TASK_T_WITH_PRIVATES_4]]* 345*0661328dSShilei 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 346*0661328dSShilei Tian // CK0-32-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 1 347*0661328dSShilei Tian // CK0-64-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 0 348*0661328dSShilei Tian // CK0-DAG: [[FPBPADDR:%.+]] = bitcast [1 x i8*]* [[FPBPGEP]] to i8* 349*0661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP:%.+]] to i8* 350*0661328dSShilei 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) 351*0661328dSShilei Tian // CK0-DAG: [[BPGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0 352*0661328dSShilei Tian // CK0-DAG: [[BPGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0 353*0661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP]] to %class.C** 354*0661328dSShilei Tian // CK0-DAG: store %class.C* [[C:%[^,]+]], %class.C** [[BPADDR]], align 355*0661328dSShilei Tian // CK0-32-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 2 356*0661328dSShilei Tian // CK0-64-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 1 357*0661328dSShilei Tian // CK0-DAG: [[FPPADDR:%.+]] = bitcast [1 x i8*]* [[FPPGEP]] to i8* 358*0661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP:%.+]] to i8* 359*0661328dSShilei 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) 360*0661328dSShilei Tian // CK0-DAG: [[PGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0 361*0661328dSShilei Tian // CK0-DAG: [[PGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0 362*0661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP]] to %class.C** 363*0661328dSShilei Tian // CK0-DAG: store %class.C* [[C]], %class.C** [[PADDR]], align 364*0661328dSShilei Tian // CK0-32-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 0 365*0661328dSShilei Tian // CK0-64-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 2 366*0661328dSShilei Tian // CK0-DAG: [[FPSZADDR:%.+]] = bitcast [1 x i64]* [[FPSZGEP]] to i8* 367*0661328dSShilei 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) 368*0661328dSShilei Tian // CK0-DAG: [[FPMPRGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_5]], [[KMP_PRIVATES_T_5]]* [[PRIVATES]], i32 0, i32 3 369*0661328dSShilei Tian // CK0-DAG: [[FPMPRADDR:%.+]] = bitcast [1 x i8*]* [[FPMPRGEP]] to i8* 370*0661328dSShilei Tian // CK0-DAG: [[MPRADDR:%.+]] = bitcast i8** [[MPRGEP:%.+]] to i8* 371*0661328dSShilei 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) 372*0661328dSShilei Tian // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%.+]] to i8** 373*0661328dSShilei Tian // CK0-DAG: [[MPRGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPR]], i[[sz]] 0, i[[sz]] 0 374*0661328dSShilei Tian // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[MPRGEP]], align 375537b16e9SGeorge Rokos #pragma omp target enter data map(mapper(id),to: c) nowait 376537b16e9SGeorge Rokos 377537b16e9SGeorge Rokos // CK0-DAG: call void @__tgt_target_data_end_mapper(i64 {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[EXDSIZES]]{{.+}}, {{.+}}[[EXDTYPES]]{{.+}}, i8** [[MPRGEP:%.+]]) 378537b16e9SGeorge Rokos // CK0-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 379537b16e9SGeorge Rokos // CK0-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 380537b16e9SGeorge Rokos // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%[^,]+]] to i8** 381537b16e9SGeorge Rokos // CK0-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 382537b16e9SGeorge Rokos // CK0-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 383537b16e9SGeorge Rokos // CK0-DAG: [[MPR1:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i[[sz]] 0, i[[sz]] 0 384537b16e9SGeorge Rokos // CK0-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to %class.C** 385537b16e9SGeorge Rokos // CK0-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to %class.C** 386537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL:%[^,]+]], %class.C** [[CBP1]] 387537b16e9SGeorge Rokos // CK0-DAG: store %class.C* [[VAL]], %class.C** [[CP1]] 388537b16e9SGeorge Rokos // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[MPR1]] 389537b16e9SGeorge Rokos #pragma omp target exit data map(mapper(id),from: c) 390537b16e9SGeorge Rokos 391*0661328dSShilei Tian // CK0-DAG: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{[^,]+}}, i32 %{{[^,]+}}, i8* [[TASK_3:%.+]]) 392*0661328dSShilei 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) 393*0661328dSShilei Tian // CK0-DAG: [[TASK_WITH_PRIVATES:%.+]] = bitcast i8* [[TASK_3]] to [[KMP_TASK_T_WITH_PRIVATES_7]]* 394*0661328dSShilei 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 395*0661328dSShilei Tian // CK0-32-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 1 396*0661328dSShilei Tian // CK0-64-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 0 397*0661328dSShilei Tian // CK0-DAG: [[FPBPADDR:%.+]] = bitcast [1 x i8*]* [[FPBPGEP]] to i8* 398*0661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP:%.+]] to i8* 399*0661328dSShilei 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) 400*0661328dSShilei Tian // CK0-DAG: [[BPGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0 401*0661328dSShilei Tian // CK0-DAG: [[BPGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0 402*0661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP]] to %class.C** 403*0661328dSShilei Tian // CK0-DAG: store %class.C* [[C:%[^,]+]], %class.C** [[BPADDR]], align 404*0661328dSShilei Tian // CK0-32-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 2 405*0661328dSShilei Tian // CK0-64-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 1 406*0661328dSShilei Tian // CK0-DAG: [[FPPADDR:%.+]] = bitcast [1 x i8*]* [[FPPGEP]] to i8* 407*0661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP:%.+]] to i8* 408*0661328dSShilei 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) 409*0661328dSShilei Tian // CK0-DAG: [[PGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0 410*0661328dSShilei Tian // CK0-DAG: [[PGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0 411*0661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP]] to %class.C** 412*0661328dSShilei Tian // CK0-DAG: store %class.C* [[C]], %class.C** [[PADDR]], align 413*0661328dSShilei Tian // CK0-32-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 0 414*0661328dSShilei Tian // CK0-64-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 2 415*0661328dSShilei Tian // CK0-DAG: [[FPSZADDR:%.+]] = bitcast [1 x i64]* [[FPSZGEP]] to i8* 416*0661328dSShilei 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) 417*0661328dSShilei Tian // CK0-DAG: [[FPMPRGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_8]], [[KMP_PRIVATES_T_8]]* [[PRIVATES]], i32 0, i32 3 418*0661328dSShilei Tian // CK0-DAG: [[FPMPRADDR:%.+]] = bitcast [1 x i8*]* [[FPMPRGEP]] to i8* 419*0661328dSShilei Tian // CK0-DAG: [[MPRADDR:%.+]] = bitcast i8** [[MPRGEP:%.+]] to i8* 420*0661328dSShilei 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) 421*0661328dSShilei Tian // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%.+]] to i8** 422*0661328dSShilei Tian // CK0-DAG: [[MPRGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPR]], i[[sz]] 0, i[[sz]] 0 423*0661328dSShilei Tian // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[MPRGEP]], align 424537b16e9SGeorge Rokos #pragma omp target exit data map(mapper(id),from: c) nowait 425537b16e9SGeorge Rokos 426537b16e9SGeorge Rokos // CK0-DAG: call void @__tgt_target_data_update_mapper(i64 -1, i32 1, i8** [[TGEPBP:%.+]], i8** [[TGEPP:%.+]], i64* getelementptr {{.+}}[1 x i64]* [[TSIZES]], i32 0, i32 0), {{.+}}getelementptr {{.+}}[1 x i64]* [[TTYPES]]{{.+}}, i8** [[TMPRGEP:%.+]]) 427d47b9438SMichael Kruse // CK0-DAG: [[TGEPBP]] = getelementptr inbounds {{.+}}[[TBP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 428d47b9438SMichael Kruse // CK0-DAG: [[TGEPP]] = getelementptr inbounds {{.+}}[[TP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 429537b16e9SGeorge Rokos // CK0-DAG: [[TMPRGEP]] = bitcast [1 x i8*]* [[TMPR:%[^,]+]] to i8** 430d47b9438SMichael Kruse // CK0-DAG: [[TBP0:%.+]] = getelementptr inbounds {{.+}}[[TBP]], i{{.+}} 0, i{{.+}} 0 431d47b9438SMichael Kruse // CK0-DAG: [[TP0:%.+]] = getelementptr inbounds {{.+}}[[TP]], i{{.+}} 0, i{{.+}} 0 432537b16e9SGeorge Rokos // CK0-DAG: [[TMPR1:%.+]] = getelementptr inbounds {{.+}}[[TMPR]], i[[sz]] 0, i[[sz]] 0 433d47b9438SMichael Kruse // CK0-DAG: [[TCBP0:%.+]] = bitcast i8** [[TBP0]] to %class.C** 434d47b9438SMichael Kruse // CK0-DAG: [[TCP0:%.+]] = bitcast i8** [[TP0]] to %class.C** 435d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL]], %class.C** [[TCBP0]] 436d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL]], %class.C** [[TCP0]] 437537b16e9SGeorge Rokos // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[TMPR1]] 43801f670dfSMichael Kruse #pragma omp target update to(mapper(id): c) 4390336c75cSMichael Kruse 440537b16e9SGeorge Rokos // CK0-DAG: call void @__tgt_target_data_update_mapper(i64 -1, i32 1, i8** [[FGEPBP:%.+]], i8** [[FGEPP:%.+]], i64* getelementptr {{.+}}[1 x i64]* [[FSIZES]], i32 0, i32 0), {{.+}}getelementptr {{.+}}[1 x i64]* [[FTYPES]]{{.+}}, i8** [[FMPRGEP:%.+]]) 441d47b9438SMichael Kruse // CK0-DAG: [[FGEPBP]] = getelementptr inbounds {{.+}}[[FBP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 442d47b9438SMichael Kruse // CK0-DAG: [[FGEPP]] = getelementptr inbounds {{.+}}[[FP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 443537b16e9SGeorge Rokos // CK0-DAG: [[FMPRGEP]] = bitcast [1 x i8*]* [[FMPR:%[^,]+]] to i8** 444d47b9438SMichael Kruse // CK0-DAG: [[FBP0:%.+]] = getelementptr inbounds {{.+}}[[FBP]], i{{.+}} 0, i{{.+}} 0 445d47b9438SMichael Kruse // CK0-DAG: [[FP0:%.+]] = getelementptr inbounds {{.+}}[[FP]], i{{.+}} 0, i{{.+}} 0 446537b16e9SGeorge Rokos // CK0-DAG: [[FMPR1:%.+]] = getelementptr inbounds {{.+}}[[FMPR]], i[[sz]] 0, i[[sz]] 0 447d47b9438SMichael Kruse // CK0-DAG: [[FCBP0:%.+]] = bitcast i8** [[FBP0]] to %class.C** 448d47b9438SMichael Kruse // CK0-DAG: [[FCP0:%.+]] = bitcast i8** [[FP0]] to %class.C** 449d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL]], %class.C** [[FCBP0]] 450d47b9438SMichael Kruse // CK0-DAG: store %class.C* [[VAL]], %class.C** [[FCP0]] 451537b16e9SGeorge Rokos // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[FMPR1]] 4520336c75cSMichael Kruse #pragma omp target update from(mapper(id): c) 453537b16e9SGeorge Rokos 454*0661328dSShilei Tian // CK0-DAG: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{[^,]+}}, i32 %{{[^,]+}}, i8* [[TASK_4:%.+]]) 455*0661328dSShilei 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) 456*0661328dSShilei Tian // CK0-DAG: [[TASK_WITH_PRIVATES:%.+]] = bitcast i8* [[TASK_4]] to [[KMP_TASK_T_WITH_PRIVATES_10]]* 457*0661328dSShilei 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 458*0661328dSShilei Tian // CK0-32-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 1 459*0661328dSShilei Tian // CK0-64-DAG: [[FPBPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 0 460*0661328dSShilei Tian // CK0-DAG: [[FPBPADDR:%.+]] = bitcast [1 x i8*]* [[FPBPGEP]] to i8* 461*0661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP:%.+]] to i8* 462*0661328dSShilei 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) 463*0661328dSShilei Tian // CK0-DAG: [[BPGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP:%.+]], i32 0, i32 0 464*0661328dSShilei Tian // CK0-DAG: [[BPGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BP]], i32 0, i32 0 465*0661328dSShilei Tian // CK0-DAG: [[BPADDR:%.+]] = bitcast i8** [[BPGEP]] to %class.C** 466*0661328dSShilei Tian // CK0-DAG: store %class.C* [[C:%[^,]+]], %class.C** [[BPADDR]], align 467*0661328dSShilei Tian // CK0-32-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 2 468*0661328dSShilei Tian // CK0-64-DAG: [[FPPGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 1 469*0661328dSShilei Tian // CK0-DAG: [[FPPADDR:%.+]] = bitcast [1 x i8*]* [[FPPGEP]] to i8* 470*0661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP:%.+]] to i8* 471*0661328dSShilei 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) 472*0661328dSShilei Tian // CK0-DAG: [[PGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P:%.+]], i32 0, i32 0 473*0661328dSShilei Tian // CK0-DAG: [[PGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[P]], i32 0, i32 0 474*0661328dSShilei Tian // CK0-DAG: [[PADDR:%.+]] = bitcast i8** [[PGEP]] to %class.C** 475*0661328dSShilei Tian // CK0-DAG: store %class.C* [[C]], %class.C** [[PADDR]], align 476*0661328dSShilei Tian // CK0-32-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 0 477*0661328dSShilei Tian // CK0-64-DAG: [[FPSZGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 2 478*0661328dSShilei Tian // CK0-DAG: [[FPSZADDR:%.+]] = bitcast [1 x i64]* [[FPSZGEP]] to i8* 479*0661328dSShilei 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) 480*0661328dSShilei Tian // CK0-DAG: [[FPMPRGEP:%.+]] = getelementptr inbounds [[KMP_PRIVATES_T_11]], [[KMP_PRIVATES_T_11]]* [[PRIVATES]], i32 0, i32 3 481*0661328dSShilei Tian // CK0-DAG: [[FPMPRADDR:%.+]] = bitcast [1 x i8*]* [[FPMPRGEP]] to i8* 482*0661328dSShilei Tian // CK0-DAG: [[MPRADDR:%.+]] = bitcast i8** [[MPRGEP:%.+]] to i8* 483*0661328dSShilei 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) 484*0661328dSShilei Tian // CK0-DAG: [[MPRGEP]] = bitcast [1 x i8*]* [[MPR:%.+]] to i8** 485*0661328dSShilei Tian // CK0-DAG: [[MPRGEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPR]], i[[sz]] 0, i[[sz]] 0 486*0661328dSShilei Tian // CK0-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[MPRGEP]], align 487537b16e9SGeorge Rokos #pragma omp target update from(mapper(id): c) nowait 4884304e9d1SMichael Kruse } 4894304e9d1SMichael Kruse 4904304e9d1SMichael Kruse 491ebb1092aSShilei Tian // CK0: define internal void [[KERNEL_1]](%class.C* {{.+}}[[ARG:%.+]]) 492d47b9438SMichael Kruse // CK0: [[ADDR:%.+]] = alloca %class.C*, 493d47b9438SMichael Kruse // CK0: store %class.C* [[ARG]], %class.C** [[ADDR]] 494d47b9438SMichael Kruse // CK0: [[CADDR:%.+]] = load %class.C*, %class.C** [[ADDR]] 495d47b9438SMichael Kruse // CK0: [[CAADDR:%.+]] = getelementptr inbounds %class.C, %class.C* [[CADDR]], i32 0, i32 0 496d47b9438SMichael Kruse // CK0: [[VAL:%[^,]+]] = load i32, i32* [[CAADDR]] 497d47b9438SMichael Kruse // CK0: {{.+}} = add nsw i32 [[VAL]], 1 498d47b9438SMichael Kruse // CK0: } 499d47b9438SMichael Kruse 500ebb1092aSShilei Tian // CK0: define internal void [[KERNEL_2:@.+]](%class.C* {{.+}}[[ARG:%.+]]) 501ebb1092aSShilei Tian // CK0: [[ADDR:%.+]] = alloca %class.C*, 502ebb1092aSShilei Tian // CK0: store %class.C* [[ARG]], %class.C** [[ADDR]] 503ebb1092aSShilei Tian // CK0: [[CADDR:%.+]] = load %class.C*, %class.C** [[ADDR]] 504ebb1092aSShilei Tian // CK0: [[CAADDR:%.+]] = getelementptr inbounds %class.C, %class.C* [[CADDR]], i32 0, i32 0 505ebb1092aSShilei Tian // CK0: [[VAL:%[^,]+]] = load i32, i32* [[CAADDR]] 506ebb1092aSShilei Tian // CK0: {{.+}} = add nsw i32 [[VAL]], 1 507ebb1092aSShilei Tian // CK0: } 508ebb1092aSShilei Tian 509ebb1092aSShilei Tian // CK0: define internal void [[OUTLINED:@.+]](i32 {{.*}}{{[^,]+}}, [[ANON_T]]* noalias [[CTXARG:%.+]]) 510ebb1092aSShilei Tian // CK0-DAG: call i32 @__tgt_target_nowait_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZEGEP:%[0-9]+]], {{.+}}[[NWTYPES]]{{.+}}, i8** [[MPRGEP:%.+]]) 511ebb1092aSShilei Tian // CK0-DAG: [[BPGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 512ebb1092aSShilei Tian // CK0-DAG: [[PGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 513ebb1092aSShilei Tian // CK0-DAG: [[SIZEGEP]] = getelementptr inbounds [1 x i64], [1 x i64]* [[SIZEFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 514ebb1092aSShilei Tian // CK0-DAG: [[MPRGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPRFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 515ebb1092aSShilei Tian // CK0-DAG: [[BPFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_BP:%.+]], align 516ebb1092aSShilei Tian // CK0-DAG: [[PFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_P:%.+]], align 517ebb1092aSShilei Tian // CK0-DAG: [[SIZEFPADDR]] = load [1 x i64]*, [1 x i64]** [[FPPTRADDR_SIZE:%.+]], align 518ebb1092aSShilei Tian // CK0-DAG: [[MPRFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_MPR:%.+]], align 519ebb1092aSShilei Tian // CK0-DAG: call void (i8*, ...) %1(i8* %2, {{.+}}[[FPPTRADDR_BP]], {{.+}}[[FPPTRADDR_P]], {{.+}}[[FPPTRADDR_SIZE]], {{.+}}[[FPPTRADDR_MPR]]) 520ebb1092aSShilei Tian // CK0-DAG: call void [[KERNEL_2:@.+]](%class.C* [[KERNELARG:%.+]]) 521ebb1092aSShilei Tian // CK0-DAG: [[KERNELARG]] = load %class.C*, %class.C** [[KERNELARGGEP:%.+]], align 522ebb1092aSShilei Tian // CK0-DAG: [[KERNELARGGEP]] = getelementptr inbounds [[ANON_T]], [[ANON_T]]* [[CTX:%.+]], i32 0, i32 0 523ebb1092aSShilei Tian // CK0-DAG: [[CTX]] = load [[ANON_T]]*, [[ANON_T]]** [[CTXADDR:%.+]], align 524ebb1092aSShilei Tian // CK0-DAG: store [[ANON_T]]* [[CTXARG]], [[ANON_T]]** [[CTXADDR]], align 525ebb1092aSShilei Tian // CK0: } 526ebb1092aSShilei Tian 527ebb1092aSShilei Tian // CK0: define internal {{.*}}i32 [[TASK_ENTRY]](i32 {{.*}}%0, [[KMP_TASK_T_WITH_PRIVATES]]* noalias %1) 528ebb1092aSShilei Tian // CK0: store [[KMP_TASK_T_WITH_PRIVATES]]* %1, [[KMP_TASK_T_WITH_PRIVATES]]** [[ADDR:%.+]], align 529ebb1092aSShilei Tian // CK0: [[TASK_T_WITH_PRIVATES:%.+]] = load [[KMP_TASK_T_WITH_PRIVATES]]*, [[KMP_TASK_T_WITH_PRIVATES]]** [[ADDR]], align 530ebb1092aSShilei Tian // CK0: [[TASKGEP:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES]], [[KMP_TASK_T_WITH_PRIVATES]]* [[TASK_T_WITH_PRIVATES]], i32 0, i32 0 531ebb1092aSShilei Tian // CK0: [[SHAREDSGEP:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASKGEP]], i32 0, i32 0 532ebb1092aSShilei Tian // CK0: [[SHAREDS:%.+]] = load i8*, i8** [[SHAREDSGEP]], align 533ebb1092aSShilei Tian // CK0: [[ANON:%.+]] = bitcast i8* [[SHAREDS]] to [[ANON_T]]* 534ebb1092aSShilei Tian // CK0: [[PRIVATESGEP:%.+]] = getelementptr inbounds [[KMP_TASK_T_WITH_PRIVATES]], [[KMP_TASK_T_WITH_PRIVATES]]* [[TASK_T_WITH_PRIVATES]], i32 0, i32 1 535ebb1092aSShilei Tian // CK0: [[PRIVATES:%.+]] = bitcast [[KMP_PRIVATES_T]]* [[PRIVATESGEP]] to i8* 536ebb1092aSShilei Tian // CK0: [[TASK_WITH_PRIVATES:%.+]] = bitcast [[KMP_TASK_T_WITH_PRIVATES]]* [[TASK_T_WITH_PRIVATES]] to i8* 537ebb1092aSShilei Tian // CK0: call void [[OUTLINED]](i32 {{%.+}}, i32* {{%.+}}, i8* [[PRIVATES]], {{.+}}, i8* [[TASK_WITH_PRIVATES]], [[ANON_T]]* [[ANON]]) 538ebb1092aSShilei Tian // CK0: } 539ebb1092aSShilei Tian 540ebb1092aSShilei Tian // CK0: define internal void [[OUTLINE_1:@.+]](i32 {{.*}}%.global_tid.{{.+}}, [[ANON_T_0]]* noalias [[CTXARG:%.+]]) 541ebb1092aSShilei Tian // CK0-DAG: call i32 @__tgt_target_teams_nowait_mapper(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SIZEGEP:%[0-9]+]], {{.+}}[[TEAMNWTYPES]]{{.+}}, i8** [[MPRGEP:%.+]], i32 0, i32 0) 542ebb1092aSShilei Tian // CK0-DAG: [[BPGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 543ebb1092aSShilei Tian // CK0-DAG: [[PGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 544ebb1092aSShilei Tian // CK0-DAG: [[SIZEGEP]] = getelementptr inbounds [1 x i64], [1 x i64]* [[SIZEFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 545ebb1092aSShilei Tian // CK0-DAG: [[MPRGEP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPRFPADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0 546ebb1092aSShilei Tian // CK0-DAG: [[BPFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_BP:%.+]], align 547ebb1092aSShilei Tian // CK0-DAG: [[PFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_P:%.+]], align 548ebb1092aSShilei Tian // CK0-DAG: [[SIZEFPADDR]] = load [1 x i64]*, [1 x i64]** [[FPPTRADDR_SIZE:%.+]], align 549ebb1092aSShilei Tian // CK0-DAG: [[MPRFPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPTRADDR_MPR:%.+]], align 550ebb1092aSShilei Tian // CK0-DAG: call void (i8*, ...) %1(i8* %2, {{.+}}[[FPPTRADDR_BP]], {{.+}}[[FPPTRADDR_P]], {{.+}}[[FPPTRADDR_SIZE]], {{.+}}[[FPPTRADDR_MPR]]) 551ebb1092aSShilei Tian // CK0-DAG: call void [[KERNEL_2:@.+]](%class.C* [[KERNELARG:%.+]]) 552ebb1092aSShilei Tian // CK0-DAG: [[KERNELARG]] = load %class.C*, %class.C** [[KERNELARGGEP:%.+]], align 553ebb1092aSShilei Tian // CK0-DAG: [[KERNELARGGEP]] = getelementptr inbounds [[ANON_T_0]], [[ANON_T_0]]* [[CTX:%.+]], i32 0, i32 0 554ebb1092aSShilei Tian // CK0-DAG: [[CTX]] = load [[ANON_T_0]]*, [[ANON_T_0]]** [[CTXADDR:%.+]], align 555ebb1092aSShilei Tian // CK0-DAG: store [[ANON_T_0]]* [[CTXARG]], [[ANON_T_0]]** [[CTXADDR]], align 556ebb1092aSShilei Tian // CK0: } 557ebb1092aSShilei Tian 558ebb1092aSShilei Tian // CK0: define internal {{.*}}i32 [[TASK_ENTRY_1]](i32 {{.*}}%0, [[KMP_TASK_T_WITH_PRIVATES_1]]* noalias %1) 559ebb1092aSShilei Tian // CK0: store [[KMP_TASK_T_WITH_PRIVATES_1]]* %1, [[KMP_TASK_T_WITH_PRIVATES_1]]** [[ADDR:%.+]], align 560ebb1092aSShilei Tian // CK0: [[TASK_T_WITH_PRIVATES:%.+]] = load [[KMP_TASK_T_WITH_PRIVATES_1]]*, [[KMP_TASK_T_WITH_PRIVATES_1]]** [[ADDR]], align 561ebb1092aSShilei 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 562ebb1092aSShilei Tian // CK0: [[SHAREDSGEP:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASKGEP]], i32 0, i32 0 563ebb1092aSShilei Tian // CK0: [[SHAREDS:%.+]] = load i8*, i8** [[SHAREDSGEP]], align 564ebb1092aSShilei Tian // CK0: [[ANON:%.+]] = bitcast i8* [[SHAREDS]] to [[ANON_T_0]]* 565ebb1092aSShilei 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 566ebb1092aSShilei Tian // CK0: [[PRIVATES:%.+]] = bitcast [[KMP_PRIVATES_T_2]]* [[PRIVATESGEP]] to i8* 567ebb1092aSShilei Tian // CK0: [[TASK_WITH_PRIVATES:%.+]] = bitcast [[KMP_TASK_T_WITH_PRIVATES_1]]* [[TASK_T_WITH_PRIVATES]] to i8* 568ebb1092aSShilei Tian // CK0: call void [[OUTLINE_1]](i32 {{%.+}}, i32* {{%.+}}, i8* [[PRIVATES]], {{.+}}, i8* [[TASK_WITH_PRIVATES]], [[ANON_T_0]]* [[ANON]]) 569ebb1092aSShilei Tian // CK0: } 570ebb1092aSShilei Tian 571*0661328dSShilei Tian // CK0: define internal void [[OMP_OUTLINED_16:@.+]](i32{{.*}} %{{[^,]+}}, i32* noalias %{{[^,]+}}, i8* noalias %{{[^,]+}} 572*0661328dSShilei Tian // CK0-DAG: call void @__tgt_target_data_begin_nowait_mapper(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** [[MPR:%.+]]) 573*0661328dSShilei Tian // CK0-DAG: [[BP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 574*0661328dSShilei Tian // CK0-DAG: [[P]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 575*0661328dSShilei Tian // CK0-DAG: [[SZ]] = getelementptr inbounds [1 x i64], [1 x i64]* [[SZADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 576*0661328dSShilei Tian // CK0-DAG: [[MPR]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPRADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 577*0661328dSShilei Tian // CK0-DAG: [[BPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPBPADDR:%[^,]+]], align 578*0661328dSShilei Tian // CK0-DAG: [[PADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPADDR:%[^,]+]], align 579*0661328dSShilei Tian // CK0-DAG: [[SZADDR]] = load [1 x i64]*, [1 x i64]** [[FPSZADDR:%[^,]+]], align 580*0661328dSShilei Tian // CK0-DAG: [[MPRADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPMPRADDR:%[^,]+]], align 581*0661328dSShilei Tian // CK0-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[FPBPADDR]], [1 x i8*]** [[FPPADDR]], [1 x i64]** [[FPSZADDR]], [1 x i8*]** [[FPMPRADDR]]) 582*0661328dSShilei Tian // CK0: ret void 583*0661328dSShilei Tian // CK0: } 584*0661328dSShilei Tian 585*0661328dSShilei Tian // CK0: define internal {{.*}}i32 [[OMP_TASK_ENTRY_18]](i32 {{.*}}%{{[^,]+}}, [[KMP_TASK_T_WITH_PRIVATES_4]]* noalias %{{[^,]+}}) 586*0661328dSShilei Tian // CK0: call void [[OMP_OUTLINED_16]] 587*0661328dSShilei Tian // CK0: ret i32 0 588*0661328dSShilei Tian // CK0: } 589*0661328dSShilei Tian 590*0661328dSShilei Tian // CK0: define internal void [[OMP_OUTLINED_23:@.+]](i32{{.*}} %{{[^,]+}}, i32* noalias %{{[^,]+}}, i8* noalias %{{[^,]+}} 591*0661328dSShilei Tian // CK0-DAG: call void @__tgt_target_data_end_nowait_mapper(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** [[MPR:%.+]]) 592*0661328dSShilei Tian // CK0-DAG: [[BP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 593*0661328dSShilei Tian // CK0-DAG: [[P]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 594*0661328dSShilei Tian // CK0-DAG: [[SZ]] = getelementptr inbounds [1 x i64], [1 x i64]* [[SZADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 595*0661328dSShilei Tian // CK0-DAG: [[MPR]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPRADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 596*0661328dSShilei Tian // CK0-DAG: [[BPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPBPADDR:%[^,]+]], align 597*0661328dSShilei Tian // CK0-DAG: [[PADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPADDR:%[^,]+]], align 598*0661328dSShilei Tian // CK0-DAG: [[SZADDR]] = load [1 x i64]*, [1 x i64]** [[FPSZADDR:%[^,]+]], align 599*0661328dSShilei Tian // CK0-DAG: [[MPRADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPMPRADDR:%[^,]+]], align 600*0661328dSShilei Tian // CK0-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[FPBPADDR]], [1 x i8*]** [[FPPADDR]], [1 x i64]** [[FPSZADDR]], [1 x i8*]** [[FPMPRADDR]]) 601*0661328dSShilei Tian // CK0: } 602*0661328dSShilei Tian 603*0661328dSShilei Tian // CK0: define internal {{.*}}i32 [[OMP_TASK_ENTRY_25]](i32 {{.*}}%{{[^,]+}}, [[KMP_TASK_T_WITH_PRIVATES_7]]* noalias %{{[^,]+}}) 604*0661328dSShilei Tian // CK0: call void [[OMP_OUTLINED_23]] 605*0661328dSShilei Tian // CK0: ret i32 0 606*0661328dSShilei Tian // CK0: } 607*0661328dSShilei Tian 608*0661328dSShilei Tian // CK0: define internal void [[OMP_OUTLINED_32:@.+]](i32{{.*}} %{{[^,]+}}, i32* noalias %{{[^,]+}}, i8* noalias %{{[^,]+}} 609*0661328dSShilei Tian // CK0-DAG: call void @__tgt_target_data_update_nowait_mapper(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** [[MPR:%.+]]) 610*0661328dSShilei Tian // CK0-DAG: [[BP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 611*0661328dSShilei Tian // CK0-DAG: [[P]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 612*0661328dSShilei Tian // CK0-DAG: [[SZ]] = getelementptr inbounds [1 x i64], [1 x i64]* [[SZADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 613*0661328dSShilei Tian // CK0-DAG: [[MPR]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[MPRADDR:%[^,]+]], i[[sz]] 0, i[[sz]] 0 614*0661328dSShilei Tian // CK0-DAG: [[BPADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPBPADDR:%[^,]+]], align 615*0661328dSShilei Tian // CK0-DAG: [[PADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPPADDR:%[^,]+]], align 616*0661328dSShilei Tian // CK0-DAG: [[SZADDR]] = load [1 x i64]*, [1 x i64]** [[FPSZADDR:%[^,]+]], align 617*0661328dSShilei Tian // CK0-DAG: [[MPRADDR]] = load [1 x i8*]*, [1 x i8*]** [[FPMPRADDR:%[^,]+]], align 618*0661328dSShilei Tian // CK0-DAG: call void (i8*, ...) %{{.+}}(i8* %{{[^,]+}}, [1 x i8*]** [[FPBPADDR]], [1 x i8*]** [[FPPADDR]], [1 x i64]** [[FPSZADDR]], [1 x i8*]** [[FPMPRADDR]]) 619*0661328dSShilei Tian // CK0: } 620*0661328dSShilei Tian 621*0661328dSShilei Tian // CK0: define internal {{.*}}i32 [[OMP_TASK_ENTRY_34]](i32 {{.*}}%{{[^,]+}}, [[KMP_TASK_T_WITH_PRIVATES_10]]* noalias %{{[^,]+}}) 622*0661328dSShilei Tian // CK0: call void [[OMP_OUTLINED_32]] 623*0661328dSShilei Tian // CK0: ret i32 0 624*0661328dSShilei Tian // CK0: } 625*0661328dSShilei Tian 626537b16e9SGeorge Rokos #endif // CK0 627d47b9438SMichael Kruse 628d47b9438SMichael Kruse 629d47b9438SMichael Kruse ///==========================================================================/// 630d47b9438SMichael Kruse // RUN: %clang_cc1 -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 631d47b9438SMichael Kruse // RUN: %clang_cc1 -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 632d47b9438SMichael Kruse // RUN: %clang_cc1 -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 633d47b9438SMichael Kruse // RUN: %clang_cc1 -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 634d47b9438SMichael Kruse // RUN: %clang_cc1 -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 635d47b9438SMichael Kruse // RUN: %clang_cc1 -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 636d47b9438SMichael Kruse 637d47b9438SMichael Kruse // RUN: %clang_cc1 -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 638d47b9438SMichael Kruse // RUN: %clang_cc1 -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 639d47b9438SMichael Kruse // RUN: %clang_cc1 -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 640d47b9438SMichael Kruse // RUN: %clang_cc1 -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 641d47b9438SMichael Kruse // RUN: %clang_cc1 -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 642d47b9438SMichael Kruse // RUN: %clang_cc1 -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 643d47b9438SMichael Kruse 644d47b9438SMichael Kruse #ifdef CK1 645537b16e9SGeorge Rokos // C++ template 646d47b9438SMichael Kruse 647d47b9438SMichael Kruse template <class T> 648d47b9438SMichael Kruse class C { 649d47b9438SMichael Kruse public: 650d47b9438SMichael Kruse T a; 651d47b9438SMichael Kruse }; 652d47b9438SMichael Kruse 653d47b9438SMichael Kruse #pragma omp declare mapper(id: C<int> s) map(s.a) 654d47b9438SMichael Kruse 655d47b9438SMichael Kruse // CK1-LABEL: define {{.*}}void @.omp_mapper.{{.*}}C{{.*}}.id{{.*}}(i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}) 656d47b9438SMichael Kruse // CK1: store i8* %{{[^,]+}}, i8** [[HANDLEADDR:%[^,]+]] 657d47b9438SMichael Kruse // CK1: store i8* %{{[^,]+}}, i8** [[BPTRADDR:%[^,]+]] 658d47b9438SMichael Kruse // CK1: store i8* %{{[^,]+}}, i8** [[VPTRADDR:%[^,]+]] 659d47b9438SMichael Kruse // CK1: store i64 %{{[^,]+}}, i{{64|32}}* [[SIZEADDR:%[^,]+]] 660d47b9438SMichael Kruse // CK1: store i64 %{{[^,]+}}, i64* [[TYPEADDR:%[^,]+]] 661537b16e9SGeorge Rokos // CK1-DAG: [[BYTESIZE:%.+]] = load i64, i64* [[SIZEADDR]] 662537b16e9SGeorge Rokos // CK1-DAG: [[SIZE:%.+]] = udiv exact i64 [[BYTESIZE]], 4 663d47b9438SMichael Kruse // CK1-DAG: [[TYPE:%.+]] = load i64, i64* [[TYPEADDR]] 664d47b9438SMichael Kruse // CK1-DAG: [[HANDLE:%.+]] = load i8*, i8** [[HANDLEADDR]] 665d47b9438SMichael Kruse // CK1-DAG: [[PTRBEGIN:%.+]] = bitcast i8** [[VPTRADDR]] to %class.C** 666d47b9438SMichael Kruse // CK1-DAG: [[PTREND:%.+]] = getelementptr %class.C*, %class.C** [[PTRBEGIN]], i64 [[SIZE]] 667d47b9438SMichael Kruse // CK1-DAG: [[BPTR:%.+]] = load i8*, i8** [[BPTRADDR]] 668d47b9438SMichael Kruse // CK1-DAG: [[BEGIN:%.+]] = load i8*, i8** [[VPTRADDR]] 669d47b9438SMichael Kruse // CK1: [[ISARRAY:%.+]] = icmp sge i64 [[SIZE]], 1 670d47b9438SMichael Kruse // CK1: br i1 [[ISARRAY]], label %[[INITEVALDEL:[^,]+]], label %[[LHEAD:[^,]+]] 671d47b9438SMichael Kruse 672d47b9438SMichael Kruse // CK1: [[INITEVALDEL]] 673d47b9438SMichael Kruse // CK1: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 674d47b9438SMichael Kruse // CK1: [[ISNOTDEL:%.+]] = icmp eq i64 [[TYPEDEL]], 0 675d47b9438SMichael Kruse // CK1: br i1 [[ISNOTDEL]], label %[[INIT:[^,]+]], label %[[LHEAD:[^,]+]] 676d47b9438SMichael Kruse // CK1: [[INIT]] 677d47b9438SMichael Kruse // CK1-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 4 678d47b9438SMichael Kruse // CK1-DAG: [[ITYPE:%.+]] = and i64 [[TYPE]], -4 679d47b9438SMichael Kruse // CK1: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[ITYPE]]) 680d47b9438SMichael Kruse // CK1: br label %[[LHEAD:[^,]+]] 681d47b9438SMichael Kruse 682d47b9438SMichael Kruse // CK1: [[LHEAD]] 683d47b9438SMichael Kruse // CK1: [[ISEMPTY:%.+]] = icmp eq %class.C** [[PTRBEGIN]], [[PTREND]] 684d47b9438SMichael Kruse // CK1: br i1 [[ISEMPTY]], label %[[DONE:[^,]+]], label %[[LBODY:[^,]+]] 685d47b9438SMichael Kruse // CK1: [[LBODY]] 686d47b9438SMichael Kruse // CK1: [[PTR:%.+]] = phi %class.C** [ [[PTRBEGIN]], %[[LHEAD]] ], [ [[PTRNEXT:%.+]], %[[LCORRECT:[^,]+]] ] 687d47b9438SMichael Kruse // CK1: [[OBJ:%.+]] = load %class.C*, %class.C** [[PTR]] 688d47b9438SMichael Kruse // CK1-DAG: [[ABEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[OBJ]], i32 0, i32 0 689d47b9438SMichael Kruse // CK1-DAG: [[AEND:%.+]] = getelementptr i32, i32* [[ABEGIN]], i32 1 690d47b9438SMichael Kruse // CK1-DAG: [[ABEGINV:%.+]] = bitcast i32* [[ABEGIN]] to i8* 691d47b9438SMichael Kruse // CK1-DAG: [[AENDV:%.+]] = bitcast i32* [[AEND]] to i8* 692d47b9438SMichael Kruse // CK1-DAG: [[ABEGINI:%.+]] = ptrtoint i8* [[ABEGINV]] to i64 693d47b9438SMichael Kruse // CK1-DAG: [[AENDI:%.+]] = ptrtoint i8* [[AENDV]] to i64 694d47b9438SMichael Kruse // CK1-DAG: [[CSIZE:%.+]] = sub i64 [[AENDI]], [[ABEGINI]] 695d47b9438SMichael Kruse // CK1-DAG: [[CUSIZE:%.+]] = sdiv exact i64 [[CSIZE]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 696d47b9438SMichael Kruse // CK1-DAG: [[BPTRADDR0BC:%.+]] = bitcast %class.C* [[OBJ]] to i8* 697d47b9438SMichael Kruse // CK1-DAG: [[PTRADDR0BC:%.+]] = bitcast i32* [[ABEGIN]] to i8* 698d47b9438SMichael Kruse // CK1-DAG: [[PRESIZE:%.+]] = call i64 @__tgt_mapper_num_components(i8* [[HANDLE]]) 699d47b9438SMichael Kruse // CK1-DAG: [[SHIPRESIZE:%.+]] = shl i64 [[PRESIZE]], 48 700d47b9438SMichael Kruse // CK1-DAG: br label %[[MEMBER:[^,]+]] 701d47b9438SMichael Kruse // CK1-DAG: [[MEMBER]] 702d47b9438SMichael Kruse // CK1-DAG: br i1 true, label %[[LTYPE:[^,]+]], label %[[MEMBERCOM:[^,]+]] 703d47b9438SMichael Kruse // CK1-DAG: [[MEMBERCOM]] 704d47b9438SMichael Kruse // CK1-DAG: [[MEMBERCOMTYPE:%.+]] = add nuw i64 32, [[SHIPRESIZE]] 705d47b9438SMichael Kruse // CK1-DAG: br label %[[LTYPE]] 706d47b9438SMichael Kruse // CK1-DAG: [[LTYPE]] 707d47b9438SMichael Kruse // CK1-DAG: [[MEMBERTYPE:%.+]] = phi i64 [ 32, %[[MEMBER]] ], [ [[MEMBERCOMTYPE]], %[[MEMBERCOM]] ] 708d47b9438SMichael Kruse // CK1-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 709d47b9438SMichael Kruse // CK1-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 710d47b9438SMichael Kruse // CK1-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 711d47b9438SMichael Kruse // CK1-DAG: [[ALLOC]] 712d47b9438SMichael Kruse // CK1-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 713d47b9438SMichael Kruse // CK1-DAG: br label %[[TYEND:[^,]+]] 714d47b9438SMichael Kruse // CK1-DAG: [[ALLOCELSE]] 715d47b9438SMichael Kruse // CK1-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 716d47b9438SMichael Kruse // CK1-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 717d47b9438SMichael Kruse // CK1-DAG: [[TO]] 718d47b9438SMichael Kruse // CK1-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 719d47b9438SMichael Kruse // CK1-DAG: br label %[[TYEND]] 720d47b9438SMichael Kruse // CK1-DAG: [[TOELSE]] 721d47b9438SMichael Kruse // CK1-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 722d47b9438SMichael Kruse // CK1-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 723d47b9438SMichael Kruse // CK1-DAG: [[FROM]] 724d47b9438SMichael Kruse // CK1-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 725d47b9438SMichael Kruse // CK1-DAG: br label %[[TYEND]] 726d47b9438SMichael Kruse // CK1-DAG: [[TYEND]] 727d47b9438SMichael Kruse // CK1-DAG: [[TYPE0:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 728d47b9438SMichael Kruse // CK1-64: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR0BC]], i8* [[PTRADDR0BC]], i64 [[CUSIZE]], i64 [[TYPE0]]) 729d47b9438SMichael Kruse // CK1-DAG: [[BPTRADDR1BC:%.+]] = bitcast %class.C* [[OBJ]] to i8* 730d47b9438SMichael Kruse // CK1-DAG: [[PTRADDR1BC:%.+]] = bitcast i32* [[ABEGIN]] to i8* 731d47b9438SMichael Kruse // CK1-DAG: br label %[[MEMBER:[^,]+]] 732d47b9438SMichael Kruse // CK1-DAG: [[MEMBER]] 733d47b9438SMichael Kruse // CK1-DAG: br i1 false, label %[[LTYPE:[^,]+]], label %[[MEMBERCOM:[^,]+]] 734d47b9438SMichael Kruse // CK1-DAG: [[MEMBERCOM]] 735d47b9438SMichael Kruse // 281474976710659 == 0x1,000,000,003 736d47b9438SMichael Kruse // CK1-DAG: [[MEMBERCOMTYPE:%.+]] = add nuw i64 281474976710659, [[SHIPRESIZE]] 737d47b9438SMichael Kruse // CK1-DAG: br label %[[LTYPE]] 738d47b9438SMichael Kruse // CK1-DAG: [[LTYPE]] 739d47b9438SMichael Kruse // CK1-DAG: [[MEMBERTYPE:%.+]] = phi i64 [ 281474976710659, %[[MEMBER]] ], [ [[MEMBERCOMTYPE]], %[[MEMBERCOM]] ] 740d47b9438SMichael Kruse // CK1-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 741d47b9438SMichael Kruse // CK1-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 742d47b9438SMichael Kruse // CK1-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 743d47b9438SMichael Kruse // CK1-DAG: [[ALLOC]] 744d47b9438SMichael Kruse // CK1-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 745d47b9438SMichael Kruse // CK1-DAG: br label %[[TYEND:[^,]+]] 746d47b9438SMichael Kruse // CK1-DAG: [[ALLOCELSE]] 747d47b9438SMichael Kruse // CK1-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 748d47b9438SMichael Kruse // CK1-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 749d47b9438SMichael Kruse // CK1-DAG: [[TO]] 750d47b9438SMichael Kruse // CK1-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 751d47b9438SMichael Kruse // CK1-DAG: br label %[[TYEND]] 752d47b9438SMichael Kruse // CK1-DAG: [[TOELSE]] 753d47b9438SMichael Kruse // CK1-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 754d47b9438SMichael Kruse // CK1-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 755d47b9438SMichael Kruse // CK1-DAG: [[FROM]] 756d47b9438SMichael Kruse // CK1-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 757d47b9438SMichael Kruse // CK1-DAG: br label %[[TYEND]] 758d47b9438SMichael Kruse // CK1-DAG: [[TYEND]] 759d47b9438SMichael Kruse // CK1-DAG: [[TYPE1:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 760d47b9438SMichael Kruse // CK1: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR1BC]], i8* [[PTRADDR1BC]], i64 4, i64 [[TYPE1]]) 761d47b9438SMichael Kruse // CK1: [[PTRNEXT]] = getelementptr %class.C*, %class.C** [[PTR]], i32 1 762d47b9438SMichael Kruse // CK1: [[ISDONE:%.+]] = icmp eq %class.C** [[PTRNEXT]], [[PTREND]] 763d47b9438SMichael Kruse // CK1: br i1 [[ISDONE]], label %[[LEXIT:[^,]+]], label %[[LBODY]] 764d47b9438SMichael Kruse 765d47b9438SMichael Kruse // CK1: [[LEXIT]] 766d47b9438SMichael Kruse // CK1: [[ISARRAY:%.+]] = icmp sge i64 [[SIZE]], 1 767d47b9438SMichael Kruse // CK1: br i1 [[ISARRAY]], label %[[EVALDEL:[^,]+]], label %[[DONE]] 768d47b9438SMichael Kruse // CK1: [[EVALDEL]] 769d47b9438SMichael Kruse // CK1: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 770d47b9438SMichael Kruse // CK1: [[ISDEL:%.+]] = icmp ne i64 [[TYPEDEL]], 0 771d47b9438SMichael Kruse // CK1: br i1 [[ISDEL]], label %[[DEL:[^,]+]], label %[[DONE]] 772d47b9438SMichael Kruse // CK1: [[DEL]] 773d47b9438SMichael Kruse // CK1-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 4 774d47b9438SMichael Kruse // CK1-DAG: [[DTYPE:%.+]] = and i64 [[TYPE]], -4 775d47b9438SMichael Kruse // CK1: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[DTYPE]]) 776d47b9438SMichael Kruse // CK1: br label %[[DONE]] 777d47b9438SMichael Kruse // CK1: [[DONE]] 778d47b9438SMichael Kruse // CK1: ret void 779d47b9438SMichael Kruse 780537b16e9SGeorge Rokos #endif // CK1 7814304e9d1SMichael Kruse 782537b16e9SGeorge Rokos 783537b16e9SGeorge Rokos ///==========================================================================/// 784537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 785537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 786537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 787537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 788537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 789537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 790537b16e9SGeorge Rokos 791537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 792537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 793537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 794537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 795537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 796537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 797537b16e9SGeorge Rokos 798537b16e9SGeorge Rokos #ifdef CK2 799537b16e9SGeorge Rokos // Nested mappers. 800537b16e9SGeorge Rokos 801537b16e9SGeorge Rokos class B { 802537b16e9SGeorge Rokos public: 803537b16e9SGeorge Rokos double a; 804537b16e9SGeorge Rokos }; 805537b16e9SGeorge Rokos 806537b16e9SGeorge Rokos class C { 807537b16e9SGeorge Rokos public: 808537b16e9SGeorge Rokos double a; 809537b16e9SGeorge Rokos B b; 810537b16e9SGeorge Rokos }; 811537b16e9SGeorge Rokos 812537b16e9SGeorge Rokos #pragma omp declare mapper(B s) map(s.a) 813537b16e9SGeorge Rokos 814537b16e9SGeorge Rokos #pragma omp declare mapper(id: C s) map(s.b) 815537b16e9SGeorge Rokos 816537b16e9SGeorge Rokos // CK2: define {{.*}}void [[BMPRFUNC:@[.]omp_mapper[.].*B[.]default]](i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}) 817537b16e9SGeorge Rokos 818537b16e9SGeorge Rokos // CK2-LABEL: define {{.*}}void @.omp_mapper.{{.*}}C{{.*}}.id(i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}) 819537b16e9SGeorge Rokos // CK2: store i8* %{{[^,]+}}, i8** [[HANDLEADDR:%[^,]+]] 820537b16e9SGeorge Rokos // CK2: store i8* %{{[^,]+}}, i8** [[BPTRADDR:%[^,]+]] 821537b16e9SGeorge Rokos // CK2: store i8* %{{[^,]+}}, i8** [[VPTRADDR:%[^,]+]] 822537b16e9SGeorge Rokos // CK2: store i64 %{{[^,]+}}, i{{64|32}}* [[SIZEADDR:%[^,]+]] 823537b16e9SGeorge Rokos // CK2: store i64 %{{[^,]+}}, i64* [[TYPEADDR:%[^,]+]] 824537b16e9SGeorge Rokos // CK2-DAG: [[BYTESIZE:%.+]] = load i64, i64* [[SIZEADDR]] 825537b16e9SGeorge Rokos // CK2-DAG: [[SIZE:%.+]] = udiv exact i64 [[BYTESIZE]], 16 826537b16e9SGeorge Rokos // CK2-DAG: [[TYPE:%.+]] = load i64, i64* [[TYPEADDR]] 827537b16e9SGeorge Rokos // CK2-DAG: [[HANDLE:%.+]] = load i8*, i8** [[HANDLEADDR]] 828537b16e9SGeorge Rokos // CK2-DAG: [[PTRBEGIN:%.+]] = bitcast i8** [[VPTRADDR]] to %class.C** 829537b16e9SGeorge Rokos // CK2-DAG: [[PTREND:%.+]] = getelementptr %class.C*, %class.C** [[PTRBEGIN]], i64 [[SIZE]] 830537b16e9SGeorge Rokos // CK2-DAG: [[BPTR:%.+]] = load i8*, i8** [[BPTRADDR]] 831537b16e9SGeorge Rokos // CK2-DAG: [[BEGIN:%.+]] = load i8*, i8** [[VPTRADDR]] 832537b16e9SGeorge Rokos // CK2: [[ISARRAY:%.+]] = icmp sge i64 [[SIZE]], 1 833537b16e9SGeorge Rokos // CK2: br i1 [[ISARRAY]], label %[[INITEVALDEL:[^,]+]], label %[[LHEAD:[^,]+]] 834537b16e9SGeorge Rokos 835537b16e9SGeorge Rokos // CK2: [[INITEVALDEL]] 836537b16e9SGeorge Rokos // CK2: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 837537b16e9SGeorge Rokos // CK2: [[ISNOTDEL:%.+]] = icmp eq i64 [[TYPEDEL]], 0 838537b16e9SGeorge Rokos // CK2: br i1 [[ISNOTDEL]], label %[[INIT:[^,]+]], label %[[LHEAD:[^,]+]] 839537b16e9SGeorge Rokos // CK2: [[INIT]] 840537b16e9SGeorge Rokos // CK2-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 841537b16e9SGeorge Rokos // CK2-DAG: [[ITYPE:%.+]] = and i64 [[TYPE]], -4 842537b16e9SGeorge Rokos // CK2: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[ITYPE]]) 843537b16e9SGeorge Rokos // CK2: br label %[[LHEAD:[^,]+]] 844537b16e9SGeorge Rokos 845537b16e9SGeorge Rokos // CK2: [[LHEAD]] 846537b16e9SGeorge Rokos // CK2: [[ISEMPTY:%.+]] = icmp eq %class.C** [[PTRBEGIN]], [[PTREND]] 847537b16e9SGeorge Rokos // CK2: br i1 [[ISEMPTY]], label %[[DONE:[^,]+]], label %[[LBODY:[^,]+]] 848537b16e9SGeorge Rokos // CK2: [[LBODY]] 849537b16e9SGeorge Rokos // CK2: [[PTR:%.+]] = phi %class.C** [ [[PTRBEGIN]], %[[LHEAD]] ], [ [[PTRNEXT:%.+]], %[[LCORRECT:[^,]+]] ] 850537b16e9SGeorge Rokos // CK2: [[OBJ:%.+]] = load %class.C*, %class.C** [[PTR]] 851537b16e9SGeorge Rokos // CK2-DAG: [[BBEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[OBJ]], i32 0, i32 1 852537b16e9SGeorge Rokos // CK2-DAG: [[BEND:%.+]] = getelementptr %class.B, %class.B* [[BBEGIN]], i32 1 853537b16e9SGeorge Rokos // CK2-DAG: [[BBEGINV:%.+]] = bitcast %class.B* [[BBEGIN]] to i8* 854537b16e9SGeorge Rokos // CK2-DAG: [[BENDV:%.+]] = bitcast %class.B* [[BEND]] to i8* 855537b16e9SGeorge Rokos // CK2-DAG: [[BBEGINI:%.+]] = ptrtoint i8* [[BBEGINV]] to i64 856537b16e9SGeorge Rokos // CK2-DAG: [[BENDI:%.+]] = ptrtoint i8* [[BENDV]] to i64 857537b16e9SGeorge Rokos // CK2-DAG: [[BSIZE:%.+]] = sub i64 [[BENDI]], [[BBEGINI]] 858537b16e9SGeorge Rokos // CK2-DAG: [[BUSIZE:%.+]] = sdiv exact i64 [[BSIZE]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 859537b16e9SGeorge Rokos // CK2-DAG: [[BPTRADDR0BC:%.+]] = bitcast %class.C* [[OBJ]] to i8* 860537b16e9SGeorge Rokos // CK2-DAG: [[PTRADDR0BC:%.+]] = bitcast %class.B* [[BBEGIN]] to i8* 861537b16e9SGeorge Rokos // CK2-DAG: [[PRESIZE:%.+]] = call i64 @__tgt_mapper_num_components(i8* [[HANDLE]]) 862537b16e9SGeorge Rokos // CK2-DAG: [[SHIPRESIZE:%.+]] = shl i64 [[PRESIZE]], 48 863537b16e9SGeorge Rokos // CK2-DAG: br label %[[MEMBER:[^,]+]] 864537b16e9SGeorge Rokos // CK2-DAG: [[MEMBER]] 865537b16e9SGeorge Rokos // CK2-DAG: br i1 true, label %[[LTYPE:[^,]+]], label %[[MEMBERCOM:[^,]+]] 866537b16e9SGeorge Rokos // CK2-DAG: [[MEMBERCOM]] 867537b16e9SGeorge Rokos // CK2-DAG: [[MEMBERCOMTYPE:%.+]] = add nuw i64 32, [[SHIPRESIZE]] 868537b16e9SGeorge Rokos // CK2-DAG: br label %[[LTYPE]] 869537b16e9SGeorge Rokos // CK2-DAG: [[LTYPE]] 870537b16e9SGeorge Rokos // CK2-DAG: [[MEMBERTYPE:%.+]] = phi i64 [ 32, %[[MEMBER]] ], [ [[MEMBERCOMTYPE]], %[[MEMBERCOM]] ] 871537b16e9SGeorge Rokos // CK2-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 872537b16e9SGeorge Rokos // CK2-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 873537b16e9SGeorge Rokos // CK2-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 874537b16e9SGeorge Rokos // CK2-DAG: [[ALLOC]] 875537b16e9SGeorge Rokos // CK2-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 876537b16e9SGeorge Rokos // CK2-DAG: br label %[[TYEND:[^,]+]] 877537b16e9SGeorge Rokos // CK2-DAG: [[ALLOCELSE]] 878537b16e9SGeorge Rokos // CK2-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 879537b16e9SGeorge Rokos // CK2-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 880537b16e9SGeorge Rokos // CK2-DAG: [[TO]] 881537b16e9SGeorge Rokos // CK2-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 882537b16e9SGeorge Rokos // CK2-DAG: br label %[[TYEND]] 883537b16e9SGeorge Rokos // CK2-DAG: [[TOELSE]] 884537b16e9SGeorge Rokos // CK2-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 885537b16e9SGeorge Rokos // CK2-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 886537b16e9SGeorge Rokos // CK2-DAG: [[FROM]] 887537b16e9SGeorge Rokos // CK2-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 888537b16e9SGeorge Rokos // CK2-DAG: br label %[[TYEND]] 889537b16e9SGeorge Rokos // CK2-DAG: [[TYEND]] 890537b16e9SGeorge Rokos // CK2-DAG: [[TYPE0:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 891537b16e9SGeorge Rokos // CK2-64: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR0BC]], i8* [[PTRADDR0BC]], i64 [[BUSIZE]], i64 [[TYPE0]]) 892537b16e9SGeorge Rokos // CK2-DAG: [[BPTRADDR1BC:%.+]] = bitcast %class.C* [[OBJ]] to i8* 893537b16e9SGeorge Rokos // CK2-DAG: [[PTRADDR1BC:%.+]] = bitcast %class.B* [[BBEGIN]] to i8* 894537b16e9SGeorge Rokos // CK2-DAG: br label %[[MEMBER:[^,]+]] 895537b16e9SGeorge Rokos // CK2-DAG: [[MEMBER]] 896537b16e9SGeorge Rokos // CK2-DAG: br i1 false, label %[[LTYPE:[^,]+]], label %[[MEMBERCOM:[^,]+]] 897537b16e9SGeorge Rokos // CK2-DAG: [[MEMBERCOM]] 898537b16e9SGeorge Rokos // 281474976710659 == 0x1,000,000,003 899537b16e9SGeorge Rokos // CK2-DAG: [[MEMBERCOMTYPE:%.+]] = add nuw i64 281474976710659, [[SHIPRESIZE]] 900537b16e9SGeorge Rokos // CK2-DAG: br label %[[LTYPE]] 901537b16e9SGeorge Rokos // CK2-DAG: [[LTYPE]] 902537b16e9SGeorge Rokos // CK2-DAG: [[MEMBERTYPE:%.+]] = phi i64 [ 281474976710659, %[[MEMBER]] ], [ [[MEMBERCOMTYPE]], %[[MEMBERCOM]] ] 903537b16e9SGeorge Rokos // CK2-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 904537b16e9SGeorge Rokos // CK2-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 905537b16e9SGeorge Rokos // CK2-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 906537b16e9SGeorge Rokos // CK2-DAG: [[ALLOC]] 907537b16e9SGeorge Rokos // CK2-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 908537b16e9SGeorge Rokos // CK2-DAG: br label %[[TYEND:[^,]+]] 909537b16e9SGeorge Rokos // CK2-DAG: [[ALLOCELSE]] 910537b16e9SGeorge Rokos // CK2-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 911537b16e9SGeorge Rokos // CK2-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 912537b16e9SGeorge Rokos // CK2-DAG: [[TO]] 913537b16e9SGeorge Rokos // CK2-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 914537b16e9SGeorge Rokos // CK2-DAG: br label %[[TYEND]] 915537b16e9SGeorge Rokos // CK2-DAG: [[TOELSE]] 916537b16e9SGeorge Rokos // CK2-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 917537b16e9SGeorge Rokos // CK2-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 918537b16e9SGeorge Rokos // CK2-DAG: [[FROM]] 919537b16e9SGeorge Rokos // CK2-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 920537b16e9SGeorge Rokos // CK2-DAG: br label %[[TYEND]] 921537b16e9SGeorge Rokos // CK2-DAG: [[TYEND]] 922537b16e9SGeorge Rokos // CK2-DAG: [[TYPE1:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 923537b16e9SGeorge Rokos // CK2: call void [[BMPRFUNC]](i8* [[HANDLE]], i8* [[BPTRADDR1BC]], i8* [[PTRADDR1BC]], i64 8, i64 [[TYPE1]]) 924537b16e9SGeorge Rokos // CK2: [[PTRNEXT]] = getelementptr %class.C*, %class.C** [[PTR]], i32 1 925537b16e9SGeorge Rokos // CK2: [[ISDONE:%.+]] = icmp eq %class.C** [[PTRNEXT]], [[PTREND]] 926537b16e9SGeorge Rokos // CK2: br i1 [[ISDONE]], label %[[LEXIT:[^,]+]], label %[[LBODY]] 927537b16e9SGeorge Rokos 928537b16e9SGeorge Rokos // CK2: [[LEXIT]] 929537b16e9SGeorge Rokos // CK2: [[ISARRAY:%.+]] = icmp sge i64 [[SIZE]], 1 930537b16e9SGeorge Rokos // CK2: br i1 [[ISARRAY]], label %[[EVALDEL:[^,]+]], label %[[DONE]] 931537b16e9SGeorge Rokos // CK2: [[EVALDEL]] 932537b16e9SGeorge Rokos // CK2: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 933537b16e9SGeorge Rokos // CK2: [[ISDEL:%.+]] = icmp ne i64 [[TYPEDEL]], 0 934537b16e9SGeorge Rokos // CK2: br i1 [[ISDEL]], label %[[DEL:[^,]+]], label %[[DONE]] 935537b16e9SGeorge Rokos // CK2: [[DEL]] 936537b16e9SGeorge Rokos // CK2-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 937537b16e9SGeorge Rokos // CK2-DAG: [[DTYPE:%.+]] = and i64 [[TYPE]], -4 938537b16e9SGeorge Rokos // CK2: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[DTYPE]]) 939537b16e9SGeorge Rokos // CK2: br label %[[DONE]] 940537b16e9SGeorge Rokos // CK2: [[DONE]] 941537b16e9SGeorge Rokos // CK2: ret void 942537b16e9SGeorge Rokos 943537b16e9SGeorge Rokos #endif // CK2 944537b16e9SGeorge Rokos 945537b16e9SGeorge Rokos 946537b16e9SGeorge Rokos ///==========================================================================/// 947537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 948537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 949537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 950537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 951537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 952537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 953537b16e9SGeorge Rokos 954537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 955537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 956537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 957537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 958537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 959537b16e9SGeorge Rokos // RUN: %clang_cc1 -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 960537b16e9SGeorge Rokos 961537b16e9SGeorge Rokos #ifdef CK3 962537b16e9SGeorge Rokos // map of array sections and nested components. 963537b16e9SGeorge Rokos 964537b16e9SGeorge Rokos // CK3-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}.region_id = weak constant i8 0 965537b16e9SGeorge Rokos // CK3: [[TYPES:@.+]] = {{.+}}constant [3 x i64] [i64 32, i64 281474976710659, i64 35] 966537b16e9SGeorge Rokos 967537b16e9SGeorge Rokos class C { 968537b16e9SGeorge Rokos public: 969537b16e9SGeorge Rokos int a; 970537b16e9SGeorge Rokos double *b; 971537b16e9SGeorge Rokos }; 972537b16e9SGeorge Rokos 973537b16e9SGeorge Rokos class B { 974537b16e9SGeorge Rokos public: 975537b16e9SGeorge Rokos C c; 976537b16e9SGeorge Rokos }; 977537b16e9SGeorge Rokos 978537b16e9SGeorge Rokos #pragma omp declare mapper(id: C s) map(s.a, s.b[0:2]) 979537b16e9SGeorge Rokos 980537b16e9SGeorge Rokos // CK3: define {{.*}}void [[MPRFUNC:@[.]omp_mapper[.].*C[.]id]](i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}) 981537b16e9SGeorge Rokos 982537b16e9SGeorge Rokos // CK3-LABEL: define {{.*}}void @{{.*}}foo{{.*}} 983537b16e9SGeorge Rokos void foo(int a){ 984537b16e9SGeorge Rokos // CK3-DAG: [[CVAL:%.+]] = alloca [10 x %class.C] 985537b16e9SGeorge Rokos // CK3-DAG: [[BVAL:%.+]] = alloca %class.B 986537b16e9SGeorge Rokos C c[10]; 987537b16e9SGeorge Rokos B b; 988537b16e9SGeorge Rokos 989537b16e9SGeorge Rokos // CK3-DAG: [[BC:%.+]] = getelementptr inbounds %class.B, %class.B* [[BVAL]], i32 0, i32 0 990537b16e9SGeorge Rokos // CK3-DAG: [[BCEND:%.+]] = getelementptr %class.C, %class.C* [[BC]], i32 1 991537b16e9SGeorge Rokos // CK3-DAG: [[BCC:%.+]] = bitcast %class.C* [[BC]] to i8* 992537b16e9SGeorge Rokos // CK3-DAG: [[BCENDC:%.+]] = bitcast %class.C* [[BCEND]] to i8* 993537b16e9SGeorge Rokos // CK3-DAG: [[BCI:%.+]] = ptrtoint i8* [[BCC]] to i64 994537b16e9SGeorge Rokos // CK3-DAG: [[BCENDI:%.+]] = ptrtoint i8* [[BCENDC]] to i64 995537b16e9SGeorge Rokos // CK3-DAG: [[BSIZE:%.+]] = sub i64 [[BCENDI]], [[BCI]] 996537b16e9SGeorge Rokos // CK3-DAG: [[BSIZED:%.+]] = sdiv exact i64 [[BSIZE]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 997537b16e9SGeorge Rokos 998537b16e9SGeorge Rokos // CK3-DAG: call i32 @__tgt_target_mapper(i64 {{.+}}, i8* {{.+}}, i32 3, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SGEP:%[^,]+]], {{.+}}[[TYPES]]{{.+}}, i8** [[MPRGEP:%.+]]) 999537b16e9SGeorge Rokos // CK3-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 1000537b16e9SGeorge Rokos // CK3-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 1001537b16e9SGeorge Rokos // CK3-DAG: [[SGEP]] = getelementptr inbounds {{.+}}[[SIZES:%[^,]+]], i32 0, i32 0 1002537b16e9SGeorge Rokos // CK3-DAG: [[MPRGEP]] = bitcast [3 x i8*]* [[MPR:%[^,]+]] to i8** 1003537b16e9SGeorge Rokos // CK3-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 1004537b16e9SGeorge Rokos // CK3-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 1005537b16e9SGeorge Rokos // CK3-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[SIZES]], i32 0, i32 0 1006537b16e9SGeorge Rokos // CK3-DAG: [[MPR1:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i{{64|32}} 0, i{{64|32}} 0 1007537b16e9SGeorge Rokos // CK3-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to %class.B** 1008537b16e9SGeorge Rokos // CK3-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to %class.C** 1009537b16e9SGeorge Rokos // CK3-DAG: store %class.B* [[BVAL]], %class.B** [[CBP1]] 1010537b16e9SGeorge Rokos // CK3-DAG: store %class.C* [[BC]], %class.C** [[CP1]] 1011537b16e9SGeorge Rokos // CK3-DAG: store i64 [[BSIZED]], i64* [[S1]] 1012537b16e9SGeorge Rokos // CK3-DAG: store i8* null, i8** [[MPR1]] 1013537b16e9SGeorge Rokos // CK3-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 1014537b16e9SGeorge Rokos // CK3-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 1015537b16e9SGeorge Rokos // CK3-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[SIZES]], i32 0, i32 1 1016537b16e9SGeorge Rokos // CK3-DAG: [[MPR2:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i{{64|32}} 0, i{{64|32}} 1 1017537b16e9SGeorge Rokos // CK3-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to %class.B** 1018537b16e9SGeorge Rokos // CK3-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to %class.C** 1019537b16e9SGeorge Rokos // CK3-DAG: store %class.B* [[BVAL]], %class.B** [[CBP2]] 1020537b16e9SGeorge Rokos // CK3-DAG: store %class.C* [[BC]], %class.C** [[CP2]] 1021537b16e9SGeorge Rokos // CK3-64-DAG: store i64 16, i64* [[S2]] 1022537b16e9SGeorge Rokos // CK3-32-DAG: store i64 8, i64* [[S2]] 1023537b16e9SGeorge Rokos // CK3-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[MPR2]] 1024537b16e9SGeorge Rokos // CK3-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2 1025537b16e9SGeorge Rokos // CK3-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2 1026537b16e9SGeorge Rokos // CK3-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[SIZES]], i32 0, i32 2 1027537b16e9SGeorge Rokos // CK3-DAG: [[MPR3:%.+]] = getelementptr inbounds {{.+}}[[MPR]], i{{64|32}} 0, i{{64|32}} 2 1028537b16e9SGeorge Rokos // CK3-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to [10 x %class.C]** 1029537b16e9SGeorge Rokos // CK3-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to %class.C** 1030537b16e9SGeorge Rokos // CK3-DAG: store [10 x %class.C]* [[CVAL]], [10 x %class.C]** [[CBP3]] 1031537b16e9SGeorge Rokos // CK3-DAG: [[CVALGEP:%.+]] = getelementptr inbounds {{.+}}[[CVAL]], i{{64|32}} 0, i{{64|32}} 0 1032537b16e9SGeorge Rokos // CK3-DAG: store %class.C* [[CVALGEP]], %class.C** [[CP3]] 1033537b16e9SGeorge Rokos // CK3-64-DAG: store i64 160, i64* [[S3]] 1034537b16e9SGeorge Rokos // CK3-32-DAG: store i64 80, i64* [[S3]] 1035537b16e9SGeorge Rokos // CK3-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[MPR3]] 1036537b16e9SGeorge Rokos // CK3: call void [[KERNEL:@.+]](%class.B* [[BVAL]], [10 x %class.C]* [[CVAL]]) 1037537b16e9SGeorge Rokos #pragma omp target map(mapper(id),tofrom: c[0:10], b.c) 1038537b16e9SGeorge Rokos for (int i = 0; i < 10; i++) { 1039537b16e9SGeorge Rokos b.c.a += ++c[i].a; 1040537b16e9SGeorge Rokos } 1041537b16e9SGeorge Rokos } 1042537b16e9SGeorge Rokos 1043537b16e9SGeorge Rokos 1044537b16e9SGeorge Rokos // CK3: define internal void [[KERNEL]](%class.B* {{[^,]+}}, [10 x %class.C]* {{[^,]+}}) 1045537b16e9SGeorge Rokos 1046537b16e9SGeorge Rokos #endif // CK3 1047537b16e9SGeorge Rokos 10489f2f3b9dSJoel E. Denny ///==========================================================================/// 10499f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10509f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10519f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10529f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10539f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10549f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10559f2f3b9dSJoel E. Denny 10569f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10579f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10589f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10599f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10609f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10619f2f3b9dSJoel E. Denny // RUN: %clang_cc1 -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 10629f2f3b9dSJoel E. Denny 10639f2f3b9dSJoel E. Denny #ifdef CK4 10649f2f3b9dSJoel E. Denny // Mapper function code generation and runtime interface. 10659f2f3b9dSJoel E. Denny 10669f2f3b9dSJoel E. Denny // CK4-64: [[TSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 10679f2f3b9dSJoel E. Denny // CK4-32: [[TSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 10689f2f3b9dSJoel E. Denny // PRESENT=0x1000 | TARGET_PARAM=0x20 | TO=0x1 = 0x1021 10699f2f3b9dSJoel E. Denny // CK4: [[TTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 [[#0x1021]]] 10709f2f3b9dSJoel E. Denny 10719f2f3b9dSJoel E. Denny // CK4-64: [[FSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] 10729f2f3b9dSJoel E. Denny // CK4-32: [[FSIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] 10739f2f3b9dSJoel E. Denny // PRESENT=0x1000 | TARGET_PARAM=0x20 | FROM=0x2 = 0x1022 10749f2f3b9dSJoel E. Denny // CK4: [[FTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 [[#0x1022]]] 10759f2f3b9dSJoel E. Denny 10769f2f3b9dSJoel E. Denny class C { 10779f2f3b9dSJoel E. Denny public: 10789f2f3b9dSJoel E. Denny int a; 10799f2f3b9dSJoel E. Denny double *b; 10809f2f3b9dSJoel E. Denny }; 10819f2f3b9dSJoel E. Denny 10829f2f3b9dSJoel E. Denny #pragma omp declare mapper(id: C s) map(s.a, s.b[0:2]) 10839f2f3b9dSJoel E. Denny 10849f2f3b9dSJoel E. Denny // CK4: define {{.*}}void [[MPRFUNC:@[.]omp_mapper[.].*C[.]id]](i8*{{.*}}, i8*{{.*}}, i8*{{.*}}, i64{{.*}}, i64{{.*}}) 10859f2f3b9dSJoel E. Denny // CK4: store i8* %{{[^,]+}}, i8** [[HANDLEADDR:%[^,]+]] 10869f2f3b9dSJoel E. Denny // CK4: store i8* %{{[^,]+}}, i8** [[BPTRADDR:%[^,]+]] 10879f2f3b9dSJoel E. Denny // CK4: store i8* %{{[^,]+}}, i8** [[VPTRADDR:%[^,]+]] 10889f2f3b9dSJoel E. Denny // CK4: store i64 %{{[^,]+}}, i{{64|32}}* [[SIZEADDR:%[^,]+]] 10899f2f3b9dSJoel E. Denny // CK4: store i64 %{{[^,]+}}, i64* [[TYPEADDR:%[^,]+]] 10909f2f3b9dSJoel E. Denny // CK4-DAG: [[BYTESIZE:%.+]] = load i64, i64* [[SIZEADDR]] 10919f2f3b9dSJoel E. Denny // CK4-64-DAG: [[SIZE:%.+]] = udiv exact i64 [[BYTESIZE]], 16 10929f2f3b9dSJoel E. Denny // CK4-32-DAG: [[SIZE:%.+]] = udiv exact i64 [[BYTESIZE]], 8 10939f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPE:%.+]] = load i64, i64* [[TYPEADDR]] 10949f2f3b9dSJoel E. Denny // CK4-DAG: [[HANDLE:%.+]] = load i8*, i8** [[HANDLEADDR]] 10959f2f3b9dSJoel E. Denny // CK4-DAG: [[PTRBEGIN:%.+]] = bitcast i8** [[VPTRADDR]] to %class.C** 10969f2f3b9dSJoel E. Denny // CK4-DAG: [[PTREND:%.+]] = getelementptr %class.C*, %class.C** [[PTRBEGIN]], i64 [[SIZE]] 10979f2f3b9dSJoel E. Denny // CK4-DAG: [[BPTR:%.+]] = load i8*, i8** [[BPTRADDR]] 10989f2f3b9dSJoel E. Denny // CK4-DAG: [[BEGIN:%.+]] = load i8*, i8** [[VPTRADDR]] 10999f2f3b9dSJoel E. Denny // CK4: [[ISARRAY:%.+]] = icmp sge i64 [[SIZE]], 1 11009f2f3b9dSJoel E. Denny // CK4: br i1 [[ISARRAY]], label %[[INITEVALDEL:[^,]+]], label %[[LHEAD:[^,]+]] 11019f2f3b9dSJoel E. Denny 11029f2f3b9dSJoel E. Denny // CK4: [[INITEVALDEL]] 11039f2f3b9dSJoel E. Denny // CK4: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 11049f2f3b9dSJoel E. Denny // CK4: [[ISNOTDEL:%.+]] = icmp eq i64 [[TYPEDEL]], 0 11059f2f3b9dSJoel E. Denny // CK4: br i1 [[ISNOTDEL]], label %[[INIT:[^,]+]], label %[[LHEAD:[^,]+]] 11069f2f3b9dSJoel E. Denny // CK4: [[INIT]] 11079f2f3b9dSJoel E. Denny // CK4-64-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 11089f2f3b9dSJoel E. Denny // CK4-32-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 8 11099f2f3b9dSJoel E. Denny // CK4-DAG: [[ITYPE:%.+]] = and i64 [[TYPE]], -4 11109f2f3b9dSJoel E. Denny // CK4: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[ITYPE]]) 11119f2f3b9dSJoel E. Denny // CK4: br label %[[LHEAD:[^,]+]] 11129f2f3b9dSJoel E. Denny 11139f2f3b9dSJoel E. Denny // CK4: [[LHEAD]] 11149f2f3b9dSJoel E. Denny // CK4: [[ISEMPTY:%.+]] = icmp eq %class.C** [[PTRBEGIN]], [[PTREND]] 11159f2f3b9dSJoel E. Denny // CK4: br i1 [[ISEMPTY]], label %[[DONE:[^,]+]], label %[[LBODY:[^,]+]] 11169f2f3b9dSJoel E. Denny // CK4: [[LBODY]] 11179f2f3b9dSJoel E. Denny // CK4: [[PTR:%.+]] = phi %class.C** [ [[PTRBEGIN]], %[[LHEAD]] ], [ [[PTRNEXT:%.+]], %[[LCORRECT:[^,]+]] ] 11189f2f3b9dSJoel E. Denny // CK4: [[OBJ:%.+]] = load %class.C*, %class.C** [[PTR]] 11199f2f3b9dSJoel E. Denny // CK4-DAG: [[ABEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[OBJ]], i32 0, i32 0 11209f2f3b9dSJoel E. Denny // CK4-DAG: [[BBEGIN:%.+]] = getelementptr inbounds %class.C, %class.C* [[OBJ]], i32 0, i32 1 11219f2f3b9dSJoel E. Denny // CK4-DAG: [[BBEGIN2:%.+]] = getelementptr inbounds %class.C, %class.C* [[OBJ]], i32 0, i32 1 11229f2f3b9dSJoel E. Denny // CK4-DAG: [[BARRBEGIN:%.+]] = load double*, double** [[BBEGIN2]] 11239f2f3b9dSJoel E. Denny // CK4-DAG: [[BARRBEGINGEP:%.+]] = getelementptr inbounds double, double* [[BARRBEGIN]], i[[sz:64|32]] 0 11249f2f3b9dSJoel E. Denny // CK4-DAG: [[BEND:%.+]] = getelementptr double*, double** [[BBEGIN]], i32 1 11259f2f3b9dSJoel E. Denny // CK4-DAG: [[ABEGINV:%.+]] = bitcast i32* [[ABEGIN]] to i8* 11269f2f3b9dSJoel E. Denny // CK4-DAG: [[BENDV:%.+]] = bitcast double** [[BEND]] to i8* 11279f2f3b9dSJoel E. Denny // CK4-DAG: [[ABEGINI:%.+]] = ptrtoint i8* [[ABEGINV]] to i64 11289f2f3b9dSJoel E. Denny // CK4-DAG: [[BENDI:%.+]] = ptrtoint i8* [[BENDV]] to i64 11299f2f3b9dSJoel E. Denny // CK4-DAG: [[CSIZE:%.+]] = sub i64 [[BENDI]], [[ABEGINI]] 11309f2f3b9dSJoel E. Denny // CK4-DAG: [[CUSIZE:%.+]] = sdiv exact i64 [[CSIZE]], ptrtoint (i8* getelementptr (i8, i8* null, i32 1) to i64) 11319f2f3b9dSJoel E. Denny // CK4-DAG: [[BPTRADDR0BC:%.+]] = bitcast %class.C* [[OBJ]] to i8* 11329f2f3b9dSJoel E. Denny // CK4-DAG: [[PTRADDR0BC:%.+]] = bitcast i32* [[ABEGIN]] to i8* 11339f2f3b9dSJoel E. Denny // CK4-DAG: [[PRESIZE:%.+]] = call i64 @__tgt_mapper_num_components(i8* [[HANDLE]]) 11349f2f3b9dSJoel E. Denny // CK4-DAG: [[SHIPRESIZE:%.+]] = shl i64 [[PRESIZE]], 48 11359f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[MEMBER:[^,]+]] 11369f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBER]] 11379f2f3b9dSJoel E. Denny // CK4-DAG: br i1 true, label %[[LTYPE:[^,]+]], label %[[MEMBERCOM:[^,]+]] 11389f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBERCOM]] 11399f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBERCOMTYPE:%.+]] = add nuw i64 32, [[SHIPRESIZE]] 11409f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[LTYPE]] 11419f2f3b9dSJoel E. Denny // CK4-DAG: [[LTYPE]] 11429f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBERTYPE:%.+]] = phi i64 [ 32, %[[MEMBER]] ], [ [[MEMBERCOMTYPE]], %[[MEMBERCOM]] ] 11439f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 11449f2f3b9dSJoel E. Denny // CK4-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 11459f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 11469f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOC]] 11479f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 11489f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND:[^,]+]] 11499f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCELSE]] 11509f2f3b9dSJoel E. Denny // CK4-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 11519f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 11529f2f3b9dSJoel E. Denny // CK4-DAG: [[TO]] 11539f2f3b9dSJoel E. Denny // CK4-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 11549f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 11559f2f3b9dSJoel E. Denny // CK4-DAG: [[TOELSE]] 11569f2f3b9dSJoel E. Denny // CK4-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 11579f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 11589f2f3b9dSJoel E. Denny // CK4-DAG: [[FROM]] 11599f2f3b9dSJoel E. Denny // CK4-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 11609f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 11619f2f3b9dSJoel E. Denny // CK4-DAG: [[TYEND]] 11629f2f3b9dSJoel E. Denny // CK4-DAG: [[PHITYPE0:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 11639f2f3b9dSJoel E. Denny // CK4: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR0BC]], i8* [[PTRADDR0BC]], i64 [[CUSIZE]], i64 [[PHITYPE0]]) 11649f2f3b9dSJoel E. Denny // CK4-DAG: [[BPTRADDR1BC:%.+]] = bitcast %class.C* [[OBJ]] to i8* 11659f2f3b9dSJoel E. Denny // CK4-DAG: [[PTRADDR1BC:%.+]] = bitcast i32* [[ABEGIN]] to i8* 11669f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[MEMBER:[^,]+]] 11679f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBER]] 11689f2f3b9dSJoel E. Denny // CK4-DAG: br i1 false, label %[[LTYPE:[^,]+]], label %[[MEMBERCOM:[^,]+]] 11699f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBERCOM]] 11709f2f3b9dSJoel E. Denny // 281474976710659 == 0x1,000,000,003 11719f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBERCOMTYPE:%.+]] = add nuw i64 281474976710659, [[SHIPRESIZE]] 11729f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[LTYPE]] 11739f2f3b9dSJoel E. Denny // CK4-DAG: [[LTYPE]] 11749f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBERTYPE:%.+]] = phi i64 [ 281474976710659, %[[MEMBER]] ], [ [[MEMBERCOMTYPE]], %[[MEMBERCOM]] ] 11759f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 11769f2f3b9dSJoel E. Denny // CK4-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 11779f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 11789f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOC]] 11799f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 11809f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND:[^,]+]] 11819f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCELSE]] 11829f2f3b9dSJoel E. Denny // CK4-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 11839f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 11849f2f3b9dSJoel E. Denny // CK4-DAG: [[TO]] 11859f2f3b9dSJoel E. Denny // CK4-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 11869f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 11879f2f3b9dSJoel E. Denny // CK4-DAG: [[TOELSE]] 11889f2f3b9dSJoel E. Denny // CK4-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 11899f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 11909f2f3b9dSJoel E. Denny // CK4-DAG: [[FROM]] 11919f2f3b9dSJoel E. Denny // CK4-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 11929f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 11939f2f3b9dSJoel E. Denny // CK4-DAG: [[TYEND]] 11949f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPE1:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 11959f2f3b9dSJoel E. Denny // CK4: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR1BC]], i8* [[PTRADDR1BC]], i64 4, i64 [[TYPE1]]) 11969f2f3b9dSJoel E. Denny // CK4-DAG: [[BPTRADDR2BC:%.+]] = bitcast double** [[BBEGIN]] to i8* 11979f2f3b9dSJoel E. Denny // CK4-DAG: [[PTRADDR2BC:%.+]] = bitcast double* [[BARRBEGINGEP]] to i8* 11989f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[MEMBER:[^,]+]] 11999f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBER]] 12009f2f3b9dSJoel E. Denny // CK4-DAG: br i1 false, label %[[LTYPE:[^,]+]], label %[[MEMBERCOM:[^,]+]] 12019f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBERCOM]] 12029f2f3b9dSJoel E. Denny // 281474976710675 == 0x1,000,000,013 12039f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBERCOMTYPE:%.+]] = add nuw i64 281474976710675, [[SHIPRESIZE]] 12049f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[LTYPE]] 12059f2f3b9dSJoel E. Denny // CK4-DAG: [[LTYPE]] 12069f2f3b9dSJoel E. Denny // CK4-DAG: [[MEMBERTYPE:%.+]] = phi i64 [ 281474976710675, %[[MEMBER]] ], [ [[MEMBERCOMTYPE]], %[[MEMBERCOM]] ] 12079f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPETF:%.+]] = and i64 [[TYPE]], 3 12089f2f3b9dSJoel E. Denny // CK4-DAG: [[ISALLOC:%.+]] = icmp eq i64 [[TYPETF]], 0 12099f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISALLOC]], label %[[ALLOC:[^,]+]], label %[[ALLOCELSE:[^,]+]] 12109f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOC]] 12119f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCTYPE:%.+]] = and i64 [[MEMBERTYPE]], -4 12129f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND:[^,]+]] 12139f2f3b9dSJoel E. Denny // CK4-DAG: [[ALLOCELSE]] 12149f2f3b9dSJoel E. Denny // CK4-DAG: [[ISTO:%.+]] = icmp eq i64 [[TYPETF]], 1 12159f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISTO]], label %[[TO:[^,]+]], label %[[TOELSE:[^,]+]] 12169f2f3b9dSJoel E. Denny // CK4-DAG: [[TO]] 12179f2f3b9dSJoel E. Denny // CK4-DAG: [[TOTYPE:%.+]] = and i64 [[MEMBERTYPE]], -3 12189f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 12199f2f3b9dSJoel E. Denny // CK4-DAG: [[TOELSE]] 12209f2f3b9dSJoel E. Denny // CK4-DAG: [[ISFROM:%.+]] = icmp eq i64 [[TYPETF]], 2 12219f2f3b9dSJoel E. Denny // CK4-DAG: br i1 [[ISFROM]], label %[[FROM:[^,]+]], label %[[TYEND]] 12229f2f3b9dSJoel E. Denny // CK4-DAG: [[FROM]] 12239f2f3b9dSJoel E. Denny // CK4-DAG: [[FROMTYPE:%.+]] = and i64 [[MEMBERTYPE]], -2 12249f2f3b9dSJoel E. Denny // CK4-DAG: br label %[[TYEND]] 12259f2f3b9dSJoel E. Denny // CK4-DAG: [[TYEND]] 12269f2f3b9dSJoel E. Denny // CK4-DAG: [[TYPE2:%.+]] = phi i64 [ [[ALLOCTYPE]], %[[ALLOC]] ], [ [[TOTYPE]], %[[TO]] ], [ [[FROMTYPE]], %[[FROM]] ], [ [[MEMBERTYPE]], %[[TOELSE]] ] 12279f2f3b9dSJoel E. Denny // CK4: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTRADDR2BC]], i8* [[PTRADDR2BC]], i64 16, i64 [[TYPE2]]) 12289f2f3b9dSJoel E. Denny // CK4: [[PTRNEXT]] = getelementptr %class.C*, %class.C** [[PTR]], i32 1 12299f2f3b9dSJoel E. Denny // CK4: [[ISDONE:%.+]] = icmp eq %class.C** [[PTRNEXT]], [[PTREND]] 12309f2f3b9dSJoel E. Denny // CK4: br i1 [[ISDONE]], label %[[LEXIT:[^,]+]], label %[[LBODY]] 12319f2f3b9dSJoel E. Denny 12329f2f3b9dSJoel E. Denny // CK4: [[LEXIT]] 12339f2f3b9dSJoel E. Denny // CK4: [[ISARRAY:%.+]] = icmp sge i64 [[SIZE]], 1 12349f2f3b9dSJoel E. Denny // CK4: br i1 [[ISARRAY]], label %[[EVALDEL:[^,]+]], label %[[DONE]] 12359f2f3b9dSJoel E. Denny // CK4: [[EVALDEL]] 12369f2f3b9dSJoel E. Denny // CK4: [[TYPEDEL:%.+]] = and i64 [[TYPE]], 8 12379f2f3b9dSJoel E. Denny // CK4: [[ISDEL:%.+]] = icmp ne i64 [[TYPEDEL]], 0 12389f2f3b9dSJoel E. Denny // CK4: br i1 [[ISDEL]], label %[[DEL:[^,]+]], label %[[DONE]] 12399f2f3b9dSJoel E. Denny // CK4: [[DEL]] 12409f2f3b9dSJoel E. Denny // CK4-64-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 16 12419f2f3b9dSJoel E. Denny // CK4-32-DAG: [[ARRSIZE:%.+]] = mul nuw i64 [[SIZE]], 8 12429f2f3b9dSJoel E. Denny // CK4-DAG: [[DTYPE:%.+]] = and i64 [[TYPE]], -4 12439f2f3b9dSJoel E. Denny // CK4: call void @__tgt_push_mapper_component(i8* [[HANDLE]], i8* [[BPTR]], i8* [[BEGIN]], i64 [[ARRSIZE]], i64 [[DTYPE]]) 12449f2f3b9dSJoel E. Denny // CK4: br label %[[DONE]] 12459f2f3b9dSJoel E. Denny // CK4: [[DONE]] 12469f2f3b9dSJoel E. Denny // CK4: ret void 12479f2f3b9dSJoel E. Denny 12489f2f3b9dSJoel E. Denny 12499f2f3b9dSJoel E. Denny // CK4-LABEL: define {{.*}}void @{{.*}}foo{{.*}} 12509f2f3b9dSJoel E. Denny void foo(int a){ 12519f2f3b9dSJoel E. Denny int i = a; 12529f2f3b9dSJoel E. Denny C c; 12539f2f3b9dSJoel E. Denny c.a = a; 12549f2f3b9dSJoel E. Denny 12559f2f3b9dSJoel E. Denny // CK4-DAG: call void @__tgt_target_data_update_mapper(i64 -1, i32 1, i8** [[TGEPBP:%.+]], i8** [[TGEPP:%.+]], i64* getelementptr {{.+}}[1 x i64]* [[TSIZES]], i32 0, i32 0), {{.+}}getelementptr {{.+}}[1 x i64]* [[TTYPES]]{{.+}}, i8** [[TMPRGEP:%.+]]) 12569f2f3b9dSJoel E. Denny // CK4-DAG: [[TGEPBP]] = getelementptr inbounds {{.+}}[[TBP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 12579f2f3b9dSJoel E. Denny // CK4-DAG: [[TGEPP]] = getelementptr inbounds {{.+}}[[TP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 12589f2f3b9dSJoel E. Denny // CK4-DAG: [[TMPRGEP]] = bitcast [1 x i8*]* [[TMPR:%[^,]+]] to i8** 12599f2f3b9dSJoel E. Denny // CK4-DAG: [[TBP0:%.+]] = getelementptr inbounds {{.+}}[[TBP]], i{{.+}} 0, i{{.+}} 0 12609f2f3b9dSJoel E. Denny // CK4-DAG: [[TP0:%.+]] = getelementptr inbounds {{.+}}[[TP]], i{{.+}} 0, i{{.+}} 0 12619f2f3b9dSJoel E. Denny // CK4-DAG: [[TMPR1:%.+]] = getelementptr inbounds {{.+}}[[TMPR]], i[[sz]] 0, i[[sz]] 0 12629f2f3b9dSJoel E. Denny // CK4-DAG: [[TCBP0:%.+]] = bitcast i8** [[TBP0]] to %class.C** 12639f2f3b9dSJoel E. Denny // CK4-DAG: [[TCP0:%.+]] = bitcast i8** [[TP0]] to %class.C** 12649f2f3b9dSJoel E. Denny // CK4-DAG: store %class.C* [[VAL:%[^,]+]], %class.C** [[TCBP0]] 12659f2f3b9dSJoel E. Denny // CK4-DAG: store %class.C* [[VAL]], %class.C** [[TCP0]] 12669f2f3b9dSJoel E. Denny // CK4-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[TMPR1]] 12679f2f3b9dSJoel E. Denny #pragma omp target update to(present, mapper(id): c) 12689f2f3b9dSJoel E. Denny 12699f2f3b9dSJoel E. Denny // CK4-DAG: call void @__tgt_target_data_update_mapper(i64 -1, i32 1, i8** [[FGEPBP:%.+]], i8** [[FGEPP:%.+]], i64* getelementptr {{.+}}[1 x i64]* [[FSIZES]], i32 0, i32 0), {{.+}}getelementptr {{.+}}[1 x i64]* [[FTYPES]]{{.+}}, i8** [[FMPRGEP:%.+]]) 12709f2f3b9dSJoel E. Denny // CK4-DAG: [[FGEPBP]] = getelementptr inbounds {{.+}}[[FBP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 12719f2f3b9dSJoel E. Denny // CK4-DAG: [[FGEPP]] = getelementptr inbounds {{.+}}[[FP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 12729f2f3b9dSJoel E. Denny // CK4-DAG: [[FMPRGEP]] = bitcast [1 x i8*]* [[FMPR:%[^,]+]] to i8** 12739f2f3b9dSJoel E. Denny // CK4-DAG: [[FBP0:%.+]] = getelementptr inbounds {{.+}}[[FBP]], i{{.+}} 0, i{{.+}} 0 12749f2f3b9dSJoel E. Denny // CK4-DAG: [[FP0:%.+]] = getelementptr inbounds {{.+}}[[FP]], i{{.+}} 0, i{{.+}} 0 12759f2f3b9dSJoel E. Denny // CK4-DAG: [[FMPR1:%.+]] = getelementptr inbounds {{.+}}[[FMPR]], i[[sz]] 0, i[[sz]] 0 12769f2f3b9dSJoel E. Denny // CK4-DAG: [[FCBP0:%.+]] = bitcast i8** [[FBP0]] to %class.C** 12779f2f3b9dSJoel E. Denny // CK4-DAG: [[FCP0:%.+]] = bitcast i8** [[FP0]] to %class.C** 12789f2f3b9dSJoel E. Denny // CK4-DAG: store %class.C* [[VAL]], %class.C** [[FCBP0]] 12799f2f3b9dSJoel E. Denny // CK4-DAG: store %class.C* [[VAL]], %class.C** [[FCP0]] 12809f2f3b9dSJoel E. Denny // CK4-DAG: store i8* bitcast (void (i8*, i8*, i8*, i64, i64)* [[MPRFUNC]] to i8*), i8** [[FMPR1]] 12819f2f3b9dSJoel E. Denny #pragma omp target update from(mapper(id), present: c) 12829f2f3b9dSJoel E. Denny } 12839f2f3b9dSJoel E. Denny 12849f2f3b9dSJoel E. Denny #endif // CK4 12859f2f3b9dSJoel E. Denny 1286537b16e9SGeorge Rokos #endif // HEADER 1287