1 ; RUN: llc -march=hexagon -mcpu=hexagonv73 -O2 -mattr=+hvxv73,hvx-length64b \
2 ; RUN: -debug-only=hexagon-loop-align 2>&1 < %s | FileCheck %s
3 ; Validate that there are 4 bundles in the loop.
6 ; CHECK: Loop Align Pass:
7 ; CHECK: Bundle Count : 4
8 ; CHECK: .p2align{{.*}}5
10 ; Function Attrs: nounwind
11 define void @ham(ptr noalias nocapture readonly %arg, i32 %arg1, i32 %arg2, i32 %arg3, ptr noalias nocapture %arg4, i32 %arg5) #0 {
13 %ashr = ashr i32 %arg3, 2
14 %ashr6 = ashr i32 %arg3, 1
15 %add = add nsw i32 %ashr6, %ashr
16 %icmp = icmp sgt i32 %arg2, 0
17 br i1 %icmp, label %bb7, label %bb61
20 %sdiv = sdiv i32 %arg1, 64
21 %icmp8 = icmp sgt i32 %arg1, 63
24 bb9: ; preds = %bb57, %bb7
25 %phi = phi i32 [ 0, %bb7 ], [ %add58, %bb57 ]
26 %ashr10 = ashr exact i32 %phi, 1
27 %mul = mul nsw i32 %ashr10, %arg3
28 br i1 %icmp8, label %bb11, label %bb57
31 %add12 = add nsw i32 %phi, 1
32 %mul13 = mul nsw i32 %add12, %arg5
33 %mul14 = mul nsw i32 %phi, %arg5
34 %add15 = add i32 %add, %mul
35 %add16 = add i32 %mul, %ashr
36 %add17 = add i32 %mul, %ashr6
37 %getelementptr = getelementptr inbounds i8, ptr %arg4, i32 %mul13
38 %getelementptr18 = getelementptr inbounds i8, ptr %arg4, i32 %mul14
39 %getelementptr19 = getelementptr inbounds i16, ptr %arg, i32 %add15
40 %getelementptr20 = getelementptr inbounds i16, ptr %arg, i32 %add16
41 %getelementptr21 = getelementptr inbounds i16, ptr %arg, i32 %add17
42 %getelementptr22 = getelementptr inbounds i16, ptr %arg, i32 %mul
43 %bitcast = bitcast ptr %getelementptr to ptr
44 %bitcast23 = bitcast ptr %getelementptr18 to ptr
45 %bitcast24 = bitcast ptr %getelementptr19 to ptr
46 %bitcast25 = bitcast ptr %getelementptr20 to ptr
47 %bitcast26 = bitcast ptr %getelementptr21 to ptr
48 %bitcast27 = bitcast ptr %getelementptr22 to ptr
51 bb28: ; preds = %bb28, %bb11
52 %phi29 = phi i32 [ 0, %bb11 ], [ %add54, %bb28 ]
53 %phi30 = phi ptr [ %bitcast27, %bb11 ], [ %getelementptr36, %bb28 ]
54 %phi31 = phi ptr [ %bitcast26, %bb11 ], [ %getelementptr37, %bb28 ]
55 %phi32 = phi ptr [ %bitcast25, %bb11 ], [ %getelementptr39, %bb28 ]
56 %phi33 = phi ptr [ %bitcast24, %bb11 ], [ %getelementptr41, %bb28 ]
57 %phi34 = phi ptr [ %bitcast, %bb11 ], [ %getelementptr53, %bb28 ]
58 %phi35 = phi ptr [ %bitcast23, %bb11 ], [ %getelementptr52, %bb28 ]
59 %getelementptr36 = getelementptr inbounds <16 x i32>, ptr %phi30, i32 1
60 %load = load <16 x i32>, ptr %phi30, align 64
61 %getelementptr37 = getelementptr inbounds <16 x i32>, ptr %phi31, i32 1
62 %load38 = load <16 x i32>, ptr %phi31, align 64
63 %getelementptr39 = getelementptr inbounds <16 x i32>, ptr %phi32, i32 1
64 %load40 = load <16 x i32>, ptr %phi32, align 64
65 %getelementptr41 = getelementptr inbounds <16 x i32>, ptr %phi33, i32 1
66 %load42 = load <16 x i32>, ptr %phi33, align 64
67 %call = tail call <16 x i32> @llvm.hexagon.V6.vaddh(<16 x i32> %load, <16 x i32> %load38)
68 %call43 = tail call <16 x i32> @llvm.hexagon.V6.vsubh(<16 x i32> %load, <16 x i32> %load38)
69 %call44 = tail call <16 x i32> @llvm.hexagon.V6.vaddh(<16 x i32> %load40, <16 x i32> %load42)
70 %call45 = tail call <16 x i32> @llvm.hexagon.V6.vsubh(<16 x i32> %load40, <16 x i32> %load42)
71 %call46 = tail call <16 x i32> @llvm.hexagon.V6.vavgh(<16 x i32> %call, <16 x i32> %call44)
72 %call47 = tail call <16 x i32> @llvm.hexagon.V6.vnavgh(<16 x i32> %call, <16 x i32> %call44)
73 %call48 = tail call <16 x i32> @llvm.hexagon.V6.vavgh(<16 x i32> %call43, <16 x i32> %call45)
74 %call49 = tail call <16 x i32> @llvm.hexagon.V6.vnavgh(<16 x i32> %call43, <16 x i32> %call45)
75 %call50 = tail call <16 x i32> @llvm.hexagon.V6.vsathub(<16 x i32> %call47, <16 x i32> %call46)
76 %call51 = tail call <16 x i32> @llvm.hexagon.V6.vsathub(<16 x i32> %call49, <16 x i32> %call48)
77 %getelementptr52 = getelementptr inbounds <16 x i32>, ptr %phi35, i32 1
78 store <16 x i32> %call50, ptr %phi35, align 64
79 %getelementptr53 = getelementptr inbounds <16 x i32>, ptr %phi34, i32 1
80 store <16 x i32> %call51, ptr %phi34, align 64
81 %add54 = add nsw i32 %phi29, 1
82 %icmp55 = icmp slt i32 %add54, %sdiv
83 br i1 %icmp55, label %bb28, label %bb56
88 bb57: ; preds = %bb56, %bb9
89 %add58 = add nsw i32 %phi, 2
90 %icmp59 = icmp slt i32 %add58, %arg2
91 br i1 %icmp59, label %bb9, label %bb60
96 bb61: ; preds = %bb60, %bb
100 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
101 declare <16 x i32> @llvm.hexagon.V6.vaddh(<16 x i32>, <16 x i32>) #1
103 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
104 declare <16 x i32> @llvm.hexagon.V6.vsubh(<16 x i32>, <16 x i32>) #1
106 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
107 declare <16 x i32> @llvm.hexagon.V6.vavgh(<16 x i32>, <16 x i32>) #1
109 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
110 declare <16 x i32> @llvm.hexagon.V6.vnavgh(<16 x i32>, <16 x i32>) #1
112 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
113 declare <16 x i32> @llvm.hexagon.V6.vsathub(<16 x i32>, <16 x i32>) #1
115 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
116 attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }