1 ; RUN: llc -march=hexagon < %s | FileCheck %s
4 target triple = "hexagon"
6 %s.0 = type { i16, i16, i16, [4 x ptr], i32, i32, i32, ptr, %s.3, i16, i16, i16, i16, i16, %s.4 }
7 %s.1 = type { ptr, ptr }
8 %s.2 = type { i16, i16 }
9 %s.3 = type { i32, ptr, ptr, ptr }
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, ptr 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], ptr %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, ptr %v2, align 8, !tbaa !0
25 %v7 = load i32, ptr %v0, align 8
26 %v8 = trunc i32 %v7 to i16
27 %v9 = icmp eq i16 %v8, 0
28 br i1 %v9, label %b1, label %b4
31 %v10 = getelementptr inbounds [1 x %s.0], ptr %v0, i32 0, i32 0, i32 1
32 %v11 = icmp ult i32 %v7, 65536
33 br i1 %v11, label %b2, label %b4
36 %v12 = getelementptr inbounds [1 x %s.0], ptr %v0, i32 0, i32 0, i32 2
37 %v13 = load i16, ptr %v12, align 4, !tbaa !4
38 %v14 = icmp eq i16 %v13, 0
39 br i1 %v14, label %b3, label %b4
42 store i16 0, ptr %v0, align 8, !tbaa !4
43 store i16 0, ptr %v10, align 2, !tbaa !4
44 store i16 102, ptr %v12, align 4, !tbaa !4
47 b4: ; preds = %b3, %b2, %b1, %b0
48 %v15 = phi i16 [ 0, %b3 ], [ 0, %b2 ], [ 0, %b1 ], [ %v8, %b0 ]
49 %v16 = insertelement <1 x i32> undef, i32 %v4, i32 0
50 %v17 = shufflevector <1 x i32> %v16, <1 x i32> undef, <2 x i32> zeroinitializer
51 %v18 = and <2 x i32> %v17, <i32 1, i32 2>
52 %v19 = icmp ne <2 x i32> %v18, zeroinitializer
53 %v20 = zext <2 x i1> %v19 to <2 x i16>
54 %v21 = extractelement <2 x i16> %v20, i32 0
55 %v22 = extractelement <2 x i16> %v20, i32 1
56 %v23 = add i16 %v21, %v22
57 %v24 = lshr i32 %v4, 2
58 %v25 = trunc i32 %v24 to i16
59 %v26 = and i16 %v25, 1
60 %v27 = add i16 %v23, %v26
61 %v28 = getelementptr [1 x %s.0], ptr %v0, i32 0, i32 0, i32 4
62 %v29 = load i32, ptr %v28, align 8
63 %v30 = zext i16 %v27 to i32
64 %v31 = udiv i32 %v29, %v30
65 store i32 %v31, ptr %v28, align 8
66 %v32 = getelementptr [1 x %s.0], ptr %v0, i32 0, i32 0, i32 3, i32 0
68 %v34 = icmp eq i32 %v33, 0
69 br i1 %v34, label %b5, label %b12
71 b5: ; preds = %b12, %b4
72 %v35 = phi i16 [ 0, %b4 ], [ 1, %b12 ]
74 %v37 = icmp eq i32 %v36, 0
75 br i1 %v37, label %b14, label %b13
78 %v38 = getelementptr inbounds [1 x %s.0], ptr %v0, i32 0, i32 0, i32 3, i32 1
79 %v39 = load ptr, ptr %v38, align 4, !tbaa !6
80 %v41 = call ptr @f2(i32 %v31, ptr %v39, i16 signext %v15) #0
81 %v42 = getelementptr inbounds [1 x %s.0], ptr %v0, i32 0, i32 0, i32 7
82 store ptr %v41, ptr %v42, align 4, !tbaa !6
83 %v43 = load i32, ptr %v2, align 8, !tbaa !0
86 b7: ; preds = %b16, %b6
87 %v44 = phi i32 [ %v4, %b16 ], [ %v43, %b6 ]
88 %v45 = and i32 %v44, 2
89 %v46 = icmp eq i32 %v45, 0
90 br i1 %v46, label %b9, label %b8
93 %v47 = load i32, ptr %v28, align 8, !tbaa !0
94 %v48 = getelementptr inbounds [1 x %s.0], ptr %v0, i32 0, i32 0, i32 3, i32 2
95 %v49 = load ptr, ptr %v48, align 8, !tbaa !6
96 %v50 = load i32, ptr %v0, align 8
97 %v51 = shl i32 %v50, 16
98 %v52 = ashr exact i32 %v51, 16
99 %v53 = and i32 %v50, -65536
100 %v54 = or i32 %v53, %v52
101 %v55 = getelementptr inbounds [1 x %s.0], ptr %v0, i32 0, i32 0, i32 8
102 %v56 = call i32 @f3(i32 %v47, ptr %v49, i32 %v54, ptr %v55) #0
103 %v57 = load i32, ptr %v2, align 8, !tbaa !0
106 b9: ; preds = %b8, %b7
107 %v58 = phi i32 [ %v44, %b7 ], [ %v57, %b8 ]
108 %v59 = and i32 %v58, 4
109 %v60 = icmp eq i32 %v59, 0
110 br i1 %v60, label %b11, label %b10
113 %v61 = load i32, ptr %v28, align 8, !tbaa !0
114 %v62 = load i16, ptr %v0, align 8, !tbaa !4
115 %v63 = getelementptr inbounds [1 x %s.0], ptr %v0, i32 0, i32 0, i32 3, i32 3
116 %v64 = load ptr, ptr %v63, align 4, !tbaa !6
117 call void @f4(i32 %v61, i16 signext %v62, ptr %v64) #0
120 b11: ; preds = %b10, %b9
124 %v65 = getelementptr [1 x %s.0], ptr %v0, i32 0, i32 0, i32 3, i32 1
125 %v66 = load ptr, ptr %v32, align 8
126 store ptr %v66, ptr %v65, align 4
130 %v67 = getelementptr [1 x %s.0], ptr %v0, i32 0, i32 0, i32 3, i32 2
131 %v68 = load ptr, ptr %v32, align 8
132 %v69 = zext i16 %v35 to i32
133 %v70 = sub i32 0, %v69
134 %v71 = and i32 %v31, %v70
135 %v72 = getelementptr inbounds i8, ptr %v68, i32 %v71
136 store ptr %v72, ptr %v67, align 8
137 %v73 = add i16 %v35, 1
140 b14: ; preds = %b13, %b5
141 %v74 = phi i16 [ %v35, %b5 ], [ %v73, %b13 ]
142 %v75 = and i32 %v4, 4
143 %v76 = icmp eq i32 %v75, 0
144 br i1 %v76, label %b16, label %b15
147 %v77 = getelementptr [1 x %s.0], ptr %v0, i32 0, i32 0, i32 3, i32 3
148 %v78 = load ptr, ptr %v32, align 8
149 %v79 = zext i16 %v74 to i32
150 %v80 = mul i32 %v31, %v79
151 %v81 = getelementptr inbounds i8, ptr %v78, i32 %v80
152 store ptr %v81, ptr %v77, align 4
155 b16: ; preds = %b15, %b14
156 br i1 %v34, label %b7, label %b6
159 declare i32 @f1(i32) #0
161 declare ptr @f2(i32, ptr, i16 signext) #0
163 declare i32 @f3(i32, ptr, i32, ptr) #0
165 declare void @f4(i32, i16 signext, ptr) #0
167 attributes #0 = { nounwind "target-cpu"="hexagonv55" }
169 !0 = !{!1, !1, i64 0}
171 !2 = !{!"omnipotent char", !3}
172 !3 = !{!"Simple C/C++ TBAA"}
173 !4 = !{!5, !5, i64 0}
175 !6 = !{!7, !7, i64 0}
176 !7 = !{!"any pointer", !2}