• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=thumbv6-apple-darwin10 | grep rsbs | grep {#0}
2
3	%struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
4	%struct.__sFILEX = type opaque
5	%struct.__sbuf = type { i8*, i32 }
6	%struct.adpcm_state = type { i16, i8 }
7@stepsizeTable = internal constant [89 x i32] [i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 16, i32 17, i32 19, i32 21, i32 23, i32 25, i32 28, i32 31, i32 34, i32 37, i32 41, i32 45, i32 50, i32 55, i32 60, i32 66, i32 73, i32 80, i32 88, i32 97, i32 107, i32 118, i32 130, i32 143, i32 157, i32 173, i32 190, i32 209, i32 230, i32 253, i32 279, i32 307, i32 337, i32 371, i32 408, i32 449, i32 494, i32 544, i32 598, i32 658, i32 724, i32 796, i32 876, i32 963, i32 1060, i32 1166, i32 1282, i32 1411, i32 1552, i32 1707, i32 1878, i32 2066, i32 2272, i32 2499, i32 2749, i32 3024, i32 3327, i32 3660, i32 4026, i32 4428, i32 4871, i32 5358, i32 5894, i32 6484, i32 7132, i32 7845, i32 8630, i32 9493, i32 10442, i32 11487, i32 12635, i32 13899, i32 15289, i32 16818, i32 18500, i32 20350, i32 22385, i32 24623, i32 27086, i32 29794, i32 32767]		; <[89 x i32]*> [#uses=4]
8@indexTable = internal constant [16 x i32] [i32 -1, i32 -1, i32 -1, i32 -1, i32 2, i32 4, i32 6, i32 8, i32 -1, i32 -1, i32 -1, i32 -1, i32 2, i32 4, i32 6, i32 8]		; <[16 x i32]*> [#uses=2]
9@abuf = common global [500 x i8] zeroinitializer		; <[500 x i8]*> [#uses=1]
10@.str = private constant [11 x i8] c"input file\00", section "__TEXT,__cstring,cstring_literals", align 1		; <[11 x i8]*> [#uses=1]
11@sbuf = common global [1000 x i16] zeroinitializer		; <[1000 x i16]*> [#uses=1]
12@state = common global %struct.adpcm_state zeroinitializer		; <%struct.adpcm_state*> [#uses=3]
13@__stderrp = external global %struct.FILE*		; <%struct.FILE**> [#uses=1]
14@.str1 = private constant [28 x i8] c"Final valprev=%d, index=%d\0A\00", section "__TEXT,__cstring,cstring_literals", align 1		; <[28 x i8]*> [#uses=1]
15
16define void @adpcm_coder(i16* nocapture %indata, i8* nocapture %outdata, i32 %len, %struct.adpcm_state* nocapture %state) nounwind {
17entry:
18	%0 = getelementptr %struct.adpcm_state* %state, i32 0, i32 0		; <i16*> [#uses=2]
19	%1 = load i16* %0, align 2		; <i16> [#uses=1]
20	%2 = sext i16 %1 to i32		; <i32> [#uses=2]
21	%3 = getelementptr %struct.adpcm_state* %state, i32 0, i32 1		; <i8*> [#uses=2]
22	%4 = load i8* %3, align 2		; <i8> [#uses=1]
23	%5 = sext i8 %4 to i32		; <i32> [#uses=3]
24	%6 = getelementptr [89 x i32]* @stepsizeTable, i32 0, i32 %5		; <i32*> [#uses=1]
25	%7 = load i32* %6, align 4		; <i32> [#uses=1]
26	%8 = icmp sgt i32 %len, 0		; <i1> [#uses=1]
27	br i1 %8, label %bb, label %bb27
28
29bb:		; preds = %bb25, %entry
30	%indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb25 ]		; <i32> [#uses=2]
31	%outp.136 = phi i8* [ %outdata, %entry ], [ %outp.0, %bb25 ]		; <i8*> [#uses=3]
32	%bufferstep.035 = phi i32 [ 1, %entry ], [ %tmp, %bb25 ]		; <i32> [#uses=3]
33	%outputbuffer.134 = phi i32 [ undef, %entry ], [ %outputbuffer.0, %bb25 ]		; <i32> [#uses=2]
34	%index.033 = phi i32 [ %5, %entry ], [ %index.2, %bb25 ]		; <i32> [#uses=1]
35	%valpred.132 = phi i32 [ %2, %entry ], [ %valpred.2, %bb25 ]		; <i32> [#uses=2]
36	%step.031 = phi i32 [ %7, %entry ], [ %36, %bb25 ]		; <i32> [#uses=5]
37	%inp.038 = getelementptr i16* %indata, i32 %indvar		; <i16*> [#uses=1]
38	%9 = load i16* %inp.038, align 2		; <i16> [#uses=1]
39	%10 = sext i16 %9 to i32		; <i32> [#uses=1]
40	%11 = sub i32 %10, %valpred.132		; <i32> [#uses=3]
41	%12 = icmp slt i32 %11, 0		; <i1> [#uses=1]
42	%iftmp.1.0 = select i1 %12, i32 8, i32 0		; <i32> [#uses=2]
43	%13 = sub i32 0, %11		; <i32> [#uses=1]
44	%14 = icmp eq i32 %iftmp.1.0, 0		; <i1> [#uses=2]
45	%. = select i1 %14, i32 %11, i32 %13		; <i32> [#uses=2]
46	%15 = ashr i32 %step.031, 3		; <i32> [#uses=1]
47	%16 = icmp slt i32 %., %step.031		; <i1> [#uses=2]
48	%delta.0 = select i1 %16, i32 0, i32 4		; <i32> [#uses=2]
49	%17 = select i1 %16, i32 0, i32 %step.031		; <i32> [#uses=2]
50	%diff.1 = sub i32 %., %17		; <i32> [#uses=2]
51	%18 = ashr i32 %step.031, 1		; <i32> [#uses=2]
52	%19 = icmp slt i32 %diff.1, %18		; <i1> [#uses=2]
53	%20 = or i32 %delta.0, 2		; <i32> [#uses=1]
54	%21 = select i1 %19, i32 %delta.0, i32 %20		; <i32> [#uses=1]
55	%22 = select i1 %19, i32 0, i32 %18		; <i32> [#uses=2]
56	%diff.2 = sub i32 %diff.1, %22		; <i32> [#uses=1]
57	%23 = ashr i32 %step.031, 2		; <i32> [#uses=2]
58	%24 = icmp slt i32 %diff.2, %23		; <i1> [#uses=2]
59	%25 = zext i1 %24 to i32		; <i32> [#uses=1]
60	%26 = select i1 %24, i32 0, i32 %23		; <i32> [#uses=1]
61	%vpdiff.0 = add i32 %17, %15		; <i32> [#uses=1]
62	%vpdiff.1 = add i32 %vpdiff.0, %22		; <i32> [#uses=1]
63	%vpdiff.2 = add i32 %vpdiff.1, %26		; <i32> [#uses=2]
64	%tmp30 = sub i32 0, %vpdiff.2		; <i32> [#uses=1]
65	%valpred.0.p = select i1 %14, i32 %vpdiff.2, i32 %tmp30		; <i32> [#uses=1]
66	%valpred.0 = add i32 %valpred.0.p, %valpred.132		; <i32> [#uses=3]
67	%27 = icmp sgt i32 %valpred.0, 32767		; <i1> [#uses=1]
68	br i1 %27, label %bb18, label %bb16
69
70bb16:		; preds = %bb
71	%28 = icmp slt i32 %valpred.0, -32768		; <i1> [#uses=1]
72	br i1 %28, label %bb17, label %bb18
73
74bb17:		; preds = %bb16
75	br label %bb18
76
77bb18:		; preds = %bb17, %bb16, %bb
78	%valpred.2 = phi i32 [ -32768, %bb17 ], [ 32767, %bb ], [ %valpred.0, %bb16 ]		; <i32> [#uses=2]
79	%delta.1 = or i32 %21, %iftmp.1.0		; <i32> [#uses=1]
80	%delta.2 = or i32 %delta.1, %25		; <i32> [#uses=1]
81	%29 = xor i32 %delta.2, 1		; <i32> [#uses=3]
82	%30 = getelementptr [16 x i32]* @indexTable, i32 0, i32 %29		; <i32*> [#uses=1]
83	%31 = load i32* %30, align 4		; <i32> [#uses=1]
84	%32 = add i32 %31, %index.033		; <i32> [#uses=2]
85	%33 = icmp slt i32 %32, 0		; <i1> [#uses=1]
86	%index.1 = select i1 %33, i32 0, i32 %32		; <i32> [#uses=2]
87	%34 = icmp sgt i32 %index.1, 88		; <i1> [#uses=1]
88	%index.2 = select i1 %34, i32 88, i32 %index.1		; <i32> [#uses=3]
89	%35 = getelementptr [89 x i32]* @stepsizeTable, i32 0, i32 %index.2		; <i32*> [#uses=1]
90	%36 = load i32* %35, align 4		; <i32> [#uses=1]
91	%37 = icmp eq i32 %bufferstep.035, 0		; <i1> [#uses=1]
92	br i1 %37, label %bb24, label %bb23
93
94bb23:		; preds = %bb18
95	%38 = shl i32 %29, 4		; <i32> [#uses=1]
96	%39 = and i32 %38, 240		; <i32> [#uses=1]
97	br label %bb25
98
99bb24:		; preds = %bb18
100	%40 = trunc i32 %29 to i8		; <i8> [#uses=1]
101	%41 = and i8 %40, 15		; <i8> [#uses=1]
102	%42 = trunc i32 %outputbuffer.134 to i8		; <i8> [#uses=1]
103	%43 = or i8 %41, %42		; <i8> [#uses=1]
104	store i8 %43, i8* %outp.136, align 1
105	%44 = getelementptr i8* %outp.136, i32 1		; <i8*> [#uses=1]
106	br label %bb25
107
108bb25:		; preds = %bb24, %bb23
109	%outputbuffer.0 = phi i32 [ %39, %bb23 ], [ %outputbuffer.134, %bb24 ]		; <i32> [#uses=2]
110	%outp.0 = phi i8* [ %outp.136, %bb23 ], [ %44, %bb24 ]		; <i8*> [#uses=2]
111	%tmp = xor i32 %bufferstep.035, 1		; <i32> [#uses=1]
112	%indvar.next = add i32 %indvar, 1		; <i32> [#uses=2]
113	%exitcond = icmp eq i32 %indvar.next, %len		; <i1> [#uses=1]
114	br i1 %exitcond, label %bb26.bb27_crit_edge, label %bb
115
116bb26.bb27_crit_edge:		; preds = %bb25
117	%phitmp44 = icmp eq i32 %bufferstep.035, 1		; <i1> [#uses=1]
118	br label %bb27
119
120bb27:		; preds = %bb26.bb27_crit_edge, %entry
121	%outp.1.lcssa = phi i8* [ %outp.0, %bb26.bb27_crit_edge ], [ %outdata, %entry ]		; <i8*> [#uses=1]
122	%bufferstep.0.lcssa = phi i1 [ %phitmp44, %bb26.bb27_crit_edge ], [ false, %entry ]		; <i1> [#uses=1]
123	%outputbuffer.1.lcssa = phi i32 [ %outputbuffer.0, %bb26.bb27_crit_edge ], [ undef, %entry ]		; <i32> [#uses=1]
124	%index.0.lcssa = phi i32 [ %index.2, %bb26.bb27_crit_edge ], [ %5, %entry ]		; <i32> [#uses=1]
125	%valpred.1.lcssa = phi i32 [ %valpred.2, %bb26.bb27_crit_edge ], [ %2, %entry ]		; <i32> [#uses=1]
126	br i1 %bufferstep.0.lcssa, label %bb28, label %bb29
127
128bb28:		; preds = %bb27
129	%45 = trunc i32 %outputbuffer.1.lcssa to i8		; <i8> [#uses=1]
130	store i8 %45, i8* %outp.1.lcssa, align 1
131	br label %bb29
132
133bb29:		; preds = %bb28, %bb27
134	%46 = trunc i32 %valpred.1.lcssa to i16		; <i16> [#uses=1]
135	store i16 %46, i16* %0, align 2
136	%47 = trunc i32 %index.0.lcssa to i8		; <i8> [#uses=1]
137	store i8 %47, i8* %3, align 2
138	ret void
139}
140
141define void @adpcm_decoder(i8* nocapture %indata, i16* nocapture %outdata, i32 %len, %struct.adpcm_state* nocapture %state) nounwind {
142entry:
143	%0 = getelementptr %struct.adpcm_state* %state, i32 0, i32 0		; <i16*> [#uses=2]
144	%1 = load i16* %0, align 2		; <i16> [#uses=1]
145	%2 = sext i16 %1 to i32		; <i32> [#uses=2]
146	%3 = getelementptr %struct.adpcm_state* %state, i32 0, i32 1		; <i8*> [#uses=2]
147	%4 = load i8* %3, align 2		; <i8> [#uses=1]
148	%5 = sext i8 %4 to i32		; <i32> [#uses=3]
149	%6 = getelementptr [89 x i32]* @stepsizeTable, i32 0, i32 %5		; <i32*> [#uses=1]
150	%7 = load i32* %6, align 4		; <i32> [#uses=1]
151	%8 = icmp sgt i32 %len, 0		; <i1> [#uses=1]
152	br i1 %8, label %bb, label %bb22
153
154bb:		; preds = %bb20, %entry
155	%indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb20 ]		; <i32> [#uses=2]
156	%inp.131 = phi i8* [ %indata, %entry ], [ %inp.0, %bb20 ]		; <i8*> [#uses=3]
157	%bufferstep.028 = phi i32 [ 0, %entry ], [ %tmp, %bb20 ]		; <i32> [#uses=2]
158	%inputbuffer.127 = phi i32 [ undef, %entry ], [ %inputbuffer.0, %bb20 ]		; <i32> [#uses=2]
159	%index.026 = phi i32 [ %5, %entry ], [ %index.2, %bb20 ]		; <i32> [#uses=1]
160	%valpred.125 = phi i32 [ %2, %entry ], [ %valpred.2, %bb20 ]		; <i32> [#uses=1]
161	%step.024 = phi i32 [ %7, %entry ], [ %35, %bb20 ]		; <i32> [#uses=4]
162	%outp.030 = getelementptr i16* %outdata, i32 %indvar		; <i16*> [#uses=1]
163	%9 = icmp eq i32 %bufferstep.028, 0		; <i1> [#uses=1]
164	br i1 %9, label %bb2, label %bb3
165
166bb2:		; preds = %bb
167	%10 = load i8* %inp.131, align 1		; <i8> [#uses=1]
168	%11 = sext i8 %10 to i32		; <i32> [#uses=2]
169	%12 = getelementptr i8* %inp.131, i32 1		; <i8*> [#uses=1]
170	%13 = ashr i32 %11, 4		; <i32> [#uses=1]
171	br label %bb3
172
173bb3:		; preds = %bb2, %bb
174	%inputbuffer.0 = phi i32 [ %11, %bb2 ], [ %inputbuffer.127, %bb ]		; <i32> [#uses=1]
175	%delta.0.in = phi i32 [ %13, %bb2 ], [ %inputbuffer.127, %bb ]		; <i32> [#uses=5]
176	%inp.0 = phi i8* [ %12, %bb2 ], [ %inp.131, %bb ]		; <i8*> [#uses=1]
177	%delta.0 = and i32 %delta.0.in, 15		; <i32> [#uses=1]
178	%tmp = xor i32 %bufferstep.028, 1		; <i32> [#uses=1]
179	%14 = getelementptr [16 x i32]* @indexTable, i32 0, i32 %delta.0		; <i32*> [#uses=1]
180	%15 = load i32* %14, align 4		; <i32> [#uses=1]
181	%16 = add i32 %15, %index.026		; <i32> [#uses=2]
182	%17 = icmp slt i32 %16, 0		; <i1> [#uses=1]
183	%index.1 = select i1 %17, i32 0, i32 %16		; <i32> [#uses=2]
184	%18 = icmp sgt i32 %index.1, 88		; <i1> [#uses=1]
185	%index.2 = select i1 %18, i32 88, i32 %index.1		; <i32> [#uses=3]
186	%19 = and i32 %delta.0.in, 8		; <i32> [#uses=1]
187	%20 = ashr i32 %step.024, 3		; <i32> [#uses=1]
188	%21 = and i32 %delta.0.in, 4		; <i32> [#uses=1]
189	%22 = icmp eq i32 %21, 0		; <i1> [#uses=1]
190	%23 = select i1 %22, i32 0, i32 %step.024		; <i32> [#uses=1]
191	%vpdiff.0 = add i32 %23, %20		; <i32> [#uses=2]
192	%24 = and i32 %delta.0.in, 2		; <i32> [#uses=1]
193	%25 = icmp eq i32 %24, 0		; <i1> [#uses=1]
194	br i1 %25, label %bb11, label %bb10
195
196bb10:		; preds = %bb3
197	%26 = ashr i32 %step.024, 1		; <i32> [#uses=1]
198	%27 = add i32 %vpdiff.0, %26		; <i32> [#uses=1]
199	br label %bb11
200
201bb11:		; preds = %bb10, %bb3
202	%vpdiff.1 = phi i32 [ %27, %bb10 ], [ %vpdiff.0, %bb3 ]		; <i32> [#uses=2]
203	%28 = and i32 %delta.0.in, 1		; <i32> [#uses=1]
204	%toBool = icmp eq i32 %28, 0		; <i1> [#uses=1]
205	br i1 %toBool, label %bb13, label %bb12
206
207bb12:		; preds = %bb11
208	%29 = ashr i32 %step.024, 2		; <i32> [#uses=1]
209	%30 = add i32 %vpdiff.1, %29		; <i32> [#uses=1]
210	br label %bb13
211
212bb13:		; preds = %bb12, %bb11
213	%vpdiff.2 = phi i32 [ %30, %bb12 ], [ %vpdiff.1, %bb11 ]		; <i32> [#uses=2]
214	%31 = icmp eq i32 %19, 0		; <i1> [#uses=1]
215	%tmp23 = sub i32 0, %vpdiff.2		; <i32> [#uses=1]
216	%valpred.0.p = select i1 %31, i32 %vpdiff.2, i32 %tmp23		; <i32> [#uses=1]
217	%valpred.0 = add i32 %valpred.0.p, %valpred.125		; <i32> [#uses=3]
218	%32 = icmp sgt i32 %valpred.0, 32767		; <i1> [#uses=1]
219	br i1 %32, label %bb20, label %bb18
220
221bb18:		; preds = %bb13
222	%33 = icmp slt i32 %valpred.0, -32768		; <i1> [#uses=1]
223	br i1 %33, label %bb19, label %bb20
224
225bb19:		; preds = %bb18
226	br label %bb20
227
228bb20:		; preds = %bb19, %bb18, %bb13
229	%valpred.2 = phi i32 [ -32768, %bb19 ], [ 32767, %bb13 ], [ %valpred.0, %bb18 ]		; <i32> [#uses=3]
230	%34 = getelementptr [89 x i32]* @stepsizeTable, i32 0, i32 %index.2		; <i32*> [#uses=1]
231	%35 = load i32* %34, align 4		; <i32> [#uses=1]
232	%36 = trunc i32 %valpred.2 to i16		; <i16> [#uses=1]
233	store i16 %36, i16* %outp.030, align 2
234	%indvar.next = add i32 %indvar, 1		; <i32> [#uses=2]
235	%exitcond = icmp eq i32 %indvar.next, %len		; <i1> [#uses=1]
236	br i1 %exitcond, label %bb22, label %bb
237
238bb22:		; preds = %bb20, %entry
239	%index.0.lcssa = phi i32 [ %5, %entry ], [ %index.2, %bb20 ]		; <i32> [#uses=1]
240	%valpred.1.lcssa = phi i32 [ %2, %entry ], [ %valpred.2, %bb20 ]		; <i32> [#uses=1]
241	%37 = trunc i32 %valpred.1.lcssa to i16		; <i16> [#uses=1]
242	store i16 %37, i16* %0, align 2
243	%38 = trunc i32 %index.0.lcssa to i8		; <i8> [#uses=1]
244	store i8 %38, i8* %3, align 2
245	ret void
246}
247
248define i32 @main() nounwind {
249entry:
250	br label %bb
251
252bb:		; preds = %bb3, %entry
253	%0 = tail call  i32 (...)* @read(i32 0, i8* getelementptr ([500 x i8]* @abuf, i32 0, i32 0), i32 500) nounwind		; <i32> [#uses=4]
254	%1 = icmp slt i32 %0, 0		; <i1> [#uses=1]
255	br i1 %1, label %bb1, label %bb2
256
257bb1:		; preds = %bb
258	tail call  void @perror(i8* getelementptr ([11 x i8]* @.str, i32 0, i32 0)) nounwind
259	ret i32 1
260
261bb2:		; preds = %bb
262	%2 = icmp eq i32 %0, 0		; <i1> [#uses=1]
263	br i1 %2, label %bb4, label %bb3
264
265bb3:		; preds = %bb2
266	%3 = shl i32 %0, 1		; <i32> [#uses=1]
267	tail call  void @adpcm_decoder(i8* getelementptr ([500 x i8]* @abuf, i32 0, i32 0), i16* getelementptr ([1000 x i16]* @sbuf, i32 0, i32 0), i32 %3, %struct.adpcm_state* @state) nounwind
268	%4 = shl i32 %0, 2		; <i32> [#uses=1]
269	%5 = tail call  i32 (...)* @write(i32 1, i16* getelementptr ([1000 x i16]* @sbuf, i32 0, i32 0), i32 %4) nounwind		; <i32> [#uses=0]
270	br label %bb
271
272bb4:		; preds = %bb2
273	%6 = load %struct.FILE** @__stderrp, align 4		; <%struct.FILE*> [#uses=1]
274	%7 = load i16* getelementptr (%struct.adpcm_state* @state, i32 0, i32 0), align 4		; <i16> [#uses=1]
275	%8 = sext i16 %7 to i32		; <i32> [#uses=1]
276	%9 = load i8* getelementptr (%struct.adpcm_state* @state, i32 0, i32 1), align 2		; <i8> [#uses=1]
277	%10 = sext i8 %9 to i32		; <i32> [#uses=1]
278	%11 = tail call  i32 (%struct.FILE*, i8*, ...)* @fprintf(%struct.FILE* %6, i8* getelementptr ([28 x i8]* @.str1, i32 0, i32 0), i32 %8, i32 %10) nounwind		; <i32> [#uses=0]
279	ret i32 0
280}
281
282declare i32 @read(...)
283
284declare void @perror(i8* nocapture) nounwind
285
286declare i32 @write(...)
287
288declare i32 @fprintf(%struct.FILE* nocapture, i8* nocapture, ...) nounwind
289