1 ; RUN: llc -march=hexagon < %s | FileCheck %s
4 target triple = "hexagon"
6 %s.0 = type { i16, i16, i16, [4 x i8*], i32, i32, i32, %s.1*, %s.3, i16, i16, i16, i16, i16, %s.4 }
7 %s.1 = type { %s.1*, %s.2* }
8 %s.2 = type { i16, i16 }
9 %s.3 = type { i32, i16*, i16*, i32* }
12 @g0 = private unnamed_addr constant [7 x i8] c"Static\00", align 1
13 @g1 = private unnamed_addr constant [5 x i8] c"Heap\00", align 1
14 @g2 = private unnamed_addr constant [6 x i8] c"Stack\00", align 1
16 ; Function Attrs: nounwind
17 define i32 @f0(i32 %a0, i8** nocapture %a1) #0 {
19 %v0 = alloca [1 x %s.0], align 8
20 %v1 = call i32 @f1(i32 5) #0
21 %v2 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 6
22 %v3 = icmp eq i32 %v1, 0
23 %v4 = select i1 %v3, i32 7, i32 %v1
24 store i32 %v4, i32* %v2, align 8, !tbaa !0
25 %v5 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 0
26 %v6 = bitcast [1 x %s.0]* %v0 to i32*
27 %v7 = load i32, i32* %v6, align 8
28 %v8 = trunc i32 %v7 to i16
29 %v9 = icmp eq i16 %v8, 0
30 br i1 %v9, label %b1, label %b4
33 %v10 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 1
34 %v11 = icmp ult i32 %v7, 65536
35 br i1 %v11, label %b2, label %b4
38 %v12 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 2
39 %v13 = load i16, i16* %v12, align 4, !tbaa !4
40 %v14 = icmp eq i16 %v13, 0
41 br i1 %v14, label %b3, label %b4
44 store i16 0, i16* %v5, align 8, !tbaa !4
45 store i16 0, i16* %v10, align 2, !tbaa !4
46 store i16 102, i16* %v12, align 4, !tbaa !4
49 b4: ; preds = %b3, %b2, %b1, %b0
50 %v15 = phi i16 [ 0, %b3 ], [ 0, %b2 ], [ 0, %b1 ], [ %v8, %b0 ]
51 %v16 = insertelement <1 x i32> undef, i32 %v4, i32 0
52 %v17 = shufflevector <1 x i32> %v16, <1 x i32> undef, <2 x i32> zeroinitializer
53 %v18 = and <2 x i32> %v17, <i32 1, i32 2>
54 %v19 = icmp ne <2 x i32> %v18, zeroinitializer
55 %v20 = zext <2 x i1> %v19 to <2 x i16>
56 %v21 = extractelement <2 x i16> %v20, i32 0
57 %v22 = extractelement <2 x i16> %v20, i32 1
58 %v23 = add i16 %v21, %v22
59 %v24 = lshr i32 %v4, 2
60 %v25 = trunc i32 %v24 to i16
61 %v26 = and i16 %v25, 1
62 %v27 = add i16 %v23, %v26
63 %v28 = getelementptr [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 4
64 %v29 = load i32, i32* %v28, align 8
65 %v30 = zext i16 %v27 to i32
66 %v31 = udiv i32 %v29, %v30
67 store i32 %v31, i32* %v28, align 8
68 %v32 = getelementptr [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 3, i32 0
70 %v34 = icmp eq i32 %v33, 0
71 br i1 %v34, label %b5, label %b12
73 b5: ; preds = %b12, %b4
74 %v35 = phi i16 [ 0, %b4 ], [ 1, %b12 ]
76 %v37 = icmp eq i32 %v36, 0
77 br i1 %v37, label %b14, label %b13
80 %v38 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 3, i32 1
81 %v39 = load i8*, i8** %v38, align 4, !tbaa !6
82 %v40 = bitcast i8* %v39 to %s.1*
83 %v41 = call %s.1* @f2(i32 %v31, %s.1* %v40, i16 signext %v15) #0
84 %v42 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 7
85 store %s.1* %v41, %s.1** %v42, align 4, !tbaa !6
86 %v43 = load i32, i32* %v2, align 8, !tbaa !0
89 b7: ; preds = %b16, %b6
90 %v44 = phi i32 [ %v4, %b16 ], [ %v43, %b6 ]
91 %v45 = and i32 %v44, 2
92 %v46 = icmp eq i32 %v45, 0
93 br i1 %v46, label %b9, label %b8
96 %v47 = load i32, i32* %v28, align 8, !tbaa !0
97 %v48 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 3, i32 2
98 %v49 = load i8*, i8** %v48, align 8, !tbaa !6
99 %v50 = load i32, i32* %v6, align 8
100 %v51 = shl i32 %v50, 16
101 %v52 = ashr exact i32 %v51, 16
102 %v53 = and i32 %v50, -65536
103 %v54 = or i32 %v53, %v52
104 %v55 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 8
105 %v56 = call i32 @f3(i32 %v47, i8* %v49, i32 %v54, %s.3* %v55) #0
106 %v57 = load i32, i32* %v2, align 8, !tbaa !0
109 b9: ; preds = %b8, %b7
110 %v58 = phi i32 [ %v44, %b7 ], [ %v57, %b8 ]
111 %v59 = and i32 %v58, 4
112 %v60 = icmp eq i32 %v59, 0
113 br i1 %v60, label %b11, label %b10
116 %v61 = load i32, i32* %v28, align 8, !tbaa !0
117 %v62 = load i16, i16* %v5, align 8, !tbaa !4
118 %v63 = getelementptr inbounds [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 3, i32 3
119 %v64 = load i8*, i8** %v63, align 4, !tbaa !6
120 call void @f4(i32 %v61, i16 signext %v62, i8* %v64) #0
123 b11: ; preds = %b10, %b9
127 %v65 = getelementptr [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 3, i32 1
128 %v66 = load i8*, i8** %v32, align 8
129 store i8* %v66, i8** %v65, align 4
133 %v67 = getelementptr [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 3, i32 2
134 %v68 = load i8*, i8** %v32, align 8
135 %v69 = zext i16 %v35 to i32
136 %v70 = sub i32 0, %v69
137 %v71 = and i32 %v31, %v70
138 %v72 = getelementptr inbounds i8, i8* %v68, i32 %v71
139 store i8* %v72, i8** %v67, align 8
140 %v73 = add i16 %v35, 1
143 b14: ; preds = %b13, %b5
144 %v74 = phi i16 [ %v35, %b5 ], [ %v73, %b13 ]
145 %v75 = and i32 %v4, 4
146 %v76 = icmp eq i32 %v75, 0
147 br i1 %v76, label %b16, label %b15
150 %v77 = getelementptr [1 x %s.0], [1 x %s.0]* %v0, i32 0, i32 0, i32 3, i32 3
151 %v78 = load i8*, i8** %v32, align 8
152 %v79 = zext i16 %v74 to i32
153 %v80 = mul i32 %v31, %v79
154 %v81 = getelementptr inbounds i8, i8* %v78, i32 %v80
155 store i8* %v81, i8** %v77, align 4
158 b16: ; preds = %b15, %b14
159 br i1 %v34, label %b7, label %b6
162 declare i32 @f1(i32) #0
164 declare %s.1* @f2(i32, %s.1*, i16 signext) #0
166 declare i32 @f3(i32, i8*, i32, %s.3*) #0
168 declare void @f4(i32, i16 signext, i8*) #0
170 attributes #0 = { nounwind "target-cpu"="hexagonv55" }
172 !0 = !{!1, !1, i64 0}
174 !2 = !{!"omnipotent char", !3}
175 !3 = !{!"Simple C/C++ TBAA"}
176 !4 = !{!5, !5, i64 0}
178 !6 = !{!7, !7, i64 0}
179 !7 = !{!"any pointer", !2}