1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -O1 -disable-ppc-sco=false -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=CHECK-SCO 2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -O1 -disable-ppc-sco=false -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 | FileCheck %s -check-prefix=CHECK-SCO-HASQPX 3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -O1 -disable-ppc-sco=false -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 | FileCheck %s -check-prefix=CHECK-SCO-HASQPX 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker; No combination of "powerpc64le-unknown-linux-gnu" + "CHECK-SCO", because 6*9880d681SAndroid Build Coastguard Worker; only Power8 (and later) fully support LE. 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Worker%S_56 = type { [13 x i32], i32 } 9*9880d681SAndroid Build Coastguard Worker%S_64 = type { [15 x i32], i32 } 10*9880d681SAndroid Build Coastguard Worker%S_32 = type { [7 x i32], i32 } 11*9880d681SAndroid Build Coastguard Worker 12*9880d681SAndroid Build Coastguard Worker; Function Attrs: noinline nounwind 13*9880d681SAndroid Build Coastguard Workerdefine void @callee_56_copy([7 x i64] %a, %S_56* %b) #0 { ret void } 14*9880d681SAndroid Build Coastguard Workerdefine void @callee_64_copy([8 x i64] %a, %S_64* %b) #0 { ret void } 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind 17*9880d681SAndroid Build Coastguard Workerdefine void @caller_56_reorder_copy(%S_56* %b, [7 x i64] %a) #1 { 18*9880d681SAndroid Build Coastguard Worker tail call void @callee_56_copy([7 x i64] %a, %S_56* %b) 19*9880d681SAndroid Build Coastguard Worker ret void 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: caller_56_reorder_copy: 22*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-NOT: stdu 1 23*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: TC_RETURNd8 callee_56_copy 24*9880d681SAndroid Build Coastguard Worker} 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Workerdefine void @caller_64_reorder_copy(%S_64* %b, [8 x i64] %a) #1 { 27*9880d681SAndroid Build Coastguard Worker tail call void @callee_64_copy([8 x i64] %a, %S_64* %b) 28*9880d681SAndroid Build Coastguard Worker ret void 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: caller_64_reorder_copy: 31*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: bl callee_64_copy 32*9880d681SAndroid Build Coastguard Worker} 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard Workerdefine void @callee_64_64_copy([8 x i64] %a, [8 x i64] %b) #0 { ret void } 35*9880d681SAndroid Build Coastguard Workerdefine void @caller_64_64_copy([8 x i64] %a, [8 x i64] %b) #1 { 36*9880d681SAndroid Build Coastguard Worker tail call void @callee_64_64_copy([8 x i64] %a, [8 x i64] %b) 37*9880d681SAndroid Build Coastguard Worker ret void 38*9880d681SAndroid Build Coastguard Worker 39*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: caller_64_64_copy: 40*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: b callee_64_64_copy 41*9880d681SAndroid Build Coastguard Worker} 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Workerdefine void @caller_64_64_reorder_copy([8 x i64] %a, [8 x i64] %b) #1 { 44*9880d681SAndroid Build Coastguard Worker tail call void @callee_64_64_copy([8 x i64] %b, [8 x i64] %a) 45*9880d681SAndroid Build Coastguard Worker ret void 46*9880d681SAndroid Build Coastguard Worker 47*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: caller_64_64_reorder_copy: 48*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: bl callee_64_64_copy 49*9880d681SAndroid Build Coastguard Worker} 50*9880d681SAndroid Build Coastguard Worker 51*9880d681SAndroid Build Coastguard Workerdefine void @caller_64_64_undef_copy([8 x i64] %a, [8 x i64] %b) #1 { 52*9880d681SAndroid Build Coastguard Worker tail call void @callee_64_64_copy([8 x i64] %a, [8 x i64] undef) 53*9880d681SAndroid Build Coastguard Worker ret void 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: caller_64_64_undef_copy: 56*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: b callee_64_64_copy 57*9880d681SAndroid Build Coastguard Worker} 58*9880d681SAndroid Build Coastguard Worker 59*9880d681SAndroid Build Coastguard Workerdefine void @arg8_callee( 60*9880d681SAndroid Build Coastguard Worker float %a, i32 signext %b, float %c, i32* %d, 61*9880d681SAndroid Build Coastguard Worker i8 zeroext %e, float %f, i32* %g, i32 signext %h) 62*9880d681SAndroid Build Coastguard Worker{ 63*9880d681SAndroid Build Coastguard Worker ret void 64*9880d681SAndroid Build Coastguard Worker} 65*9880d681SAndroid Build Coastguard Worker 66*9880d681SAndroid Build Coastguard Workerdefine void @arg8_caller(float %a, i32 signext %b, i8 zeroext %c, i32* %d) { 67*9880d681SAndroid Build Coastguard Workerentry: 68*9880d681SAndroid Build Coastguard Worker tail call void @arg8_callee(float undef, i32 signext undef, float undef, 69*9880d681SAndroid Build Coastguard Worker i32* %d, i8 zeroext undef, float undef, 70*9880d681SAndroid Build Coastguard Worker i32* undef, i32 signext undef) 71*9880d681SAndroid Build Coastguard Worker ret void 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: arg8_caller: 74*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: b arg8_callee 75*9880d681SAndroid Build Coastguard Worker} 76*9880d681SAndroid Build Coastguard Worker 77*9880d681SAndroid Build Coastguard Worker; Struct return test 78*9880d681SAndroid Build Coastguard Worker 79*9880d681SAndroid Build Coastguard Worker; Function Attrs: noinline nounwind 80*9880d681SAndroid Build Coastguard Workerdefine void @callee_sret_56(%S_56* noalias sret %agg.result) #0 { ret void } 81*9880d681SAndroid Build Coastguard Workerdefine void @callee_sret_32(%S_32* noalias sret %agg.result) #0 { ret void } 82*9880d681SAndroid Build Coastguard Worker 83*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind 84*9880d681SAndroid Build Coastguard Workerdefine void @caller_do_something_sret_32(%S_32* noalias sret %agg.result) #1 { 85*9880d681SAndroid Build Coastguard Worker %1 = alloca %S_56, align 4 86*9880d681SAndroid Build Coastguard Worker %2 = bitcast %S_56* %1 to i8* 87*9880d681SAndroid Build Coastguard Worker call void @callee_sret_56(%S_56* nonnull sret %1) 88*9880d681SAndroid Build Coastguard Worker tail call void @callee_sret_32(%S_32* sret %agg.result) 89*9880d681SAndroid Build Coastguard Worker ret void 90*9880d681SAndroid Build Coastguard Worker 91*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: caller_do_something_sret_32: 92*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: stdu 1 93*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: bl callee_sret_56 94*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: addi 1 95*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: TC_RETURNd8 callee_sret_32 96*9880d681SAndroid Build Coastguard Worker} 97*9880d681SAndroid Build Coastguard Worker 98*9880d681SAndroid Build Coastguard Workerdefine void @caller_local_sret_32(%S_32* %a) #1 { 99*9880d681SAndroid Build Coastguard Worker %tmp = alloca %S_32, align 4 100*9880d681SAndroid Build Coastguard Worker tail call void @callee_sret_32(%S_32* nonnull sret %tmp) 101*9880d681SAndroid Build Coastguard Worker ret void 102*9880d681SAndroid Build Coastguard Worker 103*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: caller_local_sret_32: 104*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: bl callee_sret_32 105*9880d681SAndroid Build Coastguard Worker} 106*9880d681SAndroid Build Coastguard Worker 107*9880d681SAndroid Build Coastguard Workerattributes #0 = { noinline nounwind } 108*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind } 109*9880d681SAndroid Build Coastguard Worker 110*9880d681SAndroid Build Coastguard Worker; vector <4 x i1> test 111*9880d681SAndroid Build Coastguard Worker 112*9880d681SAndroid Build Coastguard Workerdefine void @callee_v4i1(i8 %a, <4 x i1> %b, <4 x i1> %c) { ret void } 113*9880d681SAndroid Build Coastguard Workerdefine void @caller_v4i1_reorder(i8 %a, <4 x i1> %b, <4 x i1> %c) { 114*9880d681SAndroid Build Coastguard Worker tail call void @callee_v4i1(i8 %a, <4 x i1> %c, <4 x i1> %b) 115*9880d681SAndroid Build Coastguard Worker ret void 116*9880d681SAndroid Build Coastguard Worker 117*9880d681SAndroid Build Coastguard Worker; <4 x i1> is 32 bytes aligned, if subtarget doesn't support qpx, then we can't 118*9880d681SAndroid Build Coastguard Worker; place b, c to qpx register, so we can't do sco on caller_v4i1_reorder 119*9880d681SAndroid Build Coastguard Worker 120*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: caller_v4i1_reorder: 121*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: bl callee_v4i1 122*9880d681SAndroid Build Coastguard Worker 123*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-HASQPX-LABEL: caller_v4i1_reorder: 124*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-HASQPX: b callee_v4i1 125*9880d681SAndroid Build Coastguard Worker} 126*9880d681SAndroid Build Coastguard Worker 127*9880d681SAndroid Build Coastguard Workerdefine void @f128_callee(i32* %ptr, ppc_fp128 %a, ppc_fp128 %b) { ret void } 128*9880d681SAndroid Build Coastguard Workerdefine void @f128_caller(i32* %ptr, ppc_fp128 %a, ppc_fp128 %b) { 129*9880d681SAndroid Build Coastguard Worker tail call void @f128_callee(i32* %ptr, ppc_fp128 %a, ppc_fp128 %b) 130*9880d681SAndroid Build Coastguard Worker ret void 131*9880d681SAndroid Build Coastguard Worker 132*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: f128_caller: 133*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: b f128_callee 134*9880d681SAndroid Build Coastguard Worker} 135*9880d681SAndroid Build Coastguard Worker 136*9880d681SAndroid Build Coastguard Worker; weak linkage test 137*9880d681SAndroid Build Coastguard Worker%class.T = type { [2 x i8] } 138*9880d681SAndroid Build Coastguard Worker 139*9880d681SAndroid Build Coastguard Workerdefine weak_odr hidden void @wo_hcallee(%class.T* %this, i8* %c) { ret void } 140*9880d681SAndroid Build Coastguard Workerdefine void @wo_hcaller(%class.T* %this, i8* %c) { 141*9880d681SAndroid Build Coastguard Worker tail call void @wo_hcallee(%class.T* %this, i8* %c) 142*9880d681SAndroid Build Coastguard Worker ret void 143*9880d681SAndroid Build Coastguard Worker 144*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: wo_hcaller: 145*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: b wo_hcallee 146*9880d681SAndroid Build Coastguard Worker} 147*9880d681SAndroid Build Coastguard Worker 148*9880d681SAndroid Build Coastguard Workerdefine weak_odr protected void @wo_pcallee(%class.T* %this, i8* %c) { ret void } 149*9880d681SAndroid Build Coastguard Workerdefine void @wo_pcaller(%class.T* %this, i8* %c) { 150*9880d681SAndroid Build Coastguard Worker tail call void @wo_pcallee(%class.T* %this, i8* %c) 151*9880d681SAndroid Build Coastguard Worker ret void 152*9880d681SAndroid Build Coastguard Worker 153*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: wo_pcaller: 154*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: b wo_pcallee 155*9880d681SAndroid Build Coastguard Worker} 156*9880d681SAndroid Build Coastguard Worker 157*9880d681SAndroid Build Coastguard Workerdefine weak_odr void @wo_callee(%class.T* %this, i8* %c) { ret void } 158*9880d681SAndroid Build Coastguard Workerdefine void @wo_caller(%class.T* %this, i8* %c) { 159*9880d681SAndroid Build Coastguard Worker tail call void @wo_callee(%class.T* %this, i8* %c) 160*9880d681SAndroid Build Coastguard Worker ret void 161*9880d681SAndroid Build Coastguard Worker 162*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: wo_caller: 163*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: bl wo_callee 164*9880d681SAndroid Build Coastguard Worker} 165*9880d681SAndroid Build Coastguard Worker 166*9880d681SAndroid Build Coastguard Workerdefine weak protected void @w_pcallee(i8* %ptr) { ret void } 167*9880d681SAndroid Build Coastguard Workerdefine void @w_pcaller(i8* %ptr) { 168*9880d681SAndroid Build Coastguard Worker tail call void @w_pcallee(i8* %ptr) 169*9880d681SAndroid Build Coastguard Worker ret void 170*9880d681SAndroid Build Coastguard Worker 171*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: w_pcaller: 172*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: b w_pcallee 173*9880d681SAndroid Build Coastguard Worker} 174*9880d681SAndroid Build Coastguard Worker 175*9880d681SAndroid Build Coastguard Workerdefine weak hidden void @w_hcallee(i8* %ptr) { ret void } 176*9880d681SAndroid Build Coastguard Workerdefine void @w_hcaller(i8* %ptr) { 177*9880d681SAndroid Build Coastguard Worker tail call void @w_hcallee(i8* %ptr) 178*9880d681SAndroid Build Coastguard Worker ret void 179*9880d681SAndroid Build Coastguard Worker 180*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: w_hcaller: 181*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: b w_hcallee 182*9880d681SAndroid Build Coastguard Worker} 183*9880d681SAndroid Build Coastguard Worker 184*9880d681SAndroid Build Coastguard Workerdefine weak void @w_callee(i8* %ptr) { ret void } 185*9880d681SAndroid Build Coastguard Workerdefine void @w_caller(i8* %ptr) { 186*9880d681SAndroid Build Coastguard Worker tail call void @w_callee(i8* %ptr) 187*9880d681SAndroid Build Coastguard Worker ret void 188*9880d681SAndroid Build Coastguard Worker 189*9880d681SAndroid Build Coastguard Worker; CHECK-SCO-LABEL: w_caller: 190*9880d681SAndroid Build Coastguard Worker; CHECK-SCO: bl w_callee 191*9880d681SAndroid Build Coastguard Worker} 192