Debian Codegraph @

llvm/test/CodeGen/PowerPC/ctrloop-le.ll

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