1; RUN: llc -mcpu=a2 -disable-lsr < %s | FileCheck %s
2target 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"
3target triple = "powerpc64-unknown-linux-gnu"
4
5define i32 @test1(i64 %add, i64* %ptr) nounwind {
6entry:
7  %p1 = getelementptr i64, i64* %ptr, i64 144115188075855
8  br label %for.cond2.preheader
9
10for.cond2.preheader:
11  %nl.018 = phi i32 [ 0, %entry ], [ %inc9, %for.end ]
12  br label %for.body4
13
14for.body4:
15  %lsr.iv = phi i32 [ %lsr.iv.next, %for.body4 ], [ 16000, %for.cond2.preheader ]
16  %i0 = phi i64* [ %p1, %for.cond2.preheader ], [ %i6, %for.body4 ]
17  %i6 = getelementptr i64, i64* %i0, i64 400000
18  %i7 = getelementptr i64, i64* %i6, i64 300000
19  %i8 = getelementptr i64, i64* %i6, i64 200000
20  %i9 = getelementptr i64, i64* %i6, i64 100000
21  store i64 %add, i64* %i6, align 32
22  store i64 %add, i64* %i7, align 32
23  store i64 %add, i64* %i8, align 32
24  store i64 %add, i64* %i9, align 32
25  %lsr.iv.next = add i32 %lsr.iv, -16
26  %exitcond.15 = icmp eq i32 %lsr.iv.next, 0
27  br i1 %exitcond.15, label %for.end, label %for.body4
28
29; Make sure that we generate the most compact form of this loop with no
30; unnecessary moves
31; CHECK: @test1
32; CHECK: mtctr
33; CHECK: stdux
34; CHECK-NEXT: stdx
35; CHECK-NEXT: stdx
36; CHECK-NEXT: stdx
37; CHECK-NEXT: bdnz
38
39for.end:
40  %inc9 = add nsw i32 %nl.018, 1
41  %exitcond = icmp eq i32 %inc9, 400000
42  br i1 %exitcond, label %for.end10, label %for.cond2.preheader
43
44for.end10:
45  ret i32 0
46}
47
48