1; RUN: llc < %s -mtriple=thumbv7-apple-ios | FileCheck %s
2; RUN: llc < %s -mtriple=thumbv7-apple-ios -arm-default-it | FileCheck %s
3; RUN: llc < %s -mtriple=thumbv8-apple-ios -arm-no-restrict-it | FileCheck %s
4
5define void @foo(i32 %X, i32 %Y) {
6entry:
7; CHECK-LABEL: foo:
8; CHECK: it ne
9; CHECK: cmpne
10; CHECK: it hi
11; CHECK: pophi {r7, pc}
12	%tmp1 = icmp ult i32 %X, 4		; <i1> [#uses=1]
13	%tmp4 = icmp eq i32 %Y, 0		; <i1> [#uses=1]
14	%tmp7 = or i1 %tmp4, %tmp1		; <i1> [#uses=1]
15	br i1 %tmp7, label %cond_true, label %UnifiedReturnBlock
16
17cond_true:		; preds = %entry
18	%tmp10 = call i32 (...)* @bar( )		; <i32> [#uses=0]
19	ret void
20
21UnifiedReturnBlock:		; preds = %entry
22	ret void
23}
24
25declare i32 @bar(...)
26
27; FIXME: Need post-ifcvt branch folding to get rid of the extra br at end of BB1.
28
29	%struct.quad_struct = type { i32, i32, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct* }
30
31define fastcc i32 @CountTree(%struct.quad_struct* %tree) {
32entry:
33; CHECK-LABEL: CountTree:
34; CHECK: bne
35; CHECK: cmp
36; CHECK: it eq
37; CHECK: cmpeq
38; CHECK: itt eq
39; CHECK: moveq
40; CHECK: popeq
41	br label %tailrecurse
42
43tailrecurse:		; preds = %bb, %entry
44	%tmp6 = load %struct.quad_struct** null		; <%struct.quad_struct*> [#uses=1]
45	%tmp9 = load %struct.quad_struct** null		; <%struct.quad_struct*> [#uses=2]
46	%tmp12 = load %struct.quad_struct** null		; <%struct.quad_struct*> [#uses=1]
47	%tmp14 = icmp eq %struct.quad_struct* null, null		; <i1> [#uses=1]
48	%tmp17 = icmp eq %struct.quad_struct* %tmp6, null		; <i1> [#uses=1]
49	%tmp23 = icmp eq %struct.quad_struct* %tmp9, null		; <i1> [#uses=1]
50	%tmp29 = icmp eq %struct.quad_struct* %tmp12, null		; <i1> [#uses=1]
51	%bothcond = and i1 %tmp17, %tmp14		; <i1> [#uses=1]
52	%bothcond1 = and i1 %bothcond, %tmp23		; <i1> [#uses=1]
53	%bothcond2 = and i1 %bothcond1, %tmp29		; <i1> [#uses=1]
54	br i1 %bothcond2, label %return, label %bb
55
56bb:		; preds = %tailrecurse
57	%tmp41 = tail call fastcc i32 @CountTree( %struct.quad_struct* %tmp9 )		; <i32> [#uses=0]
58	br label %tailrecurse
59
60return:		; preds = %tailrecurse
61	ret i32 0
62}
63
64	%struct.SString = type { i8*, i32, i32 }
65
66declare void @abort()
67
68define fastcc void @t1(%struct.SString* %word, i8 signext  %c) {
69entry:
70; CHECK-LABEL: t1:
71; CHECK: it ne
72; CHECK: popne {r7, pc}
73	%tmp1 = icmp eq %struct.SString* %word, null		; <i1> [#uses=1]
74	br i1 %tmp1, label %cond_true, label %cond_false
75
76cond_true:		; preds = %entry
77	tail call void @abort( )
78	unreachable
79
80cond_false:		; preds = %entry
81	ret void
82}
83
84define fastcc void @t2() nounwind {
85entry:
86; CHECK-LABEL: t2:
87; CHECK: cmp r0, #0
88; CHECK: %growMapping.exit
89	br i1 undef, label %bb.i.i3, label %growMapping.exit
90
91bb.i.i3:		; preds = %entry
92	unreachable
93
94growMapping.exit:		; preds = %entry
95	unreachable
96}
97