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