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