1 ; RUN: llc -march=hexagon -O2 -pipeliner-max-mii=10 < %s -verify-machineinstrs | FileCheck %s
4 ; Function Attrs: nounwind
5 define void @f0(ptr nocapture readonly %a0, i32 %a1, i32 %a2, i32 %a3, ptr nocapture %a4, ptr nocapture %a5) #0 {
7 %v0 = tail call i32 @llvm.hexagon.S2.vsplatrb(i32 %a3)
8 %v1 = tail call <16 x i32> @llvm.hexagon.V6.lvsplatw(i32 %v0)
9 %v2 = tail call <16 x i32> @llvm.hexagon.V6.lvsplatw(i32 16843009)
10 %v3 = tail call <16 x i32> @llvm.hexagon.V6.vd0()
11 %v4 = sdiv i32 %a2, 64
12 %v5 = icmp sgt i32 %a2, 63
13 br i1 %v5, label %b1, label %b6
16 %v8 = tail call <32 x i32> @llvm.hexagon.V6.vcombine(<16 x i32> %v3, <16 x i32> %v3)
19 b2: ; preds = %b4, %b1
20 %v9 = phi i32 [ 0, %b1 ], [ %v100, %b4 ]
21 %v10 = phi ptr [ %a0, %b1 ], [ %v87, %b4 ]
22 %v11 = phi ptr [ %a5, %b1 ], [ %v99, %b4 ]
23 %v12 = phi ptr [ %a4, %b1 ], [ %v95, %b4 ]
24 %v14 = load <16 x i32>, ptr %v10, align 64, !tbaa !0
27 b3: ; preds = %b3, %b2
28 %v15 = phi i32 [ -4, %b2 ], [ %v83, %b3 ]
29 %v16 = phi <32 x i32> [ %v8, %b2 ], [ %v78, %b3 ]
30 %v17 = phi <16 x i32> [ %v3, %b2 ], [ %v82, %b3 ]
31 %v18 = mul nsw i32 %v15, %a1
32 %v19 = getelementptr inbounds i8, ptr %v10, i32 %v18
33 %v21 = add i32 %v18, -64
34 %v22 = getelementptr inbounds i8, ptr %v10, i32 %v21
35 %v24 = load <16 x i32>, ptr %v22, align 64, !tbaa !0
36 %v25 = load <16 x i32>, ptr %v19, align 64, !tbaa !0
37 %v26 = add i32 %v18, 64
38 %v27 = getelementptr inbounds i8, ptr %v10, i32 %v26
39 %v29 = load <16 x i32>, ptr %v27, align 64, !tbaa !0
40 %v30 = tail call <16 x i32> @llvm.hexagon.V6.vabsdiffub(<16 x i32> %v25, <16 x i32> %v14)
41 %v31 = tail call <64 x i1> @llvm.hexagon.V6.vgtub(<16 x i32> %v30, <16 x i32> %v1)
42 %v32 = tail call <16 x i32> @llvm.hexagon.V6.vmux(<64 x i1> %v31, <16 x i32> %v3, <16 x i32> %v25)
43 %v33 = tail call <32 x i32> @llvm.hexagon.V6.vmpybus.acc(<32 x i32> %v16, <16 x i32> %v32, i32 16843009)
44 %v34 = tail call <16 x i32> @llvm.hexagon.V6.vaddbnq(<64 x i1> %v31, <16 x i32> %v17, <16 x i32> %v2)
45 %v35 = tail call <16 x i32> @llvm.hexagon.V6.vlalignbi(<16 x i32> %v25, <16 x i32> %v24, i32 1)
46 %v36 = tail call <16 x i32> @llvm.hexagon.V6.valignbi(<16 x i32> %v29, <16 x i32> %v25, i32 1)
47 %v37 = tail call <16 x i32> @llvm.hexagon.V6.vlalignbi(<16 x i32> %v25, <16 x i32> %v24, i32 2)
48 %v38 = tail call <16 x i32> @llvm.hexagon.V6.valignbi(<16 x i32> %v29, <16 x i32> %v25, i32 2)
49 %v39 = tail call <16 x i32> @llvm.hexagon.V6.vabsdiffub(<16 x i32> %v35, <16 x i32> %v14)
50 %v40 = tail call <16 x i32> @llvm.hexagon.V6.vabsdiffub(<16 x i32> %v36, <16 x i32> %v14)
51 %v41 = tail call <16 x i32> @llvm.hexagon.V6.vabsdiffub(<16 x i32> %v37, <16 x i32> %v14)
52 %v42 = tail call <16 x i32> @llvm.hexagon.V6.vabsdiffub(<16 x i32> %v38, <16 x i32> %v14)
53 %v43 = tail call <64 x i1> @llvm.hexagon.V6.vgtub(<16 x i32> %v39, <16 x i32> %v1)
54 %v44 = tail call <64 x i1> @llvm.hexagon.V6.vgtub(<16 x i32> %v40, <16 x i32> %v1)
55 %v45 = tail call <64 x i1> @llvm.hexagon.V6.vgtub(<16 x i32> %v41, <16 x i32> %v1)
56 %v46 = tail call <64 x i1> @llvm.hexagon.V6.vgtub(<16 x i32> %v42, <16 x i32> %v1)
57 %v47 = tail call <16 x i32> @llvm.hexagon.V6.vmux(<64 x i1> %v43, <16 x i32> %v3, <16 x i32> %v35)
58 %v48 = tail call <16 x i32> @llvm.hexagon.V6.vmux(<64 x i1> %v44, <16 x i32> %v3, <16 x i32> %v36)
59 %v49 = tail call <16 x i32> @llvm.hexagon.V6.vmux(<64 x i1> %v45, <16 x i32> %v3, <16 x i32> %v37)
60 %v50 = tail call <16 x i32> @llvm.hexagon.V6.vmux(<64 x i1> %v46, <16 x i32> %v3, <16 x i32> %v38)
61 %v51 = tail call <32 x i32> @llvm.hexagon.V6.vcombine(<16 x i32> %v48, <16 x i32> %v47)
62 %v52 = tail call <32 x i32> @llvm.hexagon.V6.vmpabus.acc(<32 x i32> %v33, <32 x i32> %v51, i32 16843009)
63 %v53 = tail call <32 x i32> @llvm.hexagon.V6.vcombine(<16 x i32> %v50, <16 x i32> %v49)
64 %v54 = tail call <32 x i32> @llvm.hexagon.V6.vmpabus.acc(<32 x i32> %v52, <32 x i32> %v53, i32 16843009)
65 %v55 = tail call <16 x i32> @llvm.hexagon.V6.vaddbnq(<64 x i1> %v43, <16 x i32> %v34, <16 x i32> %v2)
66 %v56 = tail call <16 x i32> @llvm.hexagon.V6.vaddbnq(<64 x i1> %v44, <16 x i32> %v55, <16 x i32> %v2)
67 %v57 = tail call <16 x i32> @llvm.hexagon.V6.vaddbnq(<64 x i1> %v45, <16 x i32> %v56, <16 x i32> %v2)
68 %v58 = tail call <16 x i32> @llvm.hexagon.V6.vaddbnq(<64 x i1> %v46, <16 x i32> %v57, <16 x i32> %v2)
69 %v59 = tail call <16 x i32> @llvm.hexagon.V6.vlalignbi(<16 x i32> %v25, <16 x i32> %v24, i32 3)
70 %v60 = tail call <16 x i32> @llvm.hexagon.V6.valignbi(<16 x i32> %v29, <16 x i32> %v25, i32 3)
71 %v61 = tail call <16 x i32> @llvm.hexagon.V6.vlalignbi(<16 x i32> %v25, <16 x i32> %v24, i32 4)
72 %v62 = tail call <16 x i32> @llvm.hexagon.V6.valignbi(<16 x i32> %v29, <16 x i32> %v25, i32 4)
73 %v63 = tail call <16 x i32> @llvm.hexagon.V6.vabsdiffub(<16 x i32> %v59, <16 x i32> %v14)
74 %v64 = tail call <16 x i32> @llvm.hexagon.V6.vabsdiffub(<16 x i32> %v60, <16 x i32> %v14)
75 %v65 = tail call <16 x i32> @llvm.hexagon.V6.vabsdiffub(<16 x i32> %v61, <16 x i32> %v14)
76 %v66 = tail call <16 x i32> @llvm.hexagon.V6.vabsdiffub(<16 x i32> %v62, <16 x i32> %v14)
77 %v67 = tail call <64 x i1> @llvm.hexagon.V6.vgtub(<16 x i32> %v63, <16 x i32> %v1)
78 %v68 = tail call <64 x i1> @llvm.hexagon.V6.vgtub(<16 x i32> %v64, <16 x i32> %v1)
79 %v69 = tail call <64 x i1> @llvm.hexagon.V6.vgtub(<16 x i32> %v65, <16 x i32> %v1)
80 %v70 = tail call <64 x i1> @llvm.hexagon.V6.vgtub(<16 x i32> %v66, <16 x i32> %v1)
81 %v71 = tail call <16 x i32> @llvm.hexagon.V6.vmux(<64 x i1> %v67, <16 x i32> %v3, <16 x i32> %v59)
82 %v72 = tail call <16 x i32> @llvm.hexagon.V6.vmux(<64 x i1> %v68, <16 x i32> %v3, <16 x i32> %v60)
83 %v73 = tail call <16 x i32> @llvm.hexagon.V6.vmux(<64 x i1> %v69, <16 x i32> %v3, <16 x i32> %v61)
84 %v74 = tail call <16 x i32> @llvm.hexagon.V6.vmux(<64 x i1> %v70, <16 x i32> %v3, <16 x i32> %v62)
85 %v75 = tail call <32 x i32> @llvm.hexagon.V6.vcombine(<16 x i32> %v72, <16 x i32> %v71)
86 %v76 = tail call <32 x i32> @llvm.hexagon.V6.vmpabus.acc(<32 x i32> %v54, <32 x i32> %v75, i32 16843009)
87 %v77 = tail call <32 x i32> @llvm.hexagon.V6.vcombine(<16 x i32> %v74, <16 x i32> %v73)
88 %v78 = tail call <32 x i32> @llvm.hexagon.V6.vmpabus.acc(<32 x i32> %v76, <32 x i32> %v77, i32 16843009)
89 %v79 = tail call <16 x i32> @llvm.hexagon.V6.vaddbnq(<64 x i1> %v67, <16 x i32> %v58, <16 x i32> %v2)
90 %v80 = tail call <16 x i32> @llvm.hexagon.V6.vaddbnq(<64 x i1> %v68, <16 x i32> %v79, <16 x i32> %v2)
91 %v81 = tail call <16 x i32> @llvm.hexagon.V6.vaddbnq(<64 x i1> %v69, <16 x i32> %v80, <16 x i32> %v2)
92 %v82 = tail call <16 x i32> @llvm.hexagon.V6.vaddbnq(<64 x i1> %v70, <16 x i32> %v81, <16 x i32> %v2)
93 %v83 = add nsw i32 %v15, 1
94 %v84 = icmp eq i32 %v83, 5
95 br i1 %v84, label %b4, label %b3
98 %v85 = phi <16 x i32> [ %v82, %b3 ]
99 %v86 = phi <32 x i32> [ %v78, %b3 ]
100 %v87 = getelementptr inbounds i8, ptr %v10, i32 64
101 %v88 = tail call <16 x i32> @llvm.hexagon.V6.hi(<32 x i32> %v86)
102 %v89 = tail call <16 x i32> @llvm.hexagon.V6.lo(<32 x i32> %v86)
103 %v90 = tail call <32 x i32> @llvm.hexagon.V6.vshuffvdd(<16 x i32> %v88, <16 x i32> %v89, i32 -2)
104 %v91 = tail call <32 x i32> @llvm.hexagon.V6.vunpackub(<16 x i32> %v85)
105 %v92 = tail call <16 x i32> @llvm.hexagon.V6.lo(<32 x i32> %v90)
106 %v93 = getelementptr inbounds <16 x i32>, ptr %v12, i32 1
107 store <16 x i32> %v92, ptr %v12, align 64, !tbaa !0
108 %v94 = tail call <16 x i32> @llvm.hexagon.V6.hi(<32 x i32> %v90)
109 %v95 = getelementptr inbounds <16 x i32>, ptr %v12, i32 2
110 store <16 x i32> %v94, ptr %v93, align 64, !tbaa !0
111 %v96 = tail call <16 x i32> @llvm.hexagon.V6.lo(<32 x i32> %v91)
112 %v97 = getelementptr inbounds <16 x i32>, ptr %v11, i32 1
113 store <16 x i32> %v96, ptr %v11, align 64, !tbaa !0
114 %v98 = tail call <16 x i32> @llvm.hexagon.V6.hi(<32 x i32> %v91)
115 %v99 = getelementptr inbounds <16 x i32>, ptr %v11, i32 2
116 store <16 x i32> %v98, ptr %v97, align 64, !tbaa !0
117 %v100 = add nsw i32 %v9, 1
118 %v101 = icmp slt i32 %v100, %v4
119 br i1 %v101, label %b2, label %b5
124 b6: ; preds = %b5, %b0
128 ; Function Attrs: nounwind readnone
129 declare <16 x i32> @llvm.hexagon.V6.lvsplatw(i32) #1
131 ; Function Attrs: nounwind readnone
132 declare i32 @llvm.hexagon.S2.vsplatrb(i32) #1
134 ; Function Attrs: nounwind readnone
135 declare <16 x i32> @llvm.hexagon.V6.vd0() #1
137 ; Function Attrs: nounwind readnone
138 declare <32 x i32> @llvm.hexagon.V6.vcombine(<16 x i32>, <16 x i32>) #1
140 ; Function Attrs: nounwind readnone
141 declare <16 x i32> @llvm.hexagon.V6.vabsdiffub(<16 x i32>, <16 x i32>) #1
143 ; Function Attrs: nounwind readnone
144 declare <64 x i1> @llvm.hexagon.V6.vgtub(<16 x i32>, <16 x i32>) #1
146 ; Function Attrs: nounwind readnone
147 declare <16 x i32> @llvm.hexagon.V6.vmux(<64 x i1>, <16 x i32>, <16 x i32>) #1
149 ; Function Attrs: nounwind readnone
150 declare <32 x i32> @llvm.hexagon.V6.vmpybus.acc(<32 x i32>, <16 x i32>, i32) #1
152 ; Function Attrs: nounwind readnone
153 declare <16 x i32> @llvm.hexagon.V6.vaddbnq(<64 x i1>, <16 x i32>, <16 x i32>) #1
155 ; Function Attrs: nounwind readnone
156 declare <16 x i32> @llvm.hexagon.V6.vlalignbi(<16 x i32>, <16 x i32>, i32) #1
158 ; Function Attrs: nounwind readnone
159 declare <16 x i32> @llvm.hexagon.V6.valignbi(<16 x i32>, <16 x i32>, i32) #1
161 ; Function Attrs: nounwind readnone
162 declare <32 x i32> @llvm.hexagon.V6.vmpabus.acc(<32 x i32>, <32 x i32>, i32) #1
164 ; Function Attrs: nounwind readnone
165 declare <32 x i32> @llvm.hexagon.V6.vshuffvdd(<16 x i32>, <16 x i32>, i32) #1
167 ; Function Attrs: nounwind readnone
168 declare <16 x i32> @llvm.hexagon.V6.hi(<32 x i32>) #1
170 ; Function Attrs: nounwind readnone
171 declare <16 x i32> @llvm.hexagon.V6.lo(<32 x i32>) #1
173 ; Function Attrs: nounwind readnone
174 declare <32 x i32> @llvm.hexagon.V6.vunpackub(<16 x i32>) #1
176 ; Function Attrs: nounwind
177 define void @f1(ptr nocapture readonly %a0, ptr nocapture readonly %a1, ptr nocapture readonly %a2, i32 %a3, ptr nocapture %a4) #0 {
179 %v0 = tail call <16 x i32> @llvm.hexagon.V6.lvsplatw(i32 983055)
180 %v1 = sdiv i32 %a3, 64
181 %v2 = icmp sgt i32 %a3, 63
182 br i1 %v2, label %b1, label %b4
187 b2: ; preds = %b2, %b1
188 %v7 = phi i32 [ 0, %b1 ], [ %v44, %b2 ]
189 %v8 = phi ptr [ %a4, %b1 ], [ %v43, %b2 ]
190 %v9 = phi ptr [ %a1, %b1 ], [ %v29, %b2 ]
191 %v10 = phi ptr [ %a2, %b1 ], [ %v32, %b2 ]
192 %v11 = phi ptr [ %a0, %b1 ], [ %v27, %b2 ]
193 %v12 = getelementptr inbounds <16 x i32>, ptr %v11, i32 1
194 %v13 = load <16 x i32>, ptr %v11, align 64, !tbaa !0
195 %v14 = getelementptr inbounds <16 x i32>, ptr %v9, i32 1
196 %v15 = load <16 x i32>, ptr %v9, align 64, !tbaa !0
197 %v16 = tail call <32 x i32> @llvm.hexagon.V6.vmpyuhv(<16 x i32> %v13, <16 x i32> %v15)
198 %v17 = getelementptr inbounds <16 x i32>, ptr %v10, i32 1
199 %v18 = load <16 x i32>, ptr %v10, align 64, !tbaa !0
200 %v19 = tail call <32 x i32> @llvm.hexagon.V6.vaddhw(<16 x i32> %v18, <16 x i32> %v0)
201 %v20 = tail call <16 x i32> @llvm.hexagon.V6.lo(<32 x i32> %v16)
202 %v21 = tail call <16 x i32> @llvm.hexagon.V6.lo(<32 x i32> %v19)
203 %v22 = tail call <16 x i32> @llvm.hexagon.V6.vlsrwv(<16 x i32> %v20, <16 x i32> %v21)
204 %v23 = tail call <16 x i32> @llvm.hexagon.V6.hi(<32 x i32> %v16)
205 %v24 = tail call <16 x i32> @llvm.hexagon.V6.hi(<32 x i32> %v19)
206 %v25 = tail call <16 x i32> @llvm.hexagon.V6.vlsrwv(<16 x i32> %v23, <16 x i32> %v24)
207 %v26 = tail call <16 x i32> @llvm.hexagon.V6.vshufeh(<16 x i32> %v25, <16 x i32> %v22)
208 %v27 = getelementptr inbounds <16 x i32>, ptr %v11, i32 2
209 %v28 = load <16 x i32>, ptr %v12, align 64, !tbaa !0
210 %v29 = getelementptr inbounds <16 x i32>, ptr %v9, i32 2
211 %v30 = load <16 x i32>, ptr %v14, align 64, !tbaa !0
212 %v31 = tail call <32 x i32> @llvm.hexagon.V6.vmpyuhv(<16 x i32> %v28, <16 x i32> %v30)
213 %v32 = getelementptr inbounds <16 x i32>, ptr %v10, i32 2
214 %v33 = load <16 x i32>, ptr %v17, align 64, !tbaa !0
215 %v34 = tail call <32 x i32> @llvm.hexagon.V6.vaddhw(<16 x i32> %v33, <16 x i32> %v0)
216 %v35 = tail call <16 x i32> @llvm.hexagon.V6.lo(<32 x i32> %v31)
217 %v36 = tail call <16 x i32> @llvm.hexagon.V6.lo(<32 x i32> %v34)
218 %v37 = tail call <16 x i32> @llvm.hexagon.V6.vlsrwv(<16 x i32> %v35, <16 x i32> %v36)
219 %v38 = tail call <16 x i32> @llvm.hexagon.V6.hi(<32 x i32> %v31)
220 %v39 = tail call <16 x i32> @llvm.hexagon.V6.hi(<32 x i32> %v34)
221 %v40 = tail call <16 x i32> @llvm.hexagon.V6.vlsrwv(<16 x i32> %v38, <16 x i32> %v39)
222 %v41 = tail call <16 x i32> @llvm.hexagon.V6.vshufeh(<16 x i32> %v40, <16 x i32> %v37)
223 %v42 = tail call <16 x i32> @llvm.hexagon.V6.vpackhub.sat(<16 x i32> %v41, <16 x i32> %v26)
224 %v43 = getelementptr inbounds <16 x i32>, ptr %v8, i32 1
225 store <16 x i32> %v42, ptr %v8, align 64, !tbaa !0
226 %v44 = add nsw i32 %v7, 1
227 %v45 = icmp slt i32 %v44, %v1
228 br i1 %v45, label %b2, label %b3
233 b4: ; preds = %b3, %b0
237 ; Function Attrs: nounwind readnone
238 declare <32 x i32> @llvm.hexagon.V6.vmpyuhv(<16 x i32>, <16 x i32>) #1
240 ; Function Attrs: nounwind readnone
241 declare <32 x i32> @llvm.hexagon.V6.vaddhw(<16 x i32>, <16 x i32>) #1
243 ; Function Attrs: nounwind readnone
244 declare <16 x i32> @llvm.hexagon.V6.vlsrwv(<16 x i32>, <16 x i32>) #1
246 ; Function Attrs: nounwind readnone
247 declare <16 x i32> @llvm.hexagon.V6.vshufeh(<16 x i32>, <16 x i32>) #1
249 ; Function Attrs: nounwind readnone
250 declare <16 x i32> @llvm.hexagon.V6.vpackhub.sat(<16 x i32>, <16 x i32>) #1
252 attributes #0 = { nounwind "target-cpu"="hexagonv60" "target-features"="+hvxv60,+hvx-length64b" }
253 attributes #1 = { nounwind readnone }
255 !0 = !{!1, !1, i64 0}
256 !1 = !{!"omnipotent char", !2, i64 0}
257 !2 = !{!"Simple C/C++ TBAA"}