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(i32* noalias %PtrA, i32* noalias %PtrB, i32 signext %LenA, i32 signext %LenB) #0 {
6 ; CHECK: # %bb.0: # %entry
8 ; CHECK-NEXT: addi 7, 3, 4
9 ; 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
15 ; CHECK-NEXT: addi 6, 6, 1
16 ; CHECK-NEXT: extsw 8, 8
17 ; CHECK-NEXT: cmpw 6, 5
18 ; CHECK-NEXT: extsw 9, 9
19 ; CHECK-NEXT: crnot 20, 0
20 ; CHECK-NEXT: sldi 10, 8, 2
21 ; CHECK-NEXT: sldi 9, 9, 2
22 ; CHECK-NEXT: addi 8, 8, 1
23 ; CHECK-NEXT: add 10, 4, 10
24 ; CHECK-NEXT: bc 12, 20, .LBB0_5
25 ; CHECK-NEXT: .p2align 5
26 ; CHECK-NEXT: .LBB0_2: # %if.end
27 ; CHECK-NEXT: # Parent Loop BB0_1 Depth=1
28 ; CHECK-NEXT: # => This Inner Loop Header: Depth=2
29 ; CHECK-NEXT: lwz 11, 4(10)
30 ; CHECK-NEXT: cmplwi 11, 0
31 ; CHECK-NEXT: addi 11, 10, 4
32 ; CHECK-NEXT: beq 0, .LBB0_4
33 ; CHECK-NEXT: # %bb.3: # %if.then4
35 ; CHECK-NEXT: lwzx 12, 7, 9
36 ; CHECK-NEXT: addi 8, 8, 1
37 ; CHECK-NEXT: stw 12, 8(10)
38 ; CHECK-NEXT: mr 10, 11
39 ; CHECK-NEXT: bc 4, 20, .LBB0_2
40 ; CHECK-NEXT: b .LBB0_5
41 ; CHECK-NEXT: .p2align 4
42 ; CHECK-NEXT: .LBB0_4: # %if.end9
44 ; CHECK-NEXT: add 9, 3, 9
45 ; CHECK-NEXT: lwz 10, 4(9)
46 ; CHECK-NEXT: addi 10, 10, 1
47 ; CHECK-NEXT: stw 10, 4(9)
48 ; CHECK-NEXT: b .LBB0_1
49 ; CHECK-NEXT: .LBB0_5: # %if.then
50 ; CHECK-NEXT: lwax 3, 9, 3
55 block2: ; preds = %entry
58 block3: ; preds = %block8, %block2
59 %OuterInd.0 = phi i32 [ 0, %block2 ], [ %inc, %block8 ]
60 %InnerInd.0 = phi i32 [ 0, %block2 ], [ %inc1, %block8 ]
61 %inc = add nsw i32 %OuterInd.0, 1
64 block4: ; preds = %if.then4, %block3
65 %InnerInd.1 = phi i32 [ %InnerInd.0, %block3 ], [ %inc1, %if.then4 ]
66 %cmp = icmp sge i32 %inc, %LenA
67 br i1 %cmp, label %if.then, label %if.end
69 if.then: ; preds = %block4
70 %sub = sub nsw i32 %inc, 1
71 %idxprom = sext i32 %sub to i64
72 %arrayidx = getelementptr inbounds i32, i32* %PtrA, i64 %idxprom
73 %0 = load i32, i32* %arrayidx, align 4
76 if.end: ; preds = %block4
79 block5: ; preds = %if.end
80 %inc1 = add nsw i32 %InnerInd.1, 1
81 %idxprom2 = sext i32 %InnerInd.1 to i64
82 %arrayidx3 = getelementptr inbounds i32, i32* %PtrB, i64 %idxprom2
83 %1 = load i32, i32* %arrayidx3, align 4
84 %tobool = icmp ne i32 %1, 0
85 br i1 %tobool, label %if.then4, label %if.end9
87 if.then4: ; preds = %block5
88 %idxprom5 = sext i32 %inc to i64
89 %arrayidx6 = getelementptr inbounds i32, i32* %PtrA, i64 %idxprom5
90 %2 = load i32, i32* %arrayidx6, align 4
91 %idxprom7 = sext i32 %inc1 to i64
92 %arrayidx8 = getelementptr inbounds i32, i32* %PtrB, i64 %idxprom7
93 store i32 %2, i32* %arrayidx8, align 4
96 if.end9: ; preds = %block5
99 block6: ; preds = %if.end9
100 %idxprom10 = sext i32 %inc to i64
101 %arrayidx11 = getelementptr inbounds i32, i32* %PtrA, i64 %idxprom10
102 %3 = load i32, i32* %arrayidx11, align 4
103 %inc12 = add nsw i32 %3, 1
104 store i32 %inc12, i32* %arrayidx11, align 4
107 block8: ; preds = %block6