1*f4a2713aSLionel Sambuc; RUN: llc < %s -march=x86 -tailcallopt | FileCheck %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambucdeclare i32 @putchar(i32) 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambucdefine fastcc i32 @checktail(i32 %x, i32* %f, i32 %g) nounwind { 6*f4a2713aSLionel Sambuc; CHECK-LABEL: checktail: 7*f4a2713aSLionel Sambuc %tmp1 = icmp sgt i32 %x, 0 8*f4a2713aSLionel Sambuc br i1 %tmp1, label %if-then, label %if-else 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambucif-then: 11*f4a2713aSLionel Sambuc %fun_ptr = bitcast i32* %f to i32(i32, i32*, i32)* 12*f4a2713aSLionel Sambuc %arg1 = add i32 %x, -1 13*f4a2713aSLionel Sambuc call i32 @putchar(i32 90) 14*f4a2713aSLionel Sambuc; CHECK: jmpl *%e{{.*}} 15*f4a2713aSLionel Sambuc %res = tail call fastcc i32 %fun_ptr( i32 %arg1, i32 * %f, i32 %g) 16*f4a2713aSLionel Sambuc ret i32 %res 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambucif-else: 19*f4a2713aSLionel Sambuc ret i32 %x 20*f4a2713aSLionel Sambuc} 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambucdefine i32 @main() nounwind { 24*f4a2713aSLionel Sambuc %f = bitcast i32 (i32, i32*, i32)* @checktail to i32* 25*f4a2713aSLionel Sambuc %res = tail call fastcc i32 @checktail( i32 10, i32* %f,i32 10) 26*f4a2713aSLionel Sambuc ret i32 %res 27*f4a2713aSLionel Sambuc} 28