1; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mattr=+thumb2 | FileCheck %s -check-prefix=DARWIN
2; RUN: llc < %s -mtriple=thumbv7-linux -mattr=+thumb2 | FileCheck %s -check-prefix=LINUX
3; XFAIL: *
4
5@t = weak global i32 ()* null           ; <i32 ()**> [#uses=1]
6
7declare void @g(i32, i32, i32, i32)
8
9define void @f() {
10; DARWIN-LABEL: f:
11; DARWIN: blx _g
12
13; LINUX-LABEL: f:
14; LINUX: bl g
15        tail call void @g( i32 1, i32 2, i32 3, i32 4 )
16        ret void
17}
18
19define void @h() {
20; DARWIN-LABEL: h:
21; DARWIN: bx r0 @ TAILCALL
22
23; LINUX-LABEL: h:
24; LINUX: bx r0 @ TAILCALL
25        %tmp = load i32 ()** @t         ; <i32 ()*> [#uses=1]
26        %tmp.upgrd.2 = tail call i32 %tmp( )            ; <i32> [#uses=0]
27        ret void
28}
29
30define void @j() {
31; DARWIN-LABEL: j:
32; DARWIN: b.w _f  @ TAILCALL
33
34; LINUX-LABEL: j:
35; LINUX: b.w f  @ TAILCALL
36        tail call void @f()
37        ret void
38}
39