1 ; RUN: llc -march=hexagon -hexagon-initial-cfg-cleanup=0 -pipeliner-experimental-cg=true < %s | FileCheck %s
3 ; Test epilogue generation when reading loop-carried dependency in stage 1 from
4 ; stage 0. Make sure the illegal phi the expender creates gets cleaned up
5 ; correctly during peeling
8 ; CHECK: [[REG0:r([0-9]+)]] = add(r{{[0-9]+}},#8)
9 ; CHECK: memw([[REG0]]+#0)
12 ; Function Attrs: nounwind
13 define ptr @f0(ptr nocapture readonly %a0, i32 %a1, i32 %a2, i32 %a3, ptr %b) #0 {
15 br i1 undef, label %b1, label %b3
20 b2: ; preds = %b2, %b1
21 %v1 = phi ptr [ %a0, %b1 ], [ %v2, %b2 ]
22 %v2 = phi ptr [ undef, %b1 ], [ %v15, %b2 ]
23 %v3 = phi ptr [ null, %b1 ], [ %v4, %b2 ]
24 %v4 = phi ptr [ null, %b1 ], [ %v14, %b2 ]
25 %v5 = phi i32 [ 0, %b1 ], [ %v13, %b2 ]
26 %v6 = phi ptr [ undef, %b1 ], [ %v12, %b2 ]
28 %add = getelementptr inbounds i16, ptr %b, i32 %a
29 %v7 = load i16, ptr %add, align 2
30 %v8 = sext i16 %v7 to i32
31 %v9 = call i32 @llvm.hexagon.M2.mpy.ll.s0(i32 %v8, i32 %v8) #2
32 %v92 = call i32 @llvm.hexagon.M2.mpy.ll.s0(i32 %v9, i32 %v9) #2
33 %v93 = call i32 @llvm.hexagon.M2.mpy.ll.s0(i32 %v92, i32 %v92) #2
34 %v11 = call i32 @llvm.hexagon.M2.mpy.acc.sat.ll.s0(i32 %v8, i32 undef, i32 undef) #2
35 store i32 %v11, ptr %v4, align 4
36 %v12 = getelementptr inbounds i16, ptr %v6, i32 -1
38 %v14 = getelementptr inbounds i32, ptr %v3, i32 2
39 store i32 %v93, ptr %v14, align 4
40 %v15 = getelementptr inbounds i16, ptr %v1, i32 2
41 %v16 = icmp slt i32 %v13, %a1
42 br i1 %v16, label %b2, label %b3
44 b3: ; preds = %b2, %b0
45 %out = phi ptr [ null, %b0 ], [ %v14, %b2 ]
49 ; Function Attrs: nounwind readnone
50 declare i32 @llvm.hexagon.M2.mpy.ll.s0(i32, i32) #1
52 ; Function Attrs: nounwind readnone
53 declare i32 @llvm.hexagon.M2.mpy.acc.sat.ll.s0(i32, i32, i32) #1
55 attributes #0 = { nounwind "target-cpu"="hexagonv60" }
56 attributes #1 = { nounwind readnone }
57 attributes #2 = { nounwind }