Forgot this test earlier.
[oota-llvm.git] / test / CodeGen / Thumb2 / 2009-09-28-ITBlockBug.ll
1 ; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 | FileCheck %s
2
3 %struct.pix_pos = type { i32, i32, i32, i32, i32, i32 }
4
5 @getNeighbour = external global void (i32, i32, i32, i32, %struct.pix_pos*)*, align 4 ; <void (i32, i32, i32, i32, %struct.pix_pos*)**> [#uses=2]
6
7 define arm_apcscc void @t() nounwind {
8 ; CHECK: t:
9 ; CHECK:      ittt eq
10 ; CHECK-NEXT: addeq
11 ; CHECK-NEXT: movweq
12 ; CHECK-NEXT: movteq
13 entry:
14   %pix_a.i294 = alloca [4 x %struct.pix_pos], align 4 ; <[4 x %struct.pix_pos]*> [#uses=2]
15   br i1 undef, label %land.rhs, label %lor.end
16
17 land.rhs:                                         ; preds = %entry
18   br label %lor.end
19
20 lor.end:                                          ; preds = %land.rhs, %entry
21   switch i32 0, label %if.end371 [
22     i32 10, label %if.then366
23     i32 14, label %if.then366
24   ]
25
26 if.then366:                                       ; preds = %lor.end, %lor.end
27   unreachable
28
29 if.end371:                                        ; preds = %lor.end
30   %arrayidx56.2.i = getelementptr [4 x %struct.pix_pos]* %pix_a.i294, i32 0, i32 2 ; <%struct.pix_pos*> [#uses=1]
31   %arrayidx56.3.i = getelementptr [4 x %struct.pix_pos]* %pix_a.i294, i32 0, i32 3 ; <%struct.pix_pos*> [#uses=1]
32   br i1 undef, label %for.body1857, label %for.end4557
33
34 for.body1857:                                     ; preds = %if.end371
35   br i1 undef, label %if.then1867, label %for.cond1933
36
37 if.then1867:                                      ; preds = %for.body1857
38   unreachable
39
40 for.cond1933:                                     ; preds = %for.body1857
41   br i1 undef, label %for.body1940, label %if.then4493
42
43 for.body1940:                                     ; preds = %for.cond1933
44   %shl = shl i32 undef, 2                         ; <i32> [#uses=1]
45   %shl1959 = shl i32 undef, 2                     ; <i32> [#uses=4]
46   br i1 undef, label %if.then1992, label %if.else2003
47
48 if.then1992:                                      ; preds = %for.body1940
49   %tmp14.i302 = load i32* undef                   ; <i32> [#uses=4]
50   %add.i307452 = or i32 %shl1959, 1               ; <i32> [#uses=1]
51   %sub.i308 = add i32 %shl, -1                    ; <i32> [#uses=4]
52   call arm_apcscc  void undef(i32 %tmp14.i302, i32 %sub.i308, i32 %shl1959, i32 0, %struct.pix_pos* undef) nounwind
53   %tmp49.i309 = load void (i32, i32, i32, i32, %struct.pix_pos*)** @getNeighbour ; <void (i32, i32, i32, i32, %struct.pix_pos*)*> [#uses=1]
54   call arm_apcscc  void %tmp49.i309(i32 %tmp14.i302, i32 %sub.i308, i32 %add.i307452, i32 0, %struct.pix_pos* null) nounwind
55   %tmp49.1.i = load void (i32, i32, i32, i32, %struct.pix_pos*)** @getNeighbour ; <void (i32, i32, i32, i32, %struct.pix_pos*)*> [#uses=1]
56   call arm_apcscc  void %tmp49.1.i(i32 %tmp14.i302, i32 %sub.i308, i32 undef, i32 0, %struct.pix_pos* %arrayidx56.2.i) nounwind
57   call arm_apcscc  void undef(i32 %tmp14.i302, i32 %sub.i308, i32 undef, i32 0, %struct.pix_pos* %arrayidx56.3.i) nounwind
58   unreachable
59
60 if.else2003:                                      ; preds = %for.body1940
61   switch i32 undef, label %if.then2015 [
62     i32 10, label %if.then4382
63     i32 14, label %if.then4382
64   ]
65
66 if.then2015:                                      ; preds = %if.else2003
67   br i1 undef, label %if.else2298, label %if.then2019
68
69 if.then2019:                                      ; preds = %if.then2015
70   br i1 undef, label %if.then2065, label %if.else2081
71
72 if.then2065:                                      ; preds = %if.then2019
73   br label %if.end2128
74
75 if.else2081:                                      ; preds = %if.then2019
76   br label %if.end2128
77
78 if.end2128:                                       ; preds = %if.else2081, %if.then2065
79   unreachable
80
81 if.else2298:                                      ; preds = %if.then2015
82   br i1 undef, label %land.lhs.true2813, label %cond.end2841
83
84 land.lhs.true2813:                                ; preds = %if.else2298
85   br i1 undef, label %cond.end2841, label %cond.true2824
86
87 cond.true2824:                                    ; preds = %land.lhs.true2813
88   br label %cond.end2841
89
90 cond.end2841:                                     ; preds = %cond.true2824, %land.lhs.true2813, %if.else2298
91   br i1 undef, label %for.cond2882.preheader, label %for.cond2940.preheader
92
93 for.cond2882.preheader:                           ; preds = %cond.end2841
94   %mul3693 = shl i32 undef, 1                     ; <i32> [#uses=2]
95   br i1 undef, label %if.then3689, label %if.else3728
96
97 for.cond2940.preheader:                           ; preds = %cond.end2841
98   br label %for.inc3040
99
100 for.inc3040:                                      ; preds = %for.inc3040, %for.cond2940.preheader
101   br label %for.inc3040
102
103 if.then3689:                                      ; preds = %for.cond2882.preheader
104   %add3695 = add nsw i32 %mul3693, %shl1959       ; <i32> [#uses=1]
105   %mul3697 = shl i32 %add3695, 2                  ; <i32> [#uses=2]
106   %arrayidx3705 = getelementptr inbounds i16* undef, i32 1 ; <i16*> [#uses=1]
107   %tmp3706 = load i16* %arrayidx3705              ; <i16> [#uses=1]
108   %conv3707 = sext i16 %tmp3706 to i32            ; <i32> [#uses=1]
109   %add3708 = add nsw i32 %conv3707, %mul3697      ; <i32> [#uses=1]
110   %arrayidx3724 = getelementptr inbounds i16* null, i32 1 ; <i16*> [#uses=1]
111   %tmp3725 = load i16* %arrayidx3724              ; <i16> [#uses=1]
112   %conv3726 = sext i16 %tmp3725 to i32            ; <i32> [#uses=1]
113   %add3727 = add nsw i32 %conv3726, %mul3697      ; <i32> [#uses=1]
114   br label %if.end3770
115
116 if.else3728:                                      ; preds = %for.cond2882.preheader
117   %mul3733 = add i32 %shl1959, 1073741816         ; <i32> [#uses=1]
118   %add3735 = add nsw i32 %mul3733, %mul3693       ; <i32> [#uses=1]
119   %mul3737 = shl i32 %add3735, 2                  ; <i32> [#uses=2]
120   %tmp3746 = load i16* undef                      ; <i16> [#uses=1]
121   %conv3747 = sext i16 %tmp3746 to i32            ; <i32> [#uses=1]
122   %add3748 = add nsw i32 %conv3747, %mul3737      ; <i32> [#uses=1]
123   %arrayidx3765 = getelementptr inbounds i16* null, i32 1 ; <i16*> [#uses=1]
124   %tmp3766 = load i16* %arrayidx3765              ; <i16> [#uses=1]
125   %conv3767 = sext i16 %tmp3766 to i32            ; <i32> [#uses=1]
126   %add3768 = add nsw i32 %conv3767, %mul3737      ; <i32> [#uses=1]
127   br label %if.end3770
128
129 if.end3770:                                       ; preds = %if.else3728, %if.then3689
130   %vec2_y.1 = phi i32 [ %add3727, %if.then3689 ], [ %add3768, %if.else3728 ] ; <i32> [#uses=0]
131   %vec1_y.2 = phi i32 [ %add3708, %if.then3689 ], [ %add3748, %if.else3728 ] ; <i32> [#uses=0]
132   unreachable
133
134 if.then4382:                                      ; preds = %if.else2003, %if.else2003
135   switch i32 undef, label %if.then4394 [
136     i32 10, label %if.else4400
137     i32 14, label %if.else4400
138   ]
139
140 if.then4394:                                      ; preds = %if.then4382
141   unreachable
142
143 if.else4400:                                      ; preds = %if.then4382, %if.then4382
144   br label %for.cond4451.preheader
145
146 for.cond4451.preheader:                           ; preds = %for.cond4451.preheader, %if.else4400
147   br label %for.cond4451.preheader
148
149 if.then4493:                                      ; preds = %for.cond1933
150   unreachable
151
152 for.end4557:                                      ; preds = %if.end371
153   ret void
154 }