blob: 213db5e1d01eeaed3aa0cd753a20234a602799ec [file] [log] [blame]
Evan Cheng3d2125c2010-11-30 23:55:39 +00001; 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
Dale Johannesenc66cdf72010-06-18 19:00:18 +00003
4@t = weak global i32 ()* null ; <i32 ()**> [#uses=1]
5
6declare void @g(i32, i32, i32, i32)
7
Evan Cheng0110ac62010-06-19 01:01:32 +00008define void @t1() {
9; CHECKELF: t1:
Evan Cheng3d2125c2010-11-30 23:55:39 +000010; CHECKELF: bl g(PLT)
Dale Johannesenc66cdf72010-06-18 19:00:18 +000011 call void @g( i32 1, i32 2, i32 3, i32 4 )
12 ret void
13}
14
Evan Cheng0110ac62010-06-19 01:01:32 +000015define void @t2() {
Evan Cheng3d2125c2010-11-30 23:55:39 +000016; CHECKV6: t2:
17; CHECKV6: bx r0 @ TAILCALL
Dale Johannesenc66cdf72010-06-18 19:00:18 +000018 %tmp = load i32 ()** @t ; <i32 ()*> [#uses=1]
19 %tmp.upgrd.2 = tail call i32 %tmp( ) ; <i32> [#uses=0]
20 ret void
21}
22
Evan Cheng3d2125c2010-11-30 23:55:39 +000023define void @t3() {
24; CHECKV6: t3:
25; CHECKV6: b _t2 @ TAILCALL
26; CHECKELF: t3:
27; CHECKELF: b t2(PLT) @ TAILCALL
Dale Johannesen7835f1f2010-07-08 01:18:23 +000028 tail call void @t2( ) ; <i32> [#uses=0]
29 ret void
30}
Evan Cheng3d2125c2010-11-30 23:55:39 +000031
32; Sibcall optimization of expanded libcalls. rdar://8707777
33define double @t4(double %a) nounwind readonly ssp {
34entry:
35; CHECKV6: t4:
36; CHECKV6: b _sin @ TAILCALL
37; CHECKELF: t4:
38; CHECKELF: b sin(PLT) @ TAILCALL
39 %0 = tail call double @sin(double %a) nounwind readonly ; <double> [#uses=1]
40 ret double %0
41}
42
43define float @t5(float %a) nounwind readonly ssp {
44entry:
45; CHECKV6: t5:
46; CHECKV6: b _sinf @ TAILCALL
47; CHECKELF: t5:
48; CHECKELF: b sinf(PLT) @ TAILCALL
49 %0 = tail call float @sinf(float %a) nounwind readonly ; <float> [#uses=1]
50 ret float %0
51}
52
53declare float @sinf(float) nounwind readonly
54
55declare double @sin(double) nounwind readonly
56
57define i32 @t6(i32 %a, i32 %b) nounwind readnone {
58entry:
59; CHECKV6: t6:
60; CHECKV6: b ___divsi3 @ TAILCALL
61; CHECKELF: t6:
62; CHECKELF: b __aeabi_idiv(PLT) @ TAILCALL
63 %0 = sdiv i32 %a, %b
64 ret i32 %0
65}