1 ; RUN: opt -mtriple=hexagon -passes=loop-vectorize -hexagon-autohvx -debug-only=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s
4 ; Check that TTI::getMinimumVF works. The calculated MaxVF was based on the
5 ; register pressure and was less than 64.
6 ; CHECK: LV: Overriding calculated MaxVF({{[0-9]+}}) with target's minimum: 64
8 target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
10 %s.0 = type { ptr, i32, i32, i32, i32 }
12 @g0 = external dso_local local_unnamed_addr global ptr, align 4
14 declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #0
15 declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #0
17 ; Function Attrs: nounwind
18 define hidden fastcc void @f0(ptr nocapture %a0, i32 %a1, i32 %a2, i32 %a3, i32 %a4, i8 zeroext %a5) unnamed_addr #1 {
20 %v0 = alloca [4 x [9 x i16]], align 8
21 call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %v0) #2
24 %v4 = icmp ugt i32 %v2, %v3
27 %v7 = icmp ugt i32 %v5, %v6
29 %v9 = load ptr, ptr @g0, align 4, !tbaa !1
30 %v10 = zext i8 %a5 to i32
31 %v11 = getelementptr inbounds ptr, ptr %v9, i32 %v10
32 %v12 = load ptr, ptr %v11, align 4, !tbaa !1
33 %v14 = load ptr, ptr %v12, align 4, !tbaa !5
34 br i1 %v8, label %b1, label %b2
36 b1: ; preds = %b1, %b0
37 %v15 = phi i32 [ 0, %b0 ], [ %v119, %b1 ]
38 %v16 = add i32 %v5, %v15
39 %v17 = icmp slt i32 %v16, 0
40 %v18 = icmp slt i32 %v16, %a4
41 %v19 = select i1 %v18, i32 %v16, i32 %v3
42 %v20 = select i1 %v17, i32 0, i32 %v19
43 %v21 = mul i32 %v20, %a3
44 %v22 = add i32 97, %v21
45 %v23 = getelementptr inbounds i8, ptr %v14, i32 %v22
46 %v24 = load i8, ptr %v23, align 1, !tbaa !8
47 %v25 = zext i8 %v24 to i32
48 %v26 = add i32 101, %v21
49 %v27 = getelementptr inbounds i8, ptr %v14, i32 %v26
50 %v28 = load i8, ptr %v27, align 1, !tbaa !8
51 %v29 = zext i8 %v28 to i32
52 %v30 = mul nsw i32 %v29, -5
53 %v31 = add nsw i32 %v30, %v25
54 %v32 = add i32 106, %v21
55 %v33 = getelementptr inbounds i8, ptr %v14, i32 %v32
56 %v34 = load i8, ptr %v33, align 1, !tbaa !8
57 %v35 = zext i8 %v34 to i32
58 %v36 = mul nuw nsw i32 %v35, 20
59 %v37 = add nsw i32 %v36, %v31
60 %v38 = add i32 111, %v21
61 %v39 = getelementptr inbounds i8, ptr %v14, i32 %v38
62 %v40 = load i8, ptr %v39, align 1, !tbaa !8
63 %v41 = zext i8 %v40 to i32
64 %v42 = mul nuw nsw i32 %v41, 20
65 %v43 = add nsw i32 %v42, %v37
66 %v44 = add i32 116, %v21
67 %v45 = getelementptr inbounds i8, ptr %v14, i32 %v44
68 %v46 = load i8, ptr %v45, align 1, !tbaa !8
69 %v47 = zext i8 %v46 to i32
70 %v48 = mul nsw i32 %v47, -5
71 %v49 = add nsw i32 %v48, %v43
72 %v50 = add i32 120, %v21
73 %v51 = getelementptr inbounds i8, ptr %v14, i32 %v50
74 %v52 = load i8, ptr %v51, align 1, !tbaa !8
75 %v53 = zext i8 %v52 to i32
76 %v54 = add nsw i32 %v49, %v53
77 %v55 = trunc i32 %v54 to i16
78 %v56 = getelementptr inbounds [4 x [9 x i16]], ptr %v0, i32 0, i32 0, i32 %v15
79 store i16 %v55, ptr %v56, align 2, !tbaa !9
80 %v57 = mul nsw i32 %v35, -5
81 %v58 = add nsw i32 %v57, %v29
82 %v59 = add nsw i32 %v42, %v58
83 %v60 = mul nuw nsw i32 %v47, 20
84 %v61 = add nsw i32 %v60, %v59
85 %v62 = mul nsw i32 %v53, -5
86 %v63 = add nsw i32 %v62, %v61
87 %v64 = add i32 125, %v21
88 %v65 = getelementptr inbounds i8, ptr %v14, i32 %v64
89 %v66 = load i8, ptr %v65, align 1, !tbaa !8
90 %v67 = zext i8 %v66 to i32
91 %v68 = add nsw i32 %v63, %v67
92 %v69 = trunc i32 %v68 to i16
93 %v70 = getelementptr inbounds [4 x [9 x i16]], ptr %v0, i32 0, i32 1, i32 %v15
94 store i16 %v69, ptr %v70, align 2, !tbaa !9
95 %v71 = mul nsw i32 %v41, -5
96 %v72 = add nsw i32 %v71, %v35
97 %v73 = add nsw i32 %v60, %v72
98 %v74 = mul nuw nsw i32 %v53, 20
99 %v75 = add nsw i32 %v74, %v73
100 %v76 = mul nsw i32 %v67, -5
101 %v77 = add nsw i32 %v76, %v75
102 %v78 = add i32 130, %v21
103 %v79 = getelementptr inbounds i8, ptr %v14, i32 %v78
104 %v80 = load i8, ptr %v79, align 1, !tbaa !8
105 %v81 = zext i8 %v80 to i32
106 %v82 = add nsw i32 %v77, %v81
107 %v83 = trunc i32 %v82 to i16
108 %v84 = getelementptr inbounds [4 x [9 x i16]], ptr %v0, i32 0, i32 2, i32 %v15
109 store i16 %v83, ptr %v84, align 2, !tbaa !9
110 %v85 = add i32 92, %v21
111 %v86 = getelementptr inbounds i8, ptr %v14, i32 %v85
112 %v87 = load i8, ptr %v86, align 1, !tbaa !8
113 %v88 = zext i8 %v87 to i16
114 %v89 = add i32 135, %v21
115 %v90 = getelementptr inbounds i8, ptr %v14, i32 %v89
116 %v91 = load i8, ptr %v90, align 1, !tbaa !8
117 %v92 = zext i8 %v91 to i16
118 %v93 = mul nsw i16 %v92, -5
119 %v94 = add nsw i16 %v93, %v88
120 %v95 = add i32 140, %v21
121 %v96 = getelementptr inbounds i8, ptr %v14, i32 %v95
122 %v97 = load i8, ptr %v96, align 1, !tbaa !8
123 %v98 = zext i8 %v97 to i16
124 %v99 = mul nuw nsw i16 %v98, 20
125 %v100 = add nsw i16 %v99, %v94
126 %v101 = add i32 145, %v21
127 %v102 = getelementptr inbounds i8, ptr %v14, i32 %v101
128 %v103 = load i8, ptr %v102, align 1, !tbaa !8
129 %v104 = zext i8 %v103 to i16
130 %v105 = mul nuw nsw i16 %v104, 20
131 %v106 = add i16 %v105, %v100
132 %v107 = add i32 150, %v21
133 %v108 = getelementptr inbounds i8, ptr %v14, i32 %v107
134 %v109 = load i8, ptr %v108, align 1, !tbaa !8
135 %v110 = zext i8 %v109 to i16
136 %v111 = mul nsw i16 %v110, -5
137 %v112 = add i16 %v111, %v106
138 %v113 = add i32 154, %v21
139 %v114 = getelementptr inbounds i8, ptr %v14, i32 %v113
140 %v115 = load i8, ptr %v114, align 1, !tbaa !8
141 %v116 = zext i8 %v115 to i16
142 %v117 = add i16 %v112, %v116
143 %v118 = getelementptr inbounds [4 x [9 x i16]], ptr %v0, i32 0, i32 3, i32 %v15
144 store i16 %v117, ptr %v118, align 2, !tbaa !9
145 %v119 = add nuw nsw i32 %v15, 1
146 %v120 = icmp eq i32 %v119, 19
147 br i1 %v120, label %b2, label %b1
149 b2: ; preds = %b1, %b0
150 call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %v0) #2
154 attributes #0 = { argmemonly nounwind }
155 attributes #1 = { nounwind "target-cpu"="hexagonv60" "target-features"="+hvx-length64b,+hvxv60" }
156 attributes #2 = { nounwind }
158 !llvm.module.flags = !{!0}
160 !0 = !{i32 1, !"wchar_size", i32 4}
161 !1 = !{!2, !2, i64 0}
162 !2 = !{!"any pointer", !3, i64 0}
163 !3 = !{!"omnipotent char", !4, i64 0}
164 !4 = !{!"Simple C/C++ TBAA"}
165 !5 = !{!6, !2, i64 0}
166 !6 = !{!"", !2, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16}
167 !7 = !{!"int", !3, i64 0}
168 !8 = !{!3, !3, i64 0}
169 !9 = !{!10, !10, i64 0}
170 !10 = !{!"short", !3, i64 0}