1 ; RUN: llc < %s -mtriple=armv6-apple-darwin -mattr=+vfp2 -arm-tail-calls | FileCheck %s -check-prefix=CHECKV6
2 ; RUN: llc < %s -mtriple=armv6-linux-gnueabi -relocation-model=pic -mattr=+vfp2 -arm-tail-calls | FileCheck %s -check-prefix=CHECKELF
3 ; RUN: llc < %s -mtriple=thumbv7-apple-darwin -arm-tail-calls | FileCheck %s -check-prefix=CHECKT2D
5 @t = weak global i32 ()* null ; <i32 ()**> [#uses=1]
7 declare void @g(i32, i32, i32, i32)
12 call void @g( i32 1, i32 2, i32 3, i32 4 )
18 ; CHECKV6: bx r0 @ TAILCALL
22 ; CHECKT2D-NEXT: bx r0 @ TAILCALL
23 %tmp = load i32 ()** @t ; <i32 ()*> [#uses=1]
24 %tmp.upgrd.2 = tail call i32 %tmp( ) ; <i32> [#uses=0]
30 ; CHECKV6: b _t2 @ TAILCALL
32 ; CHECKELF: b t2(PLT) @ TAILCALL
34 ; CHECKT2D: b.w _t2 @ TAILCALL
36 tail call void @t2( ) ; <i32> [#uses=0]
40 ; Sibcall optimization of expanded libcalls. rdar://8707777
41 define double @t4(double %a) nounwind readonly ssp {
44 ; CHECKV6: b _sin @ TAILCALL
46 ; CHECKELF: b sin(PLT) @ TAILCALL
47 %0 = tail call double @sin(double %a) nounwind readonly ; <double> [#uses=1]
51 define float @t5(float %a) nounwind readonly ssp {
54 ; CHECKV6: b _sinf @ TAILCALL
56 ; CHECKELF: b sinf(PLT) @ TAILCALL
57 %0 = tail call float @sinf(float %a) nounwind readonly ; <float> [#uses=1]
61 declare float @sinf(float) nounwind readonly
63 declare double @sin(double) nounwind readonly
65 define i32 @t6(i32 %a, i32 %b) nounwind readnone {
68 ; CHECKV6: b ___divsi3 @ TAILCALL
70 ; CHECKELF: b __aeabi_idiv(PLT) @ TAILCALL
75 ; Make sure the tail call instruction isn't deleted
77 declare void @foo() nounwind
79 define void @t7() nounwind {
82 ; CHECKT2D: blxeq _foo
83 ; CHECKT2D-NEXT: pop.w
84 ; CHECKT2D-NEXT: b.w _foo
85 br i1 undef, label %bb, label %bb1.lr.ph
88 tail call void @foo() nounwind
92 tail call void @foo() nounwind