1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -ppc-asm-full-reg-names -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 < %s | FileCheck %s
5 ; unsigned long test_no_prep(char *p, int count) {
6 ; unsigned long i=0, res=0;
11 ; for (; i < count ; i++) {
12 ; unsigned long x1 = *(unsigned long *)(p + i + DISP1);
13 ; unsigned long x2 = *(unsigned long *)(p + i + DISP2);
14 ; unsigned long x3 = *(unsigned long *)(p + i + DISP3);
15 ; unsigned long x4 = *(unsigned long *)(p + i + DISP4);
21 define i64 @test_no_prep(ptr %arg, i32 signext %arg1) {
22 ; CHECK-LABEL: test_no_prep:
23 ; CHECK: # %bb.0: # %bb
24 ; CHECK-NEXT: cmplwi r4, 0
25 ; CHECK-NEXT: beq cr0, .LBB0_4
26 ; CHECK-NEXT: # %bb.1: # %bb3.preheader
27 ; CHECK-NEXT: mtctr r4
28 ; CHECK-NEXT: addi r5, r3, 4004
29 ; CHECK-NEXT: li r3, 0
30 ; CHECK-NEXT: li r6, -3
31 ; CHECK-NEXT: li r7, -2
32 ; CHECK-NEXT: li r8, -1
33 ; CHECK-NEXT: .p2align 4
34 ; CHECK-NEXT: .LBB0_2: # %bb3
36 ; CHECK-NEXT: ldx r9, r5, r6
37 ; CHECK-NEXT: ldx r10, r5, r7
38 ; CHECK-NEXT: ldx r11, r5, r8
39 ; CHECK-NEXT: ld r12, 0(r5)
40 ; CHECK-NEXT: addi r5, r5, 1
41 ; CHECK-NEXT: mulld r9, r10, r9
42 ; CHECK-NEXT: mulld r9, r9, r11
43 ; CHECK-NEXT: maddld r3, r9, r12, r3
44 ; CHECK-NEXT: bdnz .LBB0_2
45 ; CHECK-NEXT: # %bb.3: # %bb25
46 ; CHECK-NEXT: add r3, r3, r4
48 ; CHECK-NEXT: .LBB0_4:
49 ; CHECK-NEXT: addi r3, r4, 0
52 %i = sext i32 %arg1 to i64
53 %i2 = icmp eq i32 %arg1, 0
54 br i1 %i2, label %bb25, label %bb3
56 bb3: ; preds = %bb3, %bb
57 %i4 = phi i64 [ %i23, %bb3 ], [ 0, %bb ]
58 %i5 = phi i64 [ %i22, %bb3 ], [ 0, %bb ]
59 %i6 = getelementptr inbounds i8, ptr %arg, i64 %i4
60 %i7 = getelementptr inbounds i8, ptr %i6, i64 4001
61 %i9 = load i64, ptr %i7, align 8
62 %i10 = getelementptr inbounds i8, ptr %i6, i64 4002
63 %i12 = load i64, ptr %i10, align 8
64 %i13 = getelementptr inbounds i8, ptr %i6, i64 4003
65 %i15 = load i64, ptr %i13, align 8
66 %i16 = getelementptr inbounds i8, ptr %i6, i64 4004
67 %i18 = load i64, ptr %i16, align 8
68 %i19 = mul i64 %i12, %i9
69 %i20 = mul i64 %i19, %i15
70 %i21 = mul i64 %i20, %i18
71 %i22 = add i64 %i21, %i5
72 %i23 = add nuw i64 %i4, 1
73 %i24 = icmp ult i64 %i23, %i
74 br i1 %i24, label %bb3, label %bb25
76 bb25: ; preds = %bb3, %bb
77 %i26 = phi i64 [ 0, %bb ], [ %i22, %bb3 ]
78 %i27 = add i64 %i26, %i
83 ; unsigned long test_ds_prep(char *p, int count) {
84 ; unsigned long i=0, res=0;
89 ; for (; i < count ; i++) {
90 ; unsigned long x1 = *(unsigned long *)(p + i + DISP1);
91 ; unsigned long x2 = *(unsigned long *)(p + i + DISP2);
92 ; unsigned long x3 = *(unsigned long *)(p + i + DISP3);
93 ; unsigned long x4 = *(unsigned long *)(p + i + DISP4);
99 define i64 @test_ds_prep(ptr %arg, i32 signext %arg1) {
100 ; CHECK-LABEL: test_ds_prep:
101 ; CHECK: # %bb.0: # %bb
102 ; CHECK-NEXT: cmplwi r4, 0
103 ; CHECK-NEXT: beq cr0, .LBB1_4
104 ; CHECK-NEXT: # %bb.1: # %bb3.preheader
105 ; CHECK-NEXT: mtctr r4
106 ; CHECK-NEXT: addi r7, r3, 4002
107 ; CHECK-NEXT: li r3, 0
108 ; CHECK-NEXT: li r5, -1
109 ; CHECK-NEXT: li r6, 1
110 ; CHECK-NEXT: .p2align 4
111 ; CHECK-NEXT: .LBB1_2: # %bb3
113 ; CHECK-NEXT: ldx r8, r7, r5
114 ; CHECK-NEXT: ld r9, 0(r7)
115 ; CHECK-NEXT: ldx r10, r7, r6
116 ; CHECK-NEXT: ld r11, 4(r7)
117 ; CHECK-NEXT: addi r7, r7, 1
118 ; CHECK-NEXT: mulld r8, r9, r8
119 ; CHECK-NEXT: mulld r8, r8, r10
120 ; CHECK-NEXT: maddld r3, r8, r11, r3
121 ; CHECK-NEXT: bdnz .LBB1_2
122 ; CHECK-NEXT: # %bb.3: # %bb25
123 ; CHECK-NEXT: add r3, r3, r4
125 ; CHECK-NEXT: .LBB1_4:
126 ; CHECK-NEXT: addi r3, r4, 0
129 %i = sext i32 %arg1 to i64
130 %i2 = icmp eq i32 %arg1, 0
131 br i1 %i2, label %bb25, label %bb3
133 bb3: ; preds = %bb3, %bb
134 %i4 = phi i64 [ %i23, %bb3 ], [ 0, %bb ]
135 %i5 = phi i64 [ %i22, %bb3 ], [ 0, %bb ]
136 %i6 = getelementptr inbounds i8, ptr %arg, i64 %i4
137 %i7 = getelementptr inbounds i8, ptr %i6, i64 4001
138 %i9 = load i64, ptr %i7, align 8
139 %i10 = getelementptr inbounds i8, ptr %i6, i64 4002
140 %i12 = load i64, ptr %i10, align 8
141 %i13 = getelementptr inbounds i8, ptr %i6, i64 4003
142 %i15 = load i64, ptr %i13, align 8
143 %i16 = getelementptr inbounds i8, ptr %i6, i64 4006
144 %i18 = load i64, ptr %i16, align 8
145 %i19 = mul i64 %i12, %i9
146 %i20 = mul i64 %i19, %i15
147 %i21 = mul i64 %i20, %i18
148 %i22 = add i64 %i21, %i5
149 %i23 = add nuw i64 %i4, 1
150 %i24 = icmp ult i64 %i23, %i
151 br i1 %i24, label %bb3, label %bb25
153 bb25: ; preds = %bb3, %bb
154 %i26 = phi i64 [ 0, %bb ], [ %i22, %bb3 ]
155 %i27 = add i64 %i26, %i
159 ; test_max_number_reminder:
160 ; unsigned long test_max_number_reminder(char *p, int count) {
161 ; unsigned long i=0, res=0;
171 ; for (; i < count ; i++) {
172 ; unsigned long x1 = *(unsigned long *)(p + i + DISP1);
173 ; unsigned long x2 = *(unsigned long *)(p + i + DISP2);
174 ; unsigned long x3 = *(unsigned long *)(p + i + DISP3);
175 ; unsigned long x4 = *(unsigned long *)(p + i + DISP4);
176 ; unsigned long x5 = *(unsigned long *)(p + i + DISP5);
177 ; unsigned long x6 = *(unsigned long *)(p + i + DISP6);
178 ; unsigned long x7 = *(unsigned long *)(p + i + DISP7);
179 ; unsigned long x8 = *(unsigned long *)(p + i + DISP8);
180 ; unsigned long x9 = *(unsigned long *)(p + i + DISP9);
181 ; res += x1*x2*x3*x4*x5*x6*x7*x8*x9;
183 ; return res + count;
186 define i64 @test_max_number_reminder(ptr %arg, i32 signext %arg1) {
187 ; CHECK-LABEL: test_max_number_reminder:
188 ; CHECK: # %bb.0: # %bb
189 ; CHECK-NEXT: cmplwi r4, 0
190 ; CHECK-NEXT: beq cr0, .LBB2_4
191 ; CHECK-NEXT: # %bb.1: # %bb3.preheader
192 ; CHECK-NEXT: std r25, -56(r1) # 8-byte Folded Spill
193 ; CHECK-NEXT: std r26, -48(r1) # 8-byte Folded Spill
194 ; CHECK-NEXT: addi r10, r3, 4002
195 ; CHECK-NEXT: li r3, 0
196 ; CHECK-NEXT: li r5, -1
197 ; CHECK-NEXT: li r6, 1
198 ; CHECK-NEXT: li r7, 3
199 ; CHECK-NEXT: li r8, 5
200 ; CHECK-NEXT: li r9, 9
201 ; CHECK-NEXT: std r27, -40(r1) # 8-byte Folded Spill
202 ; CHECK-NEXT: std r28, -32(r1) # 8-byte Folded Spill
203 ; CHECK-NEXT: std r29, -24(r1) # 8-byte Folded Spill
204 ; CHECK-NEXT: std r30, -16(r1) # 8-byte Folded Spill
205 ; CHECK-NEXT: mtctr r4
206 ; CHECK-NEXT: .p2align 4
207 ; CHECK-NEXT: .LBB2_2: # %bb3
209 ; CHECK-NEXT: ldx r11, r10, r5
210 ; CHECK-NEXT: ld r12, 0(r10)
211 ; CHECK-NEXT: ldx r0, r10, r6
212 ; CHECK-NEXT: ldx r30, r10, r7
213 ; CHECK-NEXT: mulld r11, r12, r11
214 ; CHECK-NEXT: ld r29, 4(r10)
215 ; CHECK-NEXT: ldx r28, r10, r8
216 ; CHECK-NEXT: ld r27, 12(r10)
217 ; CHECK-NEXT: ld r26, 8(r10)
218 ; CHECK-NEXT: ldx r25, r10, r9
219 ; CHECK-NEXT: addi r10, r10, 1
220 ; CHECK-NEXT: mulld r11, r11, r0
221 ; CHECK-NEXT: mulld r11, r11, r30
222 ; CHECK-NEXT: mulld r11, r11, r29
223 ; CHECK-NEXT: mulld r11, r11, r28
224 ; CHECK-NEXT: mulld r11, r11, r27
225 ; CHECK-NEXT: mulld r11, r11, r26
226 ; CHECK-NEXT: maddld r3, r11, r25, r3
227 ; CHECK-NEXT: bdnz .LBB2_2
228 ; CHECK-NEXT: # %bb.3:
229 ; CHECK-NEXT: ld r30, -16(r1) # 8-byte Folded Reload
230 ; CHECK-NEXT: ld r29, -24(r1) # 8-byte Folded Reload
231 ; CHECK-NEXT: ld r28, -32(r1) # 8-byte Folded Reload
232 ; CHECK-NEXT: ld r27, -40(r1) # 8-byte Folded Reload
233 ; CHECK-NEXT: add r3, r3, r4
234 ; CHECK-NEXT: ld r26, -48(r1) # 8-byte Folded Reload
235 ; CHECK-NEXT: ld r25, -56(r1) # 8-byte Folded Reload
237 ; CHECK-NEXT: .LBB2_4:
238 ; CHECK-NEXT: addi r3, r4, 0
241 %i = sext i32 %arg1 to i64
242 %i2 = icmp eq i32 %arg1, 0
243 br i1 %i2, label %bb45, label %bb3
245 bb3: ; preds = %bb3, %bb
246 %i4 = phi i64 [ %i43, %bb3 ], [ 0, %bb ]
247 %i5 = phi i64 [ %i42, %bb3 ], [ 0, %bb ]
248 %i6 = getelementptr inbounds i8, ptr %arg, i64 %i4
249 %i7 = getelementptr inbounds i8, ptr %i6, i64 4001
250 %i9 = load i64, ptr %i7, align 8
251 %i10 = getelementptr inbounds i8, ptr %i6, i64 4002
252 %i12 = load i64, ptr %i10, align 8
253 %i13 = getelementptr inbounds i8, ptr %i6, i64 4003
254 %i15 = load i64, ptr %i13, align 8
255 %i16 = getelementptr inbounds i8, ptr %i6, i64 4005
256 %i18 = load i64, ptr %i16, align 8
257 %i19 = getelementptr inbounds i8, ptr %i6, i64 4006
258 %i21 = load i64, ptr %i19, align 8
259 %i22 = getelementptr inbounds i8, ptr %i6, i64 4007
260 %i24 = load i64, ptr %i22, align 8
261 %i25 = getelementptr inbounds i8, ptr %i6, i64 4014
262 %i27 = load i64, ptr %i25, align 8
263 %i28 = getelementptr inbounds i8, ptr %i6, i64 4010
264 %i30 = load i64, ptr %i28, align 8
265 %i31 = getelementptr inbounds i8, ptr %i6, i64 4011
266 %i33 = load i64, ptr %i31, align 8
267 %i34 = mul i64 %i12, %i9
268 %i35 = mul i64 %i34, %i15
269 %i36 = mul i64 %i35, %i18
270 %i37 = mul i64 %i36, %i21
271 %i38 = mul i64 %i37, %i24
272 %i39 = mul i64 %i38, %i27
273 %i40 = mul i64 %i39, %i30
274 %i41 = mul i64 %i40, %i33
275 %i42 = add i64 %i41, %i5
276 %i43 = add nuw i64 %i4, 1
277 %i44 = icmp ult i64 %i43, %i
278 br i1 %i44, label %bb3, label %bb45
280 bb45: ; preds = %bb3, %bb
281 %i46 = phi i64 [ 0, %bb ], [ %i42, %bb3 ]
282 %i47 = add i64 %i46, %i
286 ; test_update_ds_prep_interact:
287 ; unsigned long test_update_ds_prep_interact(char *p, int count) {
288 ; unsigned long i=0, res=0;
293 ; for (; i < count ; i++) {
294 ; unsigned long x1 = *(unsigned long *)(p + 4 * i + DISP1);
295 ; unsigned long x2 = *(unsigned long *)(p + 4 * i + DISP2);
296 ; unsigned long x3 = *(unsigned long *)(p + 4 * i + DISP3);
297 ; unsigned long x4 = *(unsigned long *)(p + 4 * i + DISP4);
298 ; res += x1*x2*x3*x4;
300 ; return res + count;
303 define dso_local i64 @test_update_ds_prep_interact(ptr %arg, i32 signext %arg1) {
304 ; CHECK-LABEL: test_update_ds_prep_interact:
305 ; CHECK: # %bb.0: # %bb
306 ; CHECK-NEXT: cmplwi r4, 0
307 ; CHECK-NEXT: beq cr0, .LBB3_4
308 ; CHECK-NEXT: # %bb.1: # %bb3.preheader
309 ; CHECK-NEXT: mtctr r4
310 ; CHECK-NEXT: addi r5, r3, 3998
311 ; CHECK-NEXT: li r3, 0
312 ; CHECK-NEXT: li r6, -1
313 ; CHECK-NEXT: li r7, 1
314 ; CHECK-NEXT: .p2align 5
315 ; CHECK-NEXT: .LBB3_2: # %bb3
317 ; CHECK-NEXT: ldu r8, 4(r5)
318 ; CHECK-NEXT: ldx r9, r5, r6
319 ; CHECK-NEXT: ldx r10, r5, r7
320 ; CHECK-NEXT: ld r11, 4(r5)
321 ; CHECK-NEXT: mulld r8, r8, r9
322 ; CHECK-NEXT: mulld r8, r8, r10
323 ; CHECK-NEXT: maddld r3, r8, r11, r3
324 ; CHECK-NEXT: bdnz .LBB3_2
325 ; CHECK-NEXT: # %bb.3: # %bb26
326 ; CHECK-NEXT: add r3, r3, r4
328 ; CHECK-NEXT: .LBB3_4:
329 ; CHECK-NEXT: addi r3, r4, 0
332 %i = sext i32 %arg1 to i64
333 %i2 = icmp eq i32 %arg1, 0
334 br i1 %i2, label %bb26, label %bb3
336 bb3: ; preds = %bb3, %bb
337 %i4 = phi i64 [ %i24, %bb3 ], [ 0, %bb ]
338 %i5 = phi i64 [ %i23, %bb3 ], [ 0, %bb ]
340 %i7 = getelementptr inbounds i8, ptr %arg, i64 %i6
341 %i8 = getelementptr inbounds i8, ptr %i7, i64 4001
342 %i10 = load i64, ptr %i8, align 8
343 %i11 = getelementptr inbounds i8, ptr %i7, i64 4002
344 %i13 = load i64, ptr %i11, align 8
345 %i14 = getelementptr inbounds i8, ptr %i7, i64 4003
346 %i16 = load i64, ptr %i14, align 8
347 %i17 = getelementptr inbounds i8, ptr %i7, i64 4006
348 %i19 = load i64, ptr %i17, align 8
349 %i20 = mul i64 %i13, %i10
350 %i21 = mul i64 %i20, %i16
351 %i22 = mul i64 %i21, %i19
352 %i23 = add i64 %i22, %i5
353 %i24 = add nuw i64 %i4, 1
354 %i25 = icmp ult i64 %i24, %i
355 br i1 %i25, label %bb3, label %bb26
357 bb26: ; preds = %bb3, %bb
358 %i27 = phi i64 [ 0, %bb ], [ %i23, %bb3 ]
359 %i28 = add i64 %i27, %i
363 ; test_update_ds_prep_nointeract:
364 ; unsigned long test_update_ds_prep_nointeract(char *p, int count) {
365 ; unsigned long i=0, res=0;
370 ; for (; i < count ; i++) {
371 ; char x1 = *(p + i + DISP1);
372 ; unsigned long x2 = *(unsigned long *)(p + i + DISP2);
373 ; unsigned long x3 = *(unsigned long *)(p + i + DISP3);
374 ; unsigned long x4 = *(unsigned long *)(p + i + DISP4);
375 ; res += (unsigned long)x1*x2*x3*x4;
377 ; return res + count;
380 define i64 @test_update_ds_prep_nointeract(ptr %arg, i32 signext %arg1) {
381 ; CHECK-LABEL: test_update_ds_prep_nointeract:
382 ; CHECK: # %bb.0: # %bb
383 ; CHECK-NEXT: cmplwi r4, 0
384 ; CHECK-NEXT: beq cr0, .LBB4_4
385 ; CHECK-NEXT: # %bb.1: # %bb3.preheader
386 ; CHECK-NEXT: mtctr r4
387 ; CHECK-NEXT: addi r5, r3, 4000
388 ; CHECK-NEXT: addi r6, r3, 4003
389 ; CHECK-NEXT: li r3, 0
390 ; CHECK-NEXT: li r7, -1
391 ; CHECK-NEXT: .p2align 4
392 ; CHECK-NEXT: .LBB4_2: # %bb3
394 ; CHECK-NEXT: lbzu r8, 1(r5)
395 ; CHECK-NEXT: ldx r9, r6, r7
396 ; CHECK-NEXT: ld r10, 0(r6)
397 ; CHECK-NEXT: ld r11, 4(r6)
398 ; CHECK-NEXT: addi r6, r6, 1
399 ; CHECK-NEXT: mulld r8, r9, r8
400 ; CHECK-NEXT: mulld r8, r8, r10
401 ; CHECK-NEXT: maddld r3, r8, r11, r3
402 ; CHECK-NEXT: bdnz .LBB4_2
403 ; CHECK-NEXT: # %bb.3: # %bb25
404 ; CHECK-NEXT: add r3, r3, r4
406 ; CHECK-NEXT: .LBB4_4:
407 ; CHECK-NEXT: addi r3, r4, 0
410 %i = sext i32 %arg1 to i64
411 %i2 = icmp eq i32 %arg1, 0
412 br i1 %i2, label %bb25, label %bb3
414 bb3: ; preds = %bb3, %bb
415 %i4 = phi i64 [ %i23, %bb3 ], [ 0, %bb ]
416 %i5 = phi i64 [ %i22, %bb3 ], [ 0, %bb ]
417 %i6 = getelementptr inbounds i8, ptr %arg, i64 %i4
418 %i7 = getelementptr inbounds i8, ptr %i6, i64 4001
419 %i8 = load i8, ptr %i7, align 1
420 %i9 = getelementptr inbounds i8, ptr %i6, i64 4002
421 %i11 = load i64, ptr %i9, align 8
422 %i12 = getelementptr inbounds i8, ptr %i6, i64 4003
423 %i14 = load i64, ptr %i12, align 8
424 %i15 = getelementptr inbounds i8, ptr %i6, i64 4007
425 %i17 = load i64, ptr %i15, align 8
426 %i18 = zext i8 %i8 to i64
427 %i19 = mul i64 %i11, %i18
428 %i20 = mul i64 %i19, %i14
429 %i21 = mul i64 %i20, %i17
430 %i22 = add i64 %i21, %i5
431 %i23 = add nuw i64 %i4, 1
432 %i24 = icmp ult i64 %i23, %i
433 br i1 %i24, label %bb3, label %bb25
435 bb25: ; preds = %bb3, %bb
436 %i26 = phi i64 [ 0, %bb ], [ %i22, %bb3 ]
437 %i27 = add i64 %i26, %i
441 ; test_ds_multiple_chains:
442 ; unsigned long test_ds_multiple_chains(char *p, char *q, int count) {
443 ; unsigned long i=0, res=0;
448 ; for (; i < count ; i++) {
449 ; unsigned long x1 = *(unsigned long *)(p + i + DISP1);
450 ; unsigned long x2 = *(unsigned long *)(p + i + DISP2);
451 ; unsigned long x3 = *(unsigned long *)(p + i + DISP3);
452 ; unsigned long x4 = *(unsigned long *)(p + i + DISP4);
453 ; unsigned long x5 = *(unsigned long *)(q + i + DISP1);
454 ; unsigned long x6 = *(unsigned long *)(q + i + DISP2);
455 ; unsigned long x7 = *(unsigned long *)(q + i + DISP3);
456 ; unsigned long x8 = *(unsigned long *)(q + i + DISP4);
457 ; res += x1*x2*x3*x4*x5*x6*x7*x8;
459 ; return res + count;
462 define dso_local i64 @test_ds_multiple_chains(ptr %arg, ptr %arg1, i32 signext %arg2) {
463 ; CHECK-LABEL: test_ds_multiple_chains:
464 ; CHECK: # %bb.0: # %bb
465 ; CHECK-NEXT: cmplwi r5, 0
466 ; CHECK-NEXT: beq cr0, .LBB5_4
467 ; CHECK-NEXT: # %bb.1: # %bb4.preheader
468 ; CHECK-NEXT: std r30, -16(r1) # 8-byte Folded Spill
469 ; CHECK-NEXT: addi r6, r3, 4001
470 ; CHECK-NEXT: addi r4, r4, 4001
471 ; CHECK-NEXT: li r3, 0
472 ; CHECK-NEXT: li r7, 9
473 ; CHECK-NEXT: mtctr r5
474 ; CHECK-NEXT: .p2align 4
475 ; CHECK-NEXT: .LBB5_2: # %bb4
477 ; CHECK-NEXT: ld r8, 0(r6)
478 ; CHECK-NEXT: ldx r9, r6, r7
479 ; CHECK-NEXT: ld r10, 4(r6)
480 ; CHECK-NEXT: ld r11, 8(r6)
481 ; CHECK-NEXT: addi r6, r6, 1
482 ; CHECK-NEXT: mulld r8, r9, r8
483 ; CHECK-NEXT: ld r12, 0(r4)
484 ; CHECK-NEXT: ldx r0, r4, r7
485 ; CHECK-NEXT: ld r30, 4(r4)
486 ; CHECK-NEXT: ld r9, 8(r4)
487 ; CHECK-NEXT: addi r4, r4, 1
488 ; CHECK-NEXT: mulld r8, r8, r10
489 ; CHECK-NEXT: mulld r8, r8, r11
490 ; CHECK-NEXT: mulld r8, r8, r12
491 ; CHECK-NEXT: mulld r8, r8, r0
492 ; CHECK-NEXT: mulld r8, r8, r30
493 ; CHECK-NEXT: maddld r3, r8, r9, r3
494 ; CHECK-NEXT: bdnz .LBB5_2
495 ; CHECK-NEXT: # %bb.3:
496 ; CHECK-NEXT: ld r30, -16(r1) # 8-byte Folded Reload
497 ; CHECK-NEXT: add r3, r3, r5
499 ; CHECK-NEXT: .LBB5_4:
500 ; CHECK-NEXT: addi r3, r5, 0
503 %i = sext i32 %arg2 to i64
504 %i3 = icmp eq i32 %arg2, 0
505 br i1 %i3, label %bb43, label %bb4
507 bb4: ; preds = %bb4, %bb
508 %i5 = phi i64 [ %i41, %bb4 ], [ 0, %bb ]
509 %i6 = phi i64 [ %i40, %bb4 ], [ 0, %bb ]
510 %i7 = getelementptr inbounds i8, ptr %arg, i64 %i5
511 %i8 = getelementptr inbounds i8, ptr %i7, i64 4001
512 %i10 = load i64, ptr %i8, align 8
513 %i11 = getelementptr inbounds i8, ptr %i7, i64 4010
514 %i13 = load i64, ptr %i11, align 8
515 %i14 = getelementptr inbounds i8, ptr %i7, i64 4005
516 %i16 = load i64, ptr %i14, align 8
517 %i17 = getelementptr inbounds i8, ptr %i7, i64 4009
518 %i19 = load i64, ptr %i17, align 8
519 %i20 = getelementptr inbounds i8, ptr %arg1, i64 %i5
520 %i21 = getelementptr inbounds i8, ptr %i20, i64 4001
521 %i23 = load i64, ptr %i21, align 8
522 %i24 = getelementptr inbounds i8, ptr %i20, i64 4010
523 %i26 = load i64, ptr %i24, align 8
524 %i27 = getelementptr inbounds i8, ptr %i20, i64 4005
525 %i29 = load i64, ptr %i27, align 8
526 %i30 = getelementptr inbounds i8, ptr %i20, i64 4009
527 %i32 = load i64, ptr %i30, align 8
528 %i33 = mul i64 %i13, %i10
529 %i34 = mul i64 %i33, %i16
530 %i35 = mul i64 %i34, %i19
531 %i36 = mul i64 %i35, %i23
532 %i37 = mul i64 %i36, %i26
533 %i38 = mul i64 %i37, %i29
534 %i39 = mul i64 %i38, %i32
535 %i40 = add i64 %i39, %i6
536 %i41 = add nuw i64 %i5, 1
537 %i42 = icmp ult i64 %i41, %i
538 br i1 %i42, label %bb4, label %bb43
540 bb43: ; preds = %bb4, %bb
541 %i44 = phi i64 [ 0, %bb ], [ %i40, %bb4 ]
542 %i45 = add i64 %i44, %i
546 ; test_ds_cross_basic_blocks:
548 ;unsigned long foo(char *p, int count)
550 ; unsigned long i=0, res=0;
557 ; unsigned long x1, x2, x3, x4, x5, x6;
558 ; x1=x2=x3=x4=x5=x6=1;
559 ; for (; i < count ; i++) {
560 ; if (arr[i] % 3 == 1) {
561 ; x1 += *(unsigned long *)(p + i + DISP1);
562 ; x2 += *(unsigned long *)(p + i + DISP2);
564 ; else if (arr[i] % 3 == 2) {
565 ; x3 += *(unsigned long *)(p + i + DISP3);
566 ; x4 += *(unsigned long *)(p + i + DISP5);
569 ; x5 += *(unsigned long *)(p + i + DISP4);
570 ; x6 += *(unsigned long *)(p + i + DISP6);
572 ; res += x1*x2*x3*x4*x5*x6;
577 @arr = external local_unnamed_addr global ptr, align 8
579 define i64 @test_ds_cross_basic_blocks(ptr %arg, i32 signext %arg1) {
580 ; CHECK-LABEL: test_ds_cross_basic_blocks:
581 ; CHECK: # %bb.0: # %bb
582 ; CHECK-NEXT: cmplwi r4, 0
583 ; CHECK-NEXT: beq cr0, .LBB6_9
584 ; CHECK-NEXT: # %bb.1: # %bb3
585 ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha
586 ; CHECK-NEXT: std r28, -32(r1) # 8-byte Folded Spill
587 ; CHECK-NEXT: std r29, -24(r1) # 8-byte Folded Spill
588 ; CHECK-NEXT: ld r5, .LC0@toc@l(r5)
589 ; CHECK-NEXT: std r30, -16(r1) # 8-byte Folded Spill
590 ; CHECK-NEXT: addi r6, r3, 4009
591 ; CHECK-NEXT: li r3, 0
592 ; CHECK-NEXT: li r7, -7
593 ; CHECK-NEXT: li r8, -6
594 ; CHECK-NEXT: li r9, 1
595 ; CHECK-NEXT: li r10, 1
596 ; CHECK-NEXT: li r11, 1
597 ; CHECK-NEXT: li r12, 1
598 ; CHECK-NEXT: li r0, 1
599 ; CHECK-NEXT: ld r5, 0(r5)
600 ; CHECK-NEXT: mtctr r4
601 ; CHECK-NEXT: li r4, 1
602 ; CHECK-NEXT: addi r5, r5, -1
603 ; CHECK-NEXT: b .LBB6_4
604 ; CHECK-NEXT: .p2align 4
605 ; CHECK-NEXT: .LBB6_2: # %bb18
607 ; CHECK-NEXT: addi r30, r6, -9
608 ; CHECK-NEXT: ld r30, 0(r30)
609 ; CHECK-NEXT: add r0, r30, r0
610 ; CHECK-NEXT: ld r30, -8(r6)
611 ; CHECK-NEXT: add r12, r30, r12
612 ; CHECK-NEXT: .LBB6_3: # %bb49
614 ; CHECK-NEXT: mulld r30, r12, r0
615 ; CHECK-NEXT: addi r6, r6, 1
616 ; CHECK-NEXT: mulld r30, r30, r11
617 ; CHECK-NEXT: mulld r30, r30, r10
618 ; CHECK-NEXT: mulld r30, r30, r9
619 ; CHECK-NEXT: maddld r3, r30, r4, r3
620 ; CHECK-NEXT: bdz .LBB6_8
621 ; CHECK-NEXT: .LBB6_4: # %bb5
623 ; CHECK-NEXT: lbzu r30, 1(r5)
624 ; CHECK-NEXT: mulli r29, r30, 171
625 ; CHECK-NEXT: rlwinm r28, r29, 24, 8, 30
626 ; CHECK-NEXT: srwi r29, r29, 9
627 ; CHECK-NEXT: add r29, r29, r28
628 ; CHECK-NEXT: sub r30, r30, r29
629 ; CHECK-NEXT: clrlwi r30, r30, 24
630 ; CHECK-NEXT: cmplwi r30, 1
631 ; CHECK-NEXT: beq cr0, .LBB6_2
632 ; CHECK-NEXT: # %bb.5: # %bb28
634 ; CHECK-NEXT: cmplwi r30, 2
635 ; CHECK-NEXT: bne cr0, .LBB6_7
636 ; CHECK-NEXT: # %bb.6: # %bb31
638 ; CHECK-NEXT: ldx r30, r6, r7
639 ; CHECK-NEXT: add r11, r30, r11
640 ; CHECK-NEXT: ld r30, -4(r6)
641 ; CHECK-NEXT: add r10, r30, r10
642 ; CHECK-NEXT: b .LBB6_3
643 ; CHECK-NEXT: .p2align 4
644 ; CHECK-NEXT: .LBB6_7: # %bb40
646 ; CHECK-NEXT: ldx r30, r6, r8
647 ; CHECK-NEXT: add r9, r30, r9
648 ; CHECK-NEXT: ld r30, 0(r6)
649 ; CHECK-NEXT: add r4, r30, r4
650 ; CHECK-NEXT: b .LBB6_3
651 ; CHECK-NEXT: .LBB6_8:
652 ; CHECK-NEXT: ld r30, -16(r1) # 8-byte Folded Reload
653 ; CHECK-NEXT: ld r29, -24(r1) # 8-byte Folded Reload
654 ; CHECK-NEXT: ld r28, -32(r1) # 8-byte Folded Reload
656 ; CHECK-NEXT: .LBB6_9:
657 ; CHECK-NEXT: li r3, 0
660 %i = sext i32 %arg1 to i64
661 %i2 = icmp eq i32 %arg1, 0
662 br i1 %i2, label %bb64, label %bb3
665 %i4 = load ptr, ptr @arr, align 8
668 bb5: ; preds = %bb49, %bb3
669 %i6 = phi i64 [ 1, %bb3 ], [ %i55, %bb49 ]
670 %i7 = phi i64 [ 1, %bb3 ], [ %i54, %bb49 ]
671 %i8 = phi i64 [ 1, %bb3 ], [ %i53, %bb49 ]
672 %i9 = phi i64 [ 1, %bb3 ], [ %i52, %bb49 ]
673 %i10 = phi i64 [ 1, %bb3 ], [ %i51, %bb49 ]
674 %i11 = phi i64 [ 1, %bb3 ], [ %i50, %bb49 ]
675 %i12 = phi i64 [ 0, %bb3 ], [ %i62, %bb49 ]
676 %i13 = phi i64 [ 0, %bb3 ], [ %i61, %bb49 ]
677 %i14 = getelementptr inbounds i8, ptr %i4, i64 %i12
678 %i15 = load i8, ptr %i14, align 1
679 %i16 = urem i8 %i15, 3
680 %i17 = icmp eq i8 %i16, 1
681 br i1 %i17, label %bb18, label %bb28
684 %i19 = getelementptr inbounds i8, ptr %arg, i64 %i12
685 %i20 = getelementptr inbounds i8, ptr %i19, i64 4000
686 %i22 = load i64, ptr %i20, align 8
687 %i23 = add i64 %i22, %i11
688 %i24 = getelementptr inbounds i8, ptr %i19, i64 4001
689 %i26 = load i64, ptr %i24, align 8
690 %i27 = add i64 %i26, %i10
694 %i29 = icmp eq i8 %i16, 2
695 %i30 = getelementptr inbounds i8, ptr %arg, i64 %i12
696 br i1 %i29, label %bb31, label %bb40
698 bb31: ; preds = %bb28
699 %i32 = getelementptr inbounds i8, ptr %i30, i64 4002
700 %i34 = load i64, ptr %i32, align 8
701 %i35 = add i64 %i34, %i9
702 %i36 = getelementptr inbounds i8, ptr %i30, i64 4005
703 %i38 = load i64, ptr %i36, align 8
704 %i39 = add i64 %i38, %i8
707 bb40: ; preds = %bb28
708 %i41 = getelementptr inbounds i8, ptr %i30, i64 4003
709 %i43 = load i64, ptr %i41, align 8
710 %i44 = add i64 %i43, %i7
711 %i45 = getelementptr inbounds i8, ptr %i30, i64 4009
712 %i47 = load i64, ptr %i45, align 8
713 %i48 = add i64 %i47, %i6
716 bb49: ; preds = %bb40, %bb31, %bb18
717 %i50 = phi i64 [ %i23, %bb18 ], [ %i11, %bb31 ], [ %i11, %bb40 ]
718 %i51 = phi i64 [ %i27, %bb18 ], [ %i10, %bb31 ], [ %i10, %bb40 ]
719 %i52 = phi i64 [ %i9, %bb18 ], [ %i35, %bb31 ], [ %i9, %bb40 ]
720 %i53 = phi i64 [ %i8, %bb18 ], [ %i39, %bb31 ], [ %i8, %bb40 ]
721 %i54 = phi i64 [ %i7, %bb18 ], [ %i7, %bb31 ], [ %i44, %bb40 ]
722 %i55 = phi i64 [ %i6, %bb18 ], [ %i6, %bb31 ], [ %i48, %bb40 ]
723 %i56 = mul i64 %i51, %i50
724 %i57 = mul i64 %i56, %i52
725 %i58 = mul i64 %i57, %i53
726 %i59 = mul i64 %i58, %i54
727 %i60 = mul i64 %i59, %i55
728 %i61 = add i64 %i60, %i13
729 %i62 = add nuw i64 %i12, 1
730 %i63 = icmp ult i64 %i62, %i
731 br i1 %i63, label %bb5, label %bb64
733 bb64: ; preds = %bb49, %bb
734 %i65 = phi i64 [ 0, %bb ], [ %i61, %bb49 ]
739 ;float test_ds_float(char *p, int count) {
746 ; for (; i < count ; i++) {
747 ; float x1 = *(float *)(p + i + DISP1);
748 ; float x2 = *(float *)(p + i + DISP2);
749 ; float x3 = *(float *)(p + i + DISP3);
750 ; float x4 = *(float *)(p + i + DISP4);
751 ; res += x1*x2*x3*x4;
756 define float @test_ds_float(ptr %arg, i32 signext %arg1) {
757 ; CHECK-LABEL: test_ds_float:
758 ; CHECK: # %bb.0: # %bb
759 ; CHECK-NEXT: cmpwi r4, 0
760 ; CHECK-NEXT: ble cr0, .LBB7_4
761 ; CHECK-NEXT: # %bb.1: # %bb2
762 ; CHECK-NEXT: clrldi r4, r4, 32
763 ; CHECK-NEXT: addi r3, r3, 4002
764 ; CHECK-NEXT: xxlxor f1, f1, f1
765 ; CHECK-NEXT: mtctr r4
766 ; CHECK-NEXT: li r4, -1
767 ; CHECK-NEXT: .p2align 4
768 ; CHECK-NEXT: .LBB7_2: # %bb4
770 ; CHECK-NEXT: lfsx f0, r3, r4
771 ; CHECK-NEXT: lfs f2, 0(r3)
772 ; CHECK-NEXT: xsmulsp f0, f0, f2
773 ; CHECK-NEXT: lfs f3, 20(r3)
774 ; CHECK-NEXT: xsmulsp f0, f0, f3
775 ; CHECK-NEXT: lfs f4, 60(r3)
776 ; CHECK-NEXT: addi r3, r3, 1
777 ; CHECK-NEXT: xsmulsp f0, f0, f4
778 ; CHECK-NEXT: xsaddsp f1, f1, f0
779 ; CHECK-NEXT: bdnz .LBB7_2
780 ; CHECK-NEXT: # %bb.3: # %bb26
782 ; CHECK-NEXT: .LBB7_4:
783 ; CHECK-NEXT: xxlxor f1, f1, f1
786 %i = icmp sgt i32 %arg1, 0
787 br i1 %i, label %bb2, label %bb26
790 %i3 = zext i32 %arg1 to i64
793 bb4: ; preds = %bb4, %bb2
794 %i5 = phi i64 [ 0, %bb2 ], [ %i24, %bb4 ]
795 %i6 = phi float [ 0.000000e+00, %bb2 ], [ %i23, %bb4 ]
796 %i7 = getelementptr inbounds i8, ptr %arg, i64 %i5
797 %i8 = getelementptr inbounds i8, ptr %i7, i64 4001
798 %i10 = load float, ptr %i8, align 4
799 %i11 = getelementptr inbounds i8, ptr %i7, i64 4002
800 %i13 = load float, ptr %i11, align 4
801 %i14 = getelementptr inbounds i8, ptr %i7, i64 4022
802 %i16 = load float, ptr %i14, align 4
803 %i17 = getelementptr inbounds i8, ptr %i7, i64 4062
804 %i19 = load float, ptr %i17, align 4
805 %i20 = fmul float %i10, %i13
806 %i21 = fmul float %i20, %i16
807 %i22 = fmul float %i21, %i19
808 %i23 = fadd float %i6, %i22
809 %i24 = add nuw nsw i64 %i5, 1
810 %i25 = icmp eq i64 %i24, %i3
811 br i1 %i25, label %bb26, label %bb4
813 bb26: ; preds = %bb4, %bb
814 %i27 = phi float [ 0.000000e+00, %bb ], [ %i23, %bb4 ]
818 ; test_ds_combine_float_int:
819 ;float test_ds_combine_float_int(char *p, int count) {
826 ; for (; i < count ; i++) {
827 ; float x1 = *(float *)(p + i + DISP1);
828 ; unsigned long x2 = *(unsigned long*)(p + i + DISP2);
829 ; float x3 = *(float *)(p + i + DISP3);
830 ; float x4 = *(float *)(p + i + DISP4);
831 ; res += x1*x2*x3*x4;
836 define float @test_ds_combine_float_int(ptr %arg, i32 signext %arg1) {
837 ; CHECK-LABEL: test_ds_combine_float_int:
838 ; CHECK: # %bb.0: # %bb
839 ; CHECK-NEXT: cmpwi r4, 0
840 ; CHECK-NEXT: ble cr0, .LBB8_4
841 ; CHECK-NEXT: # %bb.1: # %bb2
842 ; CHECK-NEXT: clrldi r4, r4, 32
843 ; CHECK-NEXT: addi r3, r3, 4002
844 ; CHECK-NEXT: xxlxor f1, f1, f1
845 ; CHECK-NEXT: mtctr r4
846 ; CHECK-NEXT: li r4, -1
847 ; CHECK-NEXT: .p2align 4
848 ; CHECK-NEXT: .LBB8_2: # %bb4
850 ; CHECK-NEXT: lfd f4, 0(r3)
851 ; CHECK-NEXT: lfsx f0, r3, r4
852 ; CHECK-NEXT: xscvuxdsp f4, f4
853 ; CHECK-NEXT: lfs f2, 20(r3)
854 ; CHECK-NEXT: lfs f3, 60(r3)
855 ; CHECK-NEXT: addi r3, r3, 1
856 ; CHECK-NEXT: xsmulsp f0, f0, f4
857 ; CHECK-NEXT: xsmulsp f0, f2, f0
858 ; CHECK-NEXT: xsmulsp f0, f3, f0
859 ; CHECK-NEXT: xsaddsp f1, f1, f0
860 ; CHECK-NEXT: bdnz .LBB8_2
861 ; CHECK-NEXT: # %bb.3: # %bb27
863 ; CHECK-NEXT: .LBB8_4:
864 ; CHECK-NEXT: xxlxor f1, f1, f1
867 %i = icmp sgt i32 %arg1, 0
868 br i1 %i, label %bb2, label %bb27
871 %i3 = zext i32 %arg1 to i64
874 bb4: ; preds = %bb4, %bb2
875 %i5 = phi i64 [ 0, %bb2 ], [ %i25, %bb4 ]
876 %i6 = phi float [ 0.000000e+00, %bb2 ], [ %i24, %bb4 ]
877 %i7 = getelementptr inbounds i8, ptr %arg, i64 %i5
878 %i8 = getelementptr inbounds i8, ptr %i7, i64 4001
879 %i10 = load float, ptr %i8, align 4
880 %i11 = getelementptr inbounds i8, ptr %i7, i64 4002
881 %i13 = load i64, ptr %i11, align 8
882 %i14 = getelementptr inbounds i8, ptr %i7, i64 4022
883 %i16 = load float, ptr %i14, align 4
884 %i17 = getelementptr inbounds i8, ptr %i7, i64 4062
885 %i19 = load float, ptr %i17, align 4
886 %i20 = uitofp i64 %i13 to float
887 %i21 = fmul float %i10, %i20
888 %i22 = fmul float %i16, %i21
889 %i23 = fmul float %i19, %i22
890 %i24 = fadd float %i6, %i23
891 %i25 = add nuw nsw i64 %i5, 1
892 %i26 = icmp eq i64 %i25, %i3
893 br i1 %i26, label %bb27, label %bb4
895 bb27: ; preds = %bb4, %bb
896 %i28 = phi float [ 0.000000e+00, %bb ], [ %i24, %bb4 ]
901 ; long long test_ds_lwa_prep(char *p, int count) {
902 ; long long i=0, res=0;
907 ; for (; i < count ; i++) {
908 ; long long x1 = *(int *)(p + i + DISP1);
909 ; long long x2 = *(int *)(p + i + DISP2);
910 ; long long x3 = *(int *)(p + i + DISP3);
911 ; long long x4 = *(int *)(p + i + DISP4);
912 ; res += x1*x2*x3*x4;
914 ; return res + count;
917 define i64 @test_ds_lwa_prep(ptr %arg, i32 signext %arg1) {
918 ; CHECK-LABEL: test_ds_lwa_prep:
919 ; CHECK: # %bb.0: # %bb
920 ; CHECK-NEXT: cmpwi r4, 0
921 ; CHECK-NEXT: ble cr0, .LBB9_4
922 ; CHECK-NEXT: # %bb.1: # %bb3.preheader
923 ; CHECK-NEXT: mtctr r4
924 ; CHECK-NEXT: addi r5, r3, 2
925 ; CHECK-NEXT: li r3, 0
926 ; CHECK-NEXT: li r6, -1
927 ; CHECK-NEXT: .p2align 4
928 ; CHECK-NEXT: .LBB9_2: # %bb3
930 ; CHECK-NEXT: lwax r7, r5, r6
931 ; CHECK-NEXT: lwa r8, 0(r5)
932 ; CHECK-NEXT: lwa r9, 4(r5)
933 ; CHECK-NEXT: lwa r10, 8(r5)
934 ; CHECK-NEXT: addi r5, r5, 1
935 ; CHECK-NEXT: mulld r7, r8, r7
936 ; CHECK-NEXT: mulld r7, r7, r9
937 ; CHECK-NEXT: maddld r3, r7, r10, r3
938 ; CHECK-NEXT: bdnz .LBB9_2
939 ; CHECK-NEXT: # %bb.3: # %bb29
940 ; CHECK-NEXT: add r3, r3, r4
942 ; CHECK-NEXT: .LBB9_4:
943 ; CHECK-NEXT: addi r3, r4, 0
946 %i = sext i32 %arg1 to i64
947 %i2 = icmp sgt i32 %arg1, 0
948 br i1 %i2, label %bb3, label %bb29
950 bb3: ; preds = %bb3, %bb
951 %i4 = phi i64 [ %i27, %bb3 ], [ 0, %bb ]
952 %i5 = phi i64 [ %i26, %bb3 ], [ 0, %bb ]
953 %i6 = getelementptr inbounds i8, ptr %arg, i64 %i4
954 %i7 = getelementptr inbounds i8, ptr %i6, i64 1
955 %i9 = load i32, ptr %i7, align 4
956 %i10 = sext i32 %i9 to i64
957 %i11 = getelementptr inbounds i8, ptr %i6, i64 2
958 %i13 = load i32, ptr %i11, align 4
959 %i14 = sext i32 %i13 to i64
960 %i15 = getelementptr inbounds i8, ptr %i6, i64 6
961 %i17 = load i32, ptr %i15, align 4
962 %i18 = sext i32 %i17 to i64
963 %i19 = getelementptr inbounds i8, ptr %i6, i64 10
964 %i21 = load i32, ptr %i19, align 4
965 %i22 = sext i32 %i21 to i64
966 %i23 = mul nsw i64 %i14, %i10
967 %i24 = mul nsw i64 %i23, %i18
968 %i25 = mul nsw i64 %i24, %i22
969 %i26 = add nsw i64 %i25, %i5
970 %i27 = add nuw nsw i64 %i4, 1
971 %i28 = icmp eq i64 %i27, %i
972 br i1 %i28, label %bb29, label %bb3
974 bb29: ; preds = %bb3, %bb
975 %i30 = phi i64 [ 0, %bb ], [ %i26, %bb3 ]
976 %i31 = add nsw i64 %i30, %i