1 ; RUN: llc < %s -mtriple=mips -mcpu=mips32r2 -O2 \
2 ; RUN: -disable-mips-df-forward-search=false \
3 ; RUN: -disable-mips-df-succbb-search=false \
4 ; RUN: -relocation-model=static | FileCheck %s
6 ; This test was generated with bugpoint from
7 ; MultiSource/Applications/JM/lencod/me_fullsearch.c
9 %struct.SubImageContainer = type { ptr, [2 x ptr] }
10 %struct.storable_picture = type { i32, i32, i32, i32, i32, i32,
11 [6 x [33 x i64]], [6 x [33 x i64]], [6 x [33 x i64]], [6 x [33 x i64]],
12 i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32,
13 i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr,
14 ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr,
16 i32, i32, i32, i32, i32, i32, i32 }
18 @img_height = external global i16, align 2
19 @width_pad = external global i32, align 4
20 @height_pad = external global i32, align 4
21 @mvbits = external global ptr, align 4
22 @ref_pic1_sub = external global %struct.SubImageContainer, align 4
23 @ref_pic2_sub = external global %struct.SubImageContainer, align 4
24 @wbp_weight = external global ptr, align 4
25 @weight1 = external global i16, align 2
26 @weight2 = external global i16, align 2
27 @offsetBi = external global i16, align 2
28 @computeBiPred2 = external global [3 x ptr], align 4
29 @computeBiPred = external global ptr, align 4
30 @bipred2_access_method = external global i32, align 4
31 @start_me_refinement_hp = external global i32, align 4
33 declare i32 @foobar(ptr, i32 signext , i32 signext , i32 signext ,
34 i32 signext , i32 signext , i32 signext , i32 signext ) #1
36 define void @SubPelBlockSearchBiPred(ptr %orig_pic, i16 signext %ref,
37 i32 signext %pic_pix_x, i32 signext %pic_pix_y, i16 signext %pred_mv_y,
38 ptr nocapture %mv_x, ptr nocapture %mv_y, ptr nocapture readonly %s_mv_x,
39 i32 signext %search_pos2, i32 signext %min_mcost) #0 {
40 ; CHECK-LABEL: SubPelBlockSearchBiPred:
42 %add40 = shl i32 %pic_pix_x, 2
43 %shl = add i32 %add40, 80
44 %add41 = shl i32 %pic_pix_y, 2
45 %0 = load i32, ptr @start_me_refinement_hp, align 4, !tbaa !1
46 %cond47 = select i1 undef, i32 1, i32 %search_pos2
47 %1 = load i16, ptr %s_mv_x, align 2, !tbaa !5
48 %conv48 = sext i16 %1 to i32
49 %add49 = add nsw i32 %conv48, %shl
50 %idxprom52 = sext i16 %ref to i32
51 %2 = load i32, ptr null, align 4, !tbaa !1
52 store i32 undef, ptr @ref_pic1_sub, align 4, !tbaa !7
53 %3 = load i32, ptr undef, align 4, !tbaa !10
54 store i32 %3, ptr @ref_pic2_sub, align 4, !tbaa !7
55 store i16 0, ptr @img_height, align 2, !tbaa !5
56 %size_x_pad = getelementptr inbounds %struct.storable_picture, ptr null, i32 0, i32 22
57 %4 = load i32, ptr %size_x_pad, align 4, !tbaa !12
58 store i32 %4, ptr @width_pad, align 4, !tbaa !1
59 %5 = load i32, ptr undef, align 4, !tbaa !13
60 store i32 %5, ptr @height_pad, align 4, !tbaa !1
61 %6 = load ptr, ptr @wbp_weight, align 4, !tbaa !14
62 %arrayidx75 = getelementptr inbounds ptr, ptr %6, i32 undef
63 %7 = load ptr, ptr %arrayidx75, align 4, !tbaa !14
64 %arrayidx76 = getelementptr inbounds ptr, ptr %7, i32 %idxprom52
65 %8 = load ptr, ptr %arrayidx76, align 4, !tbaa !14
66 %cond87.in671 = load ptr, ptr %8, align 4
67 %cond87672 = load i32, ptr %cond87.in671, align 4
68 %conv88673 = trunc i32 %cond87672 to i16
69 store i16 %conv88673, ptr @weight1, align 2, !tbaa !5
70 %cond105 = load i32, ptr undef, align 4
71 %conv106 = trunc i32 %cond105 to i16
72 store i16 %conv106, ptr @weight2, align 2, !tbaa !5
73 store i16 0, ptr @offsetBi, align 2, !tbaa !5
74 %storemerge655 = load i32, ptr getelementptr inbounds ([3 x ptr], ptr @computeBiPred2, i32 0, i32 1), align 4
75 store i32 %storemerge655, ptr @computeBiPred, align 4, !tbaa !14
76 %9 = load i16, ptr %mv_x, align 2, !tbaa !5
77 %cmp270 = icmp sgt i32 undef, 1
78 %or.cond = and i1 %cmp270, false
79 br i1 %or.cond, label %land.lhs.true277, label %if.else289
81 land.lhs.true277: ; preds = %entry
82 %10 = load i16, ptr %mv_y, align 2, !tbaa !5
83 %conv278 = sext i16 %10 to i32
84 %add279 = add nsw i32 %conv278, 0
85 %cmp280 = icmp sgt i32 %add279, 1
86 %or.cond660 = and i1 %cmp280, undef
87 br i1 %or.cond660, label %if.end290, label %if.else289
89 if.else289: ; preds = %land.lhs.true277, %entry
92 if.end290: ; preds = %if.else289, %land.lhs.true277
93 %storemerge = phi i32 [ 1, %if.else289 ], [ 0, %land.lhs.true277 ]
94 store i32 %storemerge, ptr @bipred2_access_method, align 4, !tbaa !1
95 %cmp315698 = icmp slt i32 %0, %cond47
96 br i1 %cmp315698, label %for.body.lr.ph, label %if.end358
98 for.body.lr.ph: ; preds = %if.end290
99 %conv328 = sext i16 %pred_mv_y to i32
102 for.body: ; preds = %for.inc, %for.body.lr.ph
103 %11 = phi i16 [ %9, %for.body.lr.ph ], [ %.pre, %for.inc ]
104 %min_mcost.addr.0701 = phi i32 [ %min_mcost, %for.body.lr.ph ], [ undef, %for.inc ]
105 %pos.0700 = phi i32 [ %0, %for.body.lr.ph ], [ undef, %for.inc ]
106 %best_pos.0699 = phi i32 [ 0, %for.body.lr.ph ], [ %best_pos.1, %for.inc ]
107 %conv317 = sext i16 %11 to i32
108 %add320 = add nsw i32 0, %conv317
109 %12 = load i16, ptr %mv_y, align 2, !tbaa !5
110 %conv321 = sext i16 %12 to i32
111 %add324 = add nsw i32 0, %conv321
112 %13 = load ptr, ptr @mvbits, align 4, !tbaa !14
113 %14 = load i32, ptr undef, align 4, !tbaa !1
114 %sub329 = sub nsw i32 %add324, %conv328
115 %arrayidx330 = getelementptr inbounds i32, ptr %13, i32 %sub329
116 %15 = load i32, ptr %arrayidx330, align 4, !tbaa !1
117 %add331 = add nsw i32 %15, %14
118 %mul = mul nsw i32 %add331, %2
119 %shr332 = ashr i32 %mul, 16
120 %cmp333 = icmp sgt i32 %min_mcost.addr.0701, %shr332
121 br i1 %cmp333, label %if.end336, label %for.inc
123 if.end336: ; preds = %for.body
125 ; CHECK-NOT: move $ra, {{.*}}
127 %add337 = add nsw i32 %add320, %shl
128 %add338 = add nsw i32 %add324, 0
129 %call340 = tail call i32 undef(ptr %orig_pic, i32 signext undef, i32 signext
130 undef, i32 signext 0, i32 signext %add49,
131 i32 signext undef, i32 signext %add337,
132 i32 signext %add338) #1
133 %cmp342 = icmp slt i32 0, %min_mcost.addr.0701
134 %pos.0.best_pos.0 = select i1 %cmp342, i32 %pos.0700, i32 %best_pos.0699
137 for.inc: ; preds = %if.end336, %for.body
138 %best_pos.1 = phi i32 [ %best_pos.0699, %for.body ], [ %pos.0.best_pos.0, %if.end336 ]
139 %.pre = load i16, ptr %mv_x, align 2, !tbaa !5
142 if.end358: ; preds = %if.end290
143 %.min_mcost.addr.0 = select i1 false, i32 2147483647, i32 %min_mcost
144 br i1 undef, label %for.body415.lr.ph, label %if.end461
146 for.body415.lr.ph: ; preds = %if.end358
147 %16 = load i16, ptr %mv_y, align 2, !tbaa !5
148 %conv420 = sext i16 %16 to i32
149 %add423 = add nsw i32 0, %conv420
150 %cmp433 = icmp sgt i32 %.min_mcost.addr.0, 0
151 br i1 %cmp433, label %if.end436, label %if.end461
153 if.end436: ; preds = %for.body415.lr.ph
154 %add438 = add nsw i32 %add423, 0
155 %call440 = tail call i32 @foobar(ptr %orig_pic, i32 signext undef, i32 signext undef,
156 i32 signext 0, i32 signext %add49, i32 signext undef,
157 i32 signext undef, i32 signext %add438) #1
160 if.end461: ; preds = %if.end436, %for.body415.lr.ph, %if.end358
164 attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="mips32r2" "target-features"="+mips32r2,+nooddspreg,+fpxx" "unsafe-fp-math"="false" "use-soft-float"="false" }
165 attributes #1 = { nounwind }
169 !0 = !{!"clang version 3.7.0 (trunk 236218) (llvm/trunk 236237)"}
170 !1 = !{!2, !2, i64 0}
171 !2 = !{!"int", !3, i64 0}
172 !3 = !{!"omnipotent char", !4, i64 0}
173 !4 = !{!"Simple C/C++ TBAA"}
174 !5 = !{!6, !6, i64 0}
175 !6 = !{!"short", !3, i64 0}
176 !7 = !{!8, !9, i64 0}
177 !8 = !{!"", !9, i64 0, !3, i64 4}
178 !9 = !{!"any pointer", !3, i64 0}
179 !10 = !{!11, !9, i64 6440}
180 !11 = !{!"storable_picture", !3, i64 0, !2, i64 4, !2, i64 8, !2, i64 12, !2, i64 16, !2, i64 20, !3, i64 24, !3, i64 1608, !3, i64 3192, !3, i64 4776, !2, i64 6360, !2, i64 6364, !2, i64 6368, !2, i64 6372, !2, i64 6376, !2, i64 6380, !2, i64 6384, !2, i64 6388, !2, i64 6392, !2, i64 6396, !2, i64 6400, !2, i64 6404, !2, i64 6408, !2, i64 6412, !2, i64 6416, !2, i64 6420, !2, i64 6424, !2, i64 6428, !2, i64 6432, !9, i64 6436, !9, i64 6440, !9, i64 6444, !9, i64 6448, !9, i64 6452, !9, i64 6456, !9, i64 6460, !9, i64 6464, !9, i64 6468, !9, i64 6472, !9, i64 6476, !9, i64 6480, !9, i64 6484, !9, i64 6488, !9, i64 6492, !2, i64 6496, !2, i64 6500, !2, i64 6504, !2, i64 6508, !2, i64 6512, !2, i64 6516, !2, i64 6520}
181 !12 = !{!11, !2, i64 6408}
182 !13 = !{!11, !2, i64 6412}
183 !14 = !{!9, !9, i64 0}