1 ; RUN: llc -march=hexagon -mcpu=hexagonv5 -enable-pipeliner -pipeliner-max-stages=2 -disable-block-placement=0 -hexagon-bit=0 < %s -pipeliner-experimental-cg=true | FileCheck %s
3 ; Test that we rename registers correctly for multiple stages when there is a
4 ; Phi and depends upon another Phi.
8 ; CHECK: r[[REGA:[0-9]+]] = memub(r{{[0-9]+}}+#1)
10 ; CHECK: r[[REG0:[0-9]+]] = and(r[[REG1:[0-9]+]],#255)
11 ; CHECK-NOT: r[[REG0]] = and(r[[REG1]],#255)
12 ; CHECK: loop0(.LBB0_[[LOOP:.]],
13 ; CHECK: .LBB0_[[LOOP]]:
14 ; CHECK: = add(r{{[0-9]+}},r[[REG0]])
16 ; CHECK: r[[REG0]] = and
19 ; Function Attrs: nounwind
20 define void @test(ptr noalias nocapture %src, i32 %srcWidth, i32 %srcHeight, i32 %srcStride, ptr noalias nocapture %dst, i32 %dstStride) #0 {
22 %sub = add i32 %srcWidth, -1
23 %sub1 = add i32 %srcHeight, -1
24 %add.ptr = getelementptr inbounds i8, ptr %src, i32 %srcStride
25 %add.ptr.sum = mul i32 %srcStride, 2
26 %add.ptr2 = getelementptr inbounds i8, ptr %src, i32 %add.ptr.sum
27 br label %for.body.lr.ph
30 %0 = add i32 %srcHeight, -2
31 %1 = mul i32 %0, %dstStride
32 %2 = mul i32 %0, %srcStride
33 %3 = mul i32 %sub1, %srcStride
37 %scevgep = getelementptr i8, ptr %dst, i32 %1
38 %scevgep220 = getelementptr i8, ptr %src, i32 %2
39 %scevgep221 = getelementptr i8, ptr %src, i32 %3
40 %arrayidx6 = getelementptr inbounds i8, ptr %src, i32 1
41 %add11 = add i32 %srcStride, 1
42 %arrayidx12 = getelementptr inbounds i8, ptr %src, i32 %add11
43 br label %for.body75.preheader
46 %sri = load i8, ptr %arrayidx6, align 1
47 %sri224 = load i8, ptr %src, align 1
48 %sri227 = load i8, ptr %arrayidx12, align 1
49 %sri229 = load i8, ptr %add.ptr, align 1
53 %j.0211 = phi i32 [ %add82, %for.body75 ], [ 1, %for.body75.preheader ]
54 %sr = phi i8 [ %4, %for.body75 ], [ %sri, %for.body75.preheader ]
55 %sr225 = phi i8 [ %sr, %for.body75 ], [ %sri224, %for.body75.preheader ]
56 %sr230 = phi i8 [ %5, %for.body75 ], [ %sri227, %for.body75.preheader ]
57 %sr231 = phi i8 [ %sr230, %for.body75 ], [ %sri229, %for.body75.preheader ]
58 %conv78 = zext i8 %sr225 to i32
59 %conv80 = zext i8 %sr to i32
60 %add81 = add nsw i32 %conv80, %conv78
61 %add82 = add i32 %j.0211, 1
62 %arrayidx83 = getelementptr inbounds i8, ptr %src, i32 %add82
63 %4 = load i8, ptr %arrayidx83, align 1, !tbaa !0
64 %conv84 = zext i8 %4 to i32
65 %add85 = add nsw i32 %add81, %conv84
66 %conv88 = zext i8 %sr231 to i32
67 %add89 = add nsw i32 %add85, %conv88
68 %conv91 = zext i8 %sr230 to i32
69 %add92 = add nsw i32 %add89, %conv91
70 %add.ptr.sum208 = add i32 %add82, %srcStride
71 %arrayidx94 = getelementptr inbounds i8, ptr %src, i32 %add.ptr.sum208
72 %5 = load i8, ptr %arrayidx94, align 1, !tbaa !0
73 %conv95 = zext i8 %5 to i32
74 %add96 = add nsw i32 %add92, %conv95
75 %mul97 = mul nsw i32 %add96, 7282
76 %add98 = add nsw i32 %mul97, 32768
77 %shr99209 = lshr i32 %add98, 16
78 %conv100 = trunc i32 %shr99209 to i8
79 %arrayidx101 = getelementptr inbounds i8, ptr %dst, i32 %j.0211
80 store i8 %conv100, ptr %arrayidx101, align 1, !tbaa !0
81 %exitcond = icmp eq i32 %add82, %sub
82 br i1 %exitcond, label %for.end104.loopexit, label %for.body75
91 attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
93 !0 = !{!"omnipotent char", !1}
94 !1 = !{!"Simple C/C++ TBAA"}