1; RUN: llc -march=mipsel -disable-mips-delay-filler -relocation-model=pic < %s | \ 2; RUN: FileCheck %s -check-prefix=O32 3; RUN: llc -march=mipsel -mips-load-target-from-got=false \ 4; RUN: -disable-mips-delay-filler -relocation-model=pic < %s | FileCheck %s -check-prefix=O32-LOADTGT 5 6@gd1 = common global double 0.000000e+00, align 8 7@gd2 = common global double 0.000000e+00, align 8 8 9; O32-LABEL: caller3: 10; O32-DAG: lw $25, %call16(callee3) 11; O32-DAG: move $gp 12; O32: jalr $25 13; O32-NOT: move $gp 14; O32: lw $25, %call16(callee3) 15; O32-NOT: move $gp 16; O32: jalr $25 17; O32-NOT: move $gp 18; O32: lw $25, %call16(callee3) 19; O32-NOT: move $gp 20; O32: jalr $25 21 22; O32-LOADTGT-LABEL: caller3: 23; O32-LOADTGT-DAG: lw $25, %call16(callee3) 24; O32-LOADTGT-DAG: move $gp 25; O32-LOADTGT: jalr $25 26; O32-LOADTGT-NOT: move $gp 27; O32-LOADTGT: move $25 28; O32-LOADTGT-NOT: move $gp 29; O32-LOADTGT: jalr $25 30; O32-LOADTGT-NOT: move $gp 31; O32-LOADTGT: move $25 32; O32-LOADTGT-NOT: move $gp 33; O32-LOADTGT: jalr $25 34 35define void @caller3(i32 %n) { 36entry: 37 tail call void @callee3() 38 tail call void @callee3() 39 %tobool1 = icmp eq i32 %n, 0 40 br i1 %tobool1, label %while.end, label %while.body 41 42while.body: 43 %n.addr.02 = phi i32 [ %dec, %while.body ], [ %n, %entry ] 44 %dec = add nsw i32 %n.addr.02, -1 45 tail call void @callee3() 46 %tobool = icmp eq i32 %dec, 0 47 br i1 %tobool, label %while.end, label %while.body 48 49while.end: 50 ret void 51} 52 53declare void @callee3() 54 55; O32-LABEL: caller4: 56; O32-DAG: lw $25, %call16(ceil) 57; O32-DAG: move $gp 58; O32: jalr $25 59; O32-NOT: move $gp 60; O32: lw $25, %call16(ceil) 61; O32-NOT: move $gp 62; O32: jalr $25 63; O32-NOT: move $gp 64; O32: lw $25, %call16(ceil) 65; O32-NOT: move $gp 66; O32: jalr $25 67 68; O32-LOADTGT-LABEL: caller4: 69; O32-LOADTGT-DAG: lw $25, %call16(ceil) 70; O32-LOADTGT-DAG: move $gp 71; O32-LOADTGT: jalr $25 72; O32-LOADTGT-NOT: move $gp 73; O32-LOADTGT: move $25 74; O32-LOADTGT-NOT: move $gp 75; O32-LOADTGT: jalr $25 76; O32-LOADTGT-NOT: move $gp 77; O32-LOADTGT: move $25 78; O32-LOADTGT-NOT: move $gp 79; O32-LOADTGT: jalr $25 80 81define void @caller4(double %d) { 82entry: 83 %call = tail call double @ceil(double %d) 84 %call1 = tail call double @ceil(double %call) 85 store double %call1, double* @gd2, align 8 86 %call2 = tail call double @ceil(double %call1) 87 store double %call2, double* @gd1, align 8 88 ret void 89} 90 91declare double @ceil(double) 92 93; Make sure that the MipsOptimizePICCall pass is run even for optnone functions, 94; as we have to make sure that jalr uses $t9 for PIC code in order to adhere to 95; the MIPS o32 ABI. 96define hidden double @foo(double %dbl) #0 { 97entry: 98 ; O32: jalr $25 99 %res = call double @sqrt(double %dbl) 100 ret double %res 101} 102 103declare double @sqrt(double) 104 105attributes #0 = { noinline optnone } 106