1 ; RUN: llc -march=hexagon < %s | FileCheck %s
4 target triple = "hexagon"
8 @g0 = internal unnamed_addr global %s.0* null, section ".data.............", align 4
9 @g1 = internal global i32 0, section ".data.............", align 4
11 ; Function Attrs: nounwind
12 define %s.0* @f0(i32* %a0) #0 {
14 %v0 = getelementptr inbounds i32, i32* %a0, i32 -1
15 %v1 = load i32, i32* %v0, align 4
17 store i32 %v2, i32* %v0, align 4
18 %v3 = getelementptr inbounds i32, i32* %a0, i32 -2
19 %v4 = load i32, i32* %v3, align 4
22 %v7 = getelementptr inbounds i32, i32* %a0, i32 %v6
25 %v10 = getelementptr inbounds i32, i32* %a0, i32 %v9
26 %v11 = load i32, i32* %v10, align 4
27 %v12 = lshr i32 %v11, 2
28 %v13 = icmp eq i32 %v12, 0
29 br i1 %v13, label %b3, label %b1
32 %v14 = add i32 %v12, %v9
33 %v15 = getelementptr inbounds i32, i32* %a0, i32 %v14
34 %v16 = load i32, i32* %v15, align 4
35 %v17 = and i32 %v16, 1
36 %v18 = icmp eq i32 %v17, 0
37 br i1 %v18, label %b3, label %b2
40 %v19 = add nsw i32 %v12, %v8
41 %v20 = shl i32 %v19, 2
43 %v22 = or i32 %v20, %v21
44 store i32 %v22, i32* %v0, align 4
47 b3: ; preds = %b2, %b1, %b0
48 %v23 = phi i32 [ %v2, %b1 ], [ %v2, %b0 ], [ %v22, %b2 ]
49 %v24 = and i32 %v23, 1
50 %v25 = icmp eq i32 %v24, 0
51 br i1 %v25, label %b5, label %b4
54 %v26 = load i32, i32* %v7, align 4
55 %v27 = and i32 %v26, -4
56 %v28 = add i32 %v27, %v23
57 %v29 = and i32 %v28, -4
58 %v30 = and i32 %v26, 3
59 %v31 = or i32 %v29, %v30
60 store i32 %v31, i32* %v7, align 4
63 b5: ; preds = %b4, %b3
64 %v32 = phi i32 [ %v31, %b4 ], [ %v23, %b3 ]
65 %v33 = phi i32* [ %v7, %b4 ], [ %v0, %b3 ]
66 %v34 = bitcast i32* %v33 to %s.0*
67 %v35 = lshr i32 %v32, 2
68 %v36 = add i32 %v35, -1
69 %v37 = getelementptr inbounds %s.0, %s.0* %v34, i32 %v36, i32 0
70 %v38 = load i32, i32* %v37, align 4
71 %v39 = shl nuw i32 %v35, 2
72 %v40 = and i32 %v38, 3
73 %v41 = or i32 %v40, %v39
74 store i32 %v41, i32* %v37, align 4
75 %v42 = load i32, i32* %v33, align 4
76 %v43 = lshr i32 %v42, 2
77 %v44 = getelementptr inbounds %s.0, %s.0* %v34, i32 %v43, i32 0
78 %v45 = load i32, i32* %v44, align 4
80 store i32 %v46, i32* %v44, align 4
84 ; Function Attrs: nounwind
85 define i64 @f1(i32 %a0) #0 {
87 %v0 = load %s.0*, %s.0** @g0, align 4, !tbaa !0
88 %v1 = getelementptr inbounds %s.0, %s.0* %v0, i32 7
89 tail call void @f2(i32* @g1) #0
92 b1: ; preds = %b5, %b0
93 %v2 = phi %s.0* [ %v1, %b0 ], [ %v20, %b5 ]
94 %v3 = getelementptr inbounds %s.0, %s.0* %v2, i32 0, i32 0
95 %v4 = load i32, i32* %v3, align 4
97 %v6 = icmp eq i32 %v5, 0
98 br i1 %v6, label %b3, label %b2
101 tail call fastcc void @f8()
102 %v7 = getelementptr inbounds %s.0, %s.0* %v2, i32 1, i32 0
103 %v8 = tail call %s.0* @f0(i32* %v7)
104 tail call fastcc void @f7()
107 b3: ; preds = %b2, %b1
108 %v9 = phi %s.0* [ %v8, %b2 ], [ %v2, %b1 ]
109 %v10 = getelementptr inbounds %s.0, %s.0* %v9, i32 0, i32 0
110 %v11 = load i32, i32* %v10, align 4
111 %v12 = lshr i32 %v11, 2
112 %v13 = getelementptr inbounds %s.0, %s.0* %v9, i32 %v12, i32 0
113 %v14 = load i32, i32* %v13, align 4
114 %v15 = and i32 %v14, 1
115 %v16 = icmp eq i32 %v15, 0
116 br i1 %v16, label %b5, label %b4
119 %v17 = mul i32 %v12, 4
120 %v18 = add i32 %v17, -4
121 %v19 = icmp ult i32 %v18, %a0
122 br i1 %v19, label %b5, label %b7
124 b5: ; preds = %b4, %b3
125 %v20 = getelementptr inbounds %s.0, %s.0* %v9, i32 %v12
126 %v21 = icmp ult i32 %v14, 4
127 br i1 %v21, label %b6, label %b1
130 tail call fastcc void @f3()
134 %v22 = add i32 %a0, 4
135 %v23 = lshr i32 %v22, 2
136 %v24 = add i32 %v23, 8
137 %v25 = lshr i32 %v24, 3
138 %v26 = mul nsw i32 %v25, 8
139 %v27 = sub nsw i32 %v12, %v26
140 %v28 = icmp sgt i32 %v27, 7
141 br i1 %v28, label %b8, label %b9
144 %v29 = getelementptr inbounds %s.0, %s.0* %v9, i32 %v26, i32 0
145 %v30 = shl i32 %v27, 2
146 store i32 %v30, i32* %v29, align 4
147 %v31 = load i32, i32* %v10, align 4
148 %v32 = lshr i32 %v31, 2
149 %v33 = add i32 %v32, -1
150 %v34 = getelementptr inbounds %s.0, %s.0* %v9, i32 %v33, i32 0
151 %v35 = load i32, i32* %v34, align 4
152 %v36 = and i32 %v35, 3
153 %v37 = or i32 %v36, %v30
154 store i32 %v37, i32* %v34, align 4
155 %v38 = load i32, i32* %v10, align 4
156 %v39 = mul i32 %v25, 32
157 %v40 = and i32 %v38, 3
158 %v41 = or i32 %v40, %v39
159 store i32 %v41, i32* %v10, align 4
163 %v42 = and i32 %v14, -2
164 store i32 %v42, i32* %v13, align 4
167 b10: ; preds = %b9, %b8
168 tail call fastcc void @f3()
169 %v43 = getelementptr inbounds %s.0, %s.0* %v9, i32 1
170 %v44 = load i32, i32* %v10, align 4
171 %v45 = lshr i32 %v44, 2
172 %v46 = mul i32 %v45, 4
173 %v47 = add i32 %v46, -4
174 %v48 = ptrtoint %s.0* %v43 to i32
175 %v49 = zext i32 %v47 to i64
176 %v50 = shl nuw i64 %v49, 32
177 %v51 = zext i32 %v48 to i64
180 b11: ; preds = %b10, %b6
181 %v52 = phi i64 [ 0, %b6 ], [ %v51, %b10 ]
182 %v53 = phi i64 [ 0, %b6 ], [ %v50, %b10 ]
183 %v54 = or i64 %v53, %v52
187 declare void @f2(i32*) #0
189 ; Function Attrs: inlinehint nounwind
190 define internal fastcc void @f3() #1 {
192 store i32 0, i32* @g1, align 4, !tbaa !4
196 ; Function Attrs: nounwind
197 define void @f4(i32* nocapture %a0) #0 {
199 %v0 = getelementptr inbounds i32, i32* %a0, i32 -1
200 tail call void @f2(i32* @g1) #0
201 %v1 = load i32, i32* %v0, align 4
203 store i32 %v2, i32* %v0, align 4
204 tail call fastcc void @f3()
208 ; Function Attrs: nounwind
209 define %s.0* @f5(i32* %a0) #0 {
211 tail call void @f2(i32* @g1) #0
212 %v0 = tail call %s.0* @f0(i32* %a0)
213 tail call fastcc void @f3()
217 ; Function Attrs: nounwind
218 define void @f6(%s.0* %a0, i32 %a1) #0 {
220 %v0 = getelementptr inbounds %s.0, %s.0* %a0, i32 7, i32 0
222 %v2 = add i32 %v1, -32
223 store i32 %v2, i32* %v0, align 4
224 %v3 = add i32 %a1, -1
225 %v4 = getelementptr inbounds %s.0, %s.0* %a0, i32 %v3, i32 0
226 store i32 1, i32* %v4, align 4
227 store i32 0, i32* @g1, align 4, !tbaa !4
228 store %s.0* %a0, %s.0** @g0, align 4
232 ; Function Attrs: inlinehint nounwind
233 define internal fastcc void @f7() #1 {
235 tail call void asm sideeffect " nop", "~{memory}"() #0, !srcloc !6
239 ; Function Attrs: inlinehint nounwind
240 define internal fastcc void @f8() #1 {
242 tail call void asm sideeffect " nop", "~{memory}"() #0, !srcloc !7
246 attributes #0 = { nounwind }
247 attributes #1 = { inlinehint nounwind }
249 !0 = !{!1, !1, i64 0}
250 !1 = !{!"any pointer", !2}
251 !2 = !{!"omnipotent char", !3}
252 !3 = !{!"Simple C/C++ TBAA"}
253 !4 = !{!5, !5, i64 0}