Test commit. Removed trailing whitespace.
[oota-llvm.git] / test / CodeGen / PowerPC / ctrloop-lt.ll
1 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64"
2 target triple = "powerpc64-unknown-linux-gnu"
3 ; RUN: llc < %s -march=ppc64 | FileCheck %s
4
5 ; CHECK: test_pos1_ir_slt
6 ; CHECK: bdnz
7 ; a < b
8 define void @test_pos1_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
9 entry:
10   %cmp3 = icmp slt i32 8531, %b
11   br i1 %cmp3, label %for.body.lr.ph, label %for.end
12
13 for.body.lr.ph:                                   ; preds = %entry
14   br label %for.body
15
16 for.body:                                         ; preds = %for.body.lr.ph, %for.body
17   %i.04 = phi i32 [ 8531, %for.body.lr.ph ], [ %inc, %for.body ]
18   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
19   %0 = load i8* %arrayidx, align 1
20   %conv = zext i8 %0 to i32
21   %add = add nsw i32 %conv, 1
22   %conv1 = trunc i32 %add to i8
23   store i8 %conv1, i8* %arrayidx, align 1
24   %inc = add nsw i32 %i.04, 1
25   %cmp = icmp slt i32 %inc, %b
26   br i1 %cmp, label %for.body, label %for.end
27
28 for.end:                                          ; preds = %for.body, %entry
29   ret void
30 }
31
32
33
34 ; CHECK: test_pos2_ir_slt
35 ; FIXME: Support this loop!
36 ; CHECK-NOT: bdnz
37 ; a < b
38 define void @test_pos2_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
39 entry:
40   %cmp3 = icmp slt i32 9152, %b
41   br i1 %cmp3, label %for.body.lr.ph, label %for.end
42
43 for.body.lr.ph:                                   ; preds = %entry
44   br label %for.body
45
46 for.body:                                         ; preds = %for.body.lr.ph, %for.body
47   %i.04 = phi i32 [ 9152, %for.body.lr.ph ], [ %inc, %for.body ]
48   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
49   %0 = load i8* %arrayidx, align 1
50   %conv = zext i8 %0 to i32
51   %add = add nsw i32 %conv, 1
52   %conv1 = trunc i32 %add to i8
53   store i8 %conv1, i8* %arrayidx, align 1
54   %inc = add nsw i32 %i.04, 2
55   %cmp = icmp slt i32 %inc, %b
56   br i1 %cmp, label %for.body, label %for.end
57
58 for.end:                                          ; preds = %for.body, %entry
59   ret void
60 }
61
62
63
64 ; CHECK: test_pos4_ir_slt
65 ; FIXME: Support this loop!
66 ; CHECK-NOT: bdnz
67 ; a < b
68 define void @test_pos4_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
69 entry:
70   %cmp3 = icmp slt i32 18851, %b
71   br i1 %cmp3, label %for.body.lr.ph, label %for.end
72
73 for.body.lr.ph:                                   ; preds = %entry
74   br label %for.body
75
76 for.body:                                         ; preds = %for.body.lr.ph, %for.body
77   %i.04 = phi i32 [ 18851, %for.body.lr.ph ], [ %inc, %for.body ]
78   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
79   %0 = load i8* %arrayidx, align 1
80   %conv = zext i8 %0 to i32
81   %add = add nsw i32 %conv, 1
82   %conv1 = trunc i32 %add to i8
83   store i8 %conv1, i8* %arrayidx, align 1
84   %inc = add nsw i32 %i.04, 4
85   %cmp = icmp slt i32 %inc, %b
86   br i1 %cmp, label %for.body, label %for.end
87
88 for.end:                                          ; preds = %for.body, %entry
89   ret void
90 }
91
92
93
94 ; CHECK: test_pos8_ir_slt
95 ; FIXME: Support this loop!
96 ; CHECK-NOT: bdnz
97 ; a < b
98 define void @test_pos8_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
99 entry:
100   %cmp3 = icmp slt i32 25466, %b
101   br i1 %cmp3, label %for.body.lr.ph, label %for.end
102
103 for.body.lr.ph:                                   ; preds = %entry
104   br label %for.body
105
106 for.body:                                         ; preds = %for.body.lr.ph, %for.body
107   %i.04 = phi i32 [ 25466, %for.body.lr.ph ], [ %inc, %for.body ]
108   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
109   %0 = load i8* %arrayidx, align 1
110   %conv = zext i8 %0 to i32
111   %add = add nsw i32 %conv, 1
112   %conv1 = trunc i32 %add to i8
113   store i8 %conv1, i8* %arrayidx, align 1
114   %inc = add nsw i32 %i.04, 8
115   %cmp = icmp slt i32 %inc, %b
116   br i1 %cmp, label %for.body, label %for.end
117
118 for.end:                                          ; preds = %for.body, %entry
119   ret void
120 }
121
122
123
124 ; CHECK: test_pos16_ir_slt
125 ; FIXME: Support this loop!
126 ; CHECK-NOT: bdnz
127 ; a < b
128 define void @test_pos16_ir_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
129 entry:
130   %cmp3 = icmp slt i32 9295, %b
131   br i1 %cmp3, label %for.body.lr.ph, label %for.end
132
133 for.body.lr.ph:                                   ; preds = %entry
134   br label %for.body
135
136 for.body:                                         ; preds = %for.body.lr.ph, %for.body
137   %i.04 = phi i32 [ 9295, %for.body.lr.ph ], [ %inc, %for.body ]
138   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
139   %0 = load i8* %arrayidx, align 1
140   %conv = zext i8 %0 to i32
141   %add = add nsw i32 %conv, 1
142   %conv1 = trunc i32 %add to i8
143   store i8 %conv1, i8* %arrayidx, align 1
144   %inc = add nsw i32 %i.04, 16
145   %cmp = icmp slt i32 %inc, %b
146   br i1 %cmp, label %for.body, label %for.end
147
148 for.end:                                          ; preds = %for.body, %entry
149   ret void
150 }
151
152
153
154 ; CHECK: test_pos1_ri_slt
155 ; CHECK: bdnz
156 ; a < b
157 define void @test_pos1_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
158 entry:
159   %cmp3 = icmp slt i32 %a, 31236
160   br i1 %cmp3, label %for.body.lr.ph, label %for.end
161
162 for.body.lr.ph:                                   ; preds = %entry
163   br label %for.body
164
165 for.body:                                         ; preds = %for.body.lr.ph, %for.body
166   %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ]
167   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
168   %0 = load i8* %arrayidx, align 1
169   %conv = zext i8 %0 to i32
170   %add = add nsw i32 %conv, 1
171   %conv1 = trunc i32 %add to i8
172   store i8 %conv1, i8* %arrayidx, align 1
173   %inc = add nsw i32 %i.04, 1
174   %cmp = icmp slt i32 %inc, 31236
175   br i1 %cmp, label %for.body, label %for.end
176
177 for.end:                                          ; preds = %for.body, %entry
178   ret void
179 }
180
181
182
183 ; CHECK: test_pos2_ri_slt
184 ; CHECK: bdnz
185 ; a < b
186 define void @test_pos2_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
187 entry:
188   %cmp3 = icmp slt i32 %a, 22653
189   br i1 %cmp3, label %for.body.lr.ph, label %for.end
190
191 for.body.lr.ph:                                   ; preds = %entry
192   br label %for.body
193
194 for.body:                                         ; preds = %for.body.lr.ph, %for.body
195   %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ]
196   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
197   %0 = load i8* %arrayidx, align 1
198   %conv = zext i8 %0 to i32
199   %add = add nsw i32 %conv, 1
200   %conv1 = trunc i32 %add to i8
201   store i8 %conv1, i8* %arrayidx, align 1
202   %inc = add nsw i32 %i.04, 2
203   %cmp = icmp slt i32 %inc, 22653
204   br i1 %cmp, label %for.body, label %for.end
205
206 for.end:                                          ; preds = %for.body, %entry
207   ret void
208 }
209
210
211
212 ; CHECK: test_pos4_ri_slt
213 ; CHECK: bdnz
214 ; a < b
215 define void @test_pos4_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
216 entry:
217   %cmp3 = icmp slt i32 %a, 1431
218   br i1 %cmp3, label %for.body.lr.ph, label %for.end
219
220 for.body.lr.ph:                                   ; preds = %entry
221   br label %for.body
222
223 for.body:                                         ; preds = %for.body.lr.ph, %for.body
224   %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ]
225   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
226   %0 = load i8* %arrayidx, align 1
227   %conv = zext i8 %0 to i32
228   %add = add nsw i32 %conv, 1
229   %conv1 = trunc i32 %add to i8
230   store i8 %conv1, i8* %arrayidx, align 1
231   %inc = add nsw i32 %i.04, 4
232   %cmp = icmp slt i32 %inc, 1431
233   br i1 %cmp, label %for.body, label %for.end
234
235 for.end:                                          ; preds = %for.body, %entry
236   ret void
237 }
238
239
240
241 ; CHECK: test_pos8_ri_slt
242 ; CHECK: bdnz
243 ; a < b
244 define void @test_pos8_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
245 entry:
246   %cmp3 = icmp slt i32 %a, 22403
247   br i1 %cmp3, label %for.body.lr.ph, label %for.end
248
249 for.body.lr.ph:                                   ; preds = %entry
250   br label %for.body
251
252 for.body:                                         ; preds = %for.body.lr.ph, %for.body
253   %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ]
254   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
255   %0 = load i8* %arrayidx, align 1
256   %conv = zext i8 %0 to i32
257   %add = add nsw i32 %conv, 1
258   %conv1 = trunc i32 %add to i8
259   store i8 %conv1, i8* %arrayidx, align 1
260   %inc = add nsw i32 %i.04, 8
261   %cmp = icmp slt i32 %inc, 22403
262   br i1 %cmp, label %for.body, label %for.end
263
264 for.end:                                          ; preds = %for.body, %entry
265   ret void
266 }
267
268
269
270 ; CHECK: test_pos16_ri_slt
271 ; CHECK: bdnz
272 ; a < b
273 define void @test_pos16_ri_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
274 entry:
275   %cmp3 = icmp slt i32 %a, 21715
276   br i1 %cmp3, label %for.body.lr.ph, label %for.end
277
278 for.body.lr.ph:                                   ; preds = %entry
279   br label %for.body
280
281 for.body:                                         ; preds = %for.body.lr.ph, %for.body
282   %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ]
283   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
284   %0 = load i8* %arrayidx, align 1
285   %conv = zext i8 %0 to i32
286   %add = add nsw i32 %conv, 1
287   %conv1 = trunc i32 %add to i8
288   store i8 %conv1, i8* %arrayidx, align 1
289   %inc = add nsw i32 %i.04, 16
290   %cmp = icmp slt i32 %inc, 21715
291   br i1 %cmp, label %for.body, label %for.end
292
293 for.end:                                          ; preds = %for.body, %entry
294   ret void
295 }
296
297
298
299 ; CHECK: test_pos1_rr_slt
300 ; CHECK: bdnz
301 ; a < b
302 define void @test_pos1_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
303 entry:
304   %cmp3 = icmp slt i32 %a, %b
305   br i1 %cmp3, label %for.body.lr.ph, label %for.end
306
307 for.body.lr.ph:                                   ; preds = %entry
308   br label %for.body
309
310 for.body:                                         ; preds = %for.body.lr.ph, %for.body
311   %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ]
312   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
313   %0 = load i8* %arrayidx, align 1
314   %conv = zext i8 %0 to i32
315   %add = add nsw i32 %conv, 1
316   %conv1 = trunc i32 %add to i8
317   store i8 %conv1, i8* %arrayidx, align 1
318   %inc = add nsw i32 %i.04, 1
319   %cmp = icmp slt i32 %inc, %b
320   br i1 %cmp, label %for.body, label %for.end
321
322 for.end:                                          ; preds = %for.body, %entry
323   ret void
324 }
325
326
327
328 ; CHECK: test_pos2_rr_slt
329 ; FIXME: Support this loop!
330 ; CHECK-NOT: bdnz
331 ; a < b
332 define void @test_pos2_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
333 entry:
334   %cmp3 = icmp slt i32 %a, %b
335   br i1 %cmp3, label %for.body.lr.ph, label %for.end
336
337 for.body.lr.ph:                                   ; preds = %entry
338   br label %for.body
339
340 for.body:                                         ; preds = %for.body.lr.ph, %for.body
341   %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ]
342   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
343   %0 = load i8* %arrayidx, align 1
344   %conv = zext i8 %0 to i32
345   %add = add nsw i32 %conv, 1
346   %conv1 = trunc i32 %add to i8
347   store i8 %conv1, i8* %arrayidx, align 1
348   %inc = add nsw i32 %i.04, 2
349   %cmp = icmp slt i32 %inc, %b
350   br i1 %cmp, label %for.body, label %for.end
351
352 for.end:                                          ; preds = %for.body, %entry
353   ret void
354 }
355
356
357
358 ; CHECK: test_pos4_rr_slt
359 ; FIXME: Support this loop!
360 ; CHECK-NOT: bdnz
361 ; a < b
362 define void @test_pos4_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
363 entry:
364   %cmp3 = icmp slt i32 %a, %b
365   br i1 %cmp3, label %for.body.lr.ph, label %for.end
366
367 for.body.lr.ph:                                   ; preds = %entry
368   br label %for.body
369
370 for.body:                                         ; preds = %for.body.lr.ph, %for.body
371   %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ]
372   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
373   %0 = load i8* %arrayidx, align 1
374   %conv = zext i8 %0 to i32
375   %add = add nsw i32 %conv, 1
376   %conv1 = trunc i32 %add to i8
377   store i8 %conv1, i8* %arrayidx, align 1
378   %inc = add nsw i32 %i.04, 4
379   %cmp = icmp slt i32 %inc, %b
380   br i1 %cmp, label %for.body, label %for.end
381
382 for.end:                                          ; preds = %for.body, %entry
383   ret void
384 }
385
386
387
388 ; CHECK: test_pos8_rr_slt
389 ; FIXME: Support this loop!
390 ; CHECK-NOT: bdnz
391 ; a < b
392 define void @test_pos8_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
393 entry:
394   %cmp3 = icmp slt i32 %a, %b
395   br i1 %cmp3, label %for.body.lr.ph, label %for.end
396
397 for.body.lr.ph:                                   ; preds = %entry
398   br label %for.body
399
400 for.body:                                         ; preds = %for.body.lr.ph, %for.body
401   %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ]
402   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
403   %0 = load i8* %arrayidx, align 1
404   %conv = zext i8 %0 to i32
405   %add = add nsw i32 %conv, 1
406   %conv1 = trunc i32 %add to i8
407   store i8 %conv1, i8* %arrayidx, align 1
408   %inc = add nsw i32 %i.04, 8
409   %cmp = icmp slt i32 %inc, %b
410   br i1 %cmp, label %for.body, label %for.end
411
412 for.end:                                          ; preds = %for.body, %entry
413   ret void
414 }
415
416
417
418 ; CHECK: test_pos16_rr_slt
419 ; FIXME: Support this loop!
420 ; CHECK-NOT: bdnz
421 ; a < b
422 define void @test_pos16_rr_slt(i8* nocapture %p, i32 %a, i32 %b) nounwind {
423 entry:
424   %cmp3 = icmp slt i32 %a, %b
425   br i1 %cmp3, label %for.body.lr.ph, label %for.end
426
427 for.body.lr.ph:                                   ; preds = %entry
428   br label %for.body
429
430 for.body:                                         ; preds = %for.body.lr.ph, %for.body
431   %i.04 = phi i32 [ %a, %for.body.lr.ph ], [ %inc, %for.body ]
432   %arrayidx = getelementptr inbounds i8* %p, i32 %i.04
433   %0 = load i8* %arrayidx, align 1
434   %conv = zext i8 %0 to i32
435   %add = add nsw i32 %conv, 1
436   %conv1 = trunc i32 %add to i8
437   store i8 %conv1, i8* %arrayidx, align 1
438   %inc = add nsw i32 %i.04, 16
439   %cmp = icmp slt i32 %inc, %b
440   br i1 %cmp, label %for.body, label %for.end
441
442 for.end:                                          ; preds = %for.body, %entry
443   ret void
444 }
445