1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s
4 define signext i32 @test(ptr noalias %PtrA, ptr noalias %PtrB, i32 signext %LenA, i32 signext %LenB) #0 {
6 ; CHECK: # %bb.0: # %entry
7 ; CHECK-NEXT: addi 6, 3, 4
8 ; CHECK-NEXT: addi 4, 4, -4
11 ; CHECK-NEXT: .LBB0_1: # %block3
12 ; CHECK-NEXT: # =>This Loop Header: Depth=1
13 ; CHECK-NEXT: # Child Loop BB0_2 Depth 2
14 ; CHECK-NEXT: extsw 9, 8
15 ; CHECK-NEXT: addi 8, 8, 1
16 ; CHECK-NEXT: extsw 7, 7
17 ; CHECK-NEXT: cmpw 8, 5
18 ; CHECK-NEXT: sldi 10, 7, 2
19 ; CHECK-NEXT: sldi 9, 9, 2
20 ; CHECK-NEXT: addi 7, 7, 1
21 ; CHECK-NEXT: add 10, 4, 10
22 ; CHECK-NEXT: crnot 20, 0
23 ; CHECK-NEXT: bc 12, 20, .LBB0_5
24 ; CHECK-NEXT: .p2align 5
25 ; CHECK-NEXT: .LBB0_2: # %if.end
26 ; CHECK-NEXT: # Parent Loop BB0_1 Depth=1
27 ; CHECK-NEXT: # => This Inner Loop Header: Depth=2
28 ; CHECK-NEXT: lwz 12, 4(10)
29 ; CHECK-NEXT: addi 11, 10, 4
30 ; CHECK-NEXT: cmplwi 12, 0
31 ; CHECK-NEXT: beq 0, .LBB0_4
32 ; CHECK-NEXT: # %bb.3: # %if.then4
34 ; CHECK-NEXT: lwzx 12, 6, 9
35 ; CHECK-NEXT: addi 7, 7, 1
36 ; CHECK-NEXT: stw 12, 8(10)
37 ; CHECK-NEXT: mr 10, 11
38 ; CHECK-NEXT: bc 4, 20, .LBB0_2
39 ; CHECK-NEXT: b .LBB0_5
40 ; CHECK-NEXT: .p2align 4
41 ; CHECK-NEXT: .LBB0_4: # %if.end9
43 ; CHECK-NEXT: lwzx 10, 6, 9
44 ; CHECK-NEXT: addi 10, 10, 1
45 ; CHECK-NEXT: stwx 10, 6, 9
46 ; CHECK-NEXT: b .LBB0_1
47 ; CHECK-NEXT: .LBB0_5: # %if.then
48 ; CHECK-NEXT: lwax 3, 9, 3
53 block2: ; preds = %entry
56 block3: ; preds = %block8, %block2
57 %OuterInd.0 = phi i32 [ 0, %block2 ], [ %inc, %block8 ]
58 %InnerInd.0 = phi i32 [ 0, %block2 ], [ %inc1, %block8 ]
59 %inc = add nsw i32 %OuterInd.0, 1
62 block4: ; preds = %if.then4, %block3
63 %InnerInd.1 = phi i32 [ %InnerInd.0, %block3 ], [ %inc1, %if.then4 ]
64 %cmp = icmp sge i32 %inc, %LenA
65 br i1 %cmp, label %if.then, label %if.end
67 if.then: ; preds = %block4
68 %sub = sub nsw i32 %inc, 1
69 %idxprom = sext i32 %sub to i64
70 %arrayidx = getelementptr inbounds i32, ptr %PtrA, i64 %idxprom
71 %0 = load i32, ptr %arrayidx, align 4
74 if.end: ; preds = %block4
77 block5: ; preds = %if.end
78 %inc1 = add nsw i32 %InnerInd.1, 1
79 %idxprom2 = sext i32 %InnerInd.1 to i64
80 %arrayidx3 = getelementptr inbounds i32, ptr %PtrB, i64 %idxprom2
81 %1 = load i32, ptr %arrayidx3, align 4
82 %tobool = icmp ne i32 %1, 0
83 br i1 %tobool, label %if.then4, label %if.end9
85 if.then4: ; preds = %block5
86 %idxprom5 = sext i32 %inc to i64
87 %arrayidx6 = getelementptr inbounds i32, ptr %PtrA, i64 %idxprom5
88 %2 = load i32, ptr %arrayidx6, align 4
89 %idxprom7 = sext i32 %inc1 to i64
90 %arrayidx8 = getelementptr inbounds i32, ptr %PtrB, i64 %idxprom7
91 store i32 %2, ptr %arrayidx8, align 4
94 if.end9: ; preds = %block5
97 block6: ; preds = %if.end9
98 %idxprom10 = sext i32 %inc to i64
99 %arrayidx11 = getelementptr inbounds i32, ptr %PtrA, i64 %idxprom10
100 %3 = load i32, ptr %arrayidx11, align 4
101 %inc12 = add nsw i32 %3, 1
102 store i32 %inc12, ptr %arrayidx11, align 4
105 block8: ; preds = %block6