Home | History | Annotate | Download | only in Mips
      1 ; RUN: llc < %s -march=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
      5 
      6 ; This test was generated with bugpoint from
      7 ; MultiSource/Applications/JM/lencod/me_fullsearch.c
      8 
      9 %struct.SubImageContainer = type { i16****, [2 x i16****] }
     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, i16**, i16****, i16****, i16*****, i16***,
     14   i8*, i8***, i64***, i64***, i16****, i8**, i8**, %struct.storable_picture*,
     15   %struct.storable_picture*, %struct.storable_picture*,
     16   i32, i32, i32, i32, i32, i32, i32 }
     17 
     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 i32*, 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 i32****, 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 i32 (i16*, i32, i32, i32, i32, i32, i32, i32)*], align 4
     29 @computeBiPred = external global i32 (i16*, i32, i32, i32, i32, i32, i32, i32)*, align 4
     30 @bipred2_access_method = external global i32, align 4
     31 @start_me_refinement_hp = external global i32, align 4
     32 
     33 declare i32 @foobar(i16*, i32 signext , i32 signext , i32 signext ,
     34                     i32 signext , i32 signext , i32 signext , i32 signext ) #1
     35 
     36 define void @SubPelBlockSearchBiPred(i16* %orig_pic, i16 signext %ref,
     37     i32 signext %pic_pix_x, i32 signext %pic_pix_y, i16 signext %pred_mv_y,
     38     i16* nocapture %mv_x, i16* nocapture %mv_y, i16* nocapture readonly %s_mv_x,
     39     i32 signext %search_pos2, i32 signext %min_mcost) #0 {
     40 ; CHECK-LABEL: SubPelBlockSearchBiPred:
     41 entry:
     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, i32* @start_me_refinement_hp, align 4, !tbaa !1
     46   %cond47 = select i1 undef, i32 1, i32 %search_pos2
     47   %1 = load i16, i16* %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, i32* null, align 4, !tbaa !1
     52   store i32 undef, i32* bitcast (%struct.SubImageContainer* @ref_pic1_sub to i32*), align 4, !tbaa !7
     53   %3 = load i32, i32* undef, align 4, !tbaa !10
     54   store i32 %3, i32* bitcast (%struct.SubImageContainer* @ref_pic2_sub to i32*), align 4, !tbaa !7
     55   store i16 0, i16* @img_height, align 2, !tbaa !5
     56   %size_x_pad = getelementptr inbounds %struct.storable_picture, %struct.storable_picture* null, i32 0, i32 22
     57   %4 = load i32, i32* %size_x_pad, align 4, !tbaa !12
     58   store i32 %4, i32* @width_pad, align 4, !tbaa !1
     59   %5 = load i32, i32* undef, align 4, !tbaa !13
     60   store i32 %5, i32* @height_pad, align 4, !tbaa !1
     61   %6 = load i32****, i32***** @wbp_weight, align 4, !tbaa !14
     62   %arrayidx75 = getelementptr inbounds i32***, i32**** %6, i32 undef
     63   %7 = load i32***, i32**** %arrayidx75, align 4, !tbaa !14
     64   %arrayidx76 = getelementptr inbounds i32**, i32*** %7, i32 %idxprom52
     65   %8 = load i32**, i32*** %arrayidx76, align 4, !tbaa !14
     66   %cond87.in671 = load i32*, i32** %8, align 4
     67   %cond87672 = load i32, i32* %cond87.in671, align 4
     68   %conv88673 = trunc i32 %cond87672 to i16
     69   store i16 %conv88673, i16* @weight1, align 2, !tbaa !5
     70   %cond105 = load i32, i32* undef, align 4
     71   %conv106 = trunc i32 %cond105 to i16
     72   store i16 %conv106, i16* @weight2, align 2, !tbaa !5
     73   store i16 0, i16* @offsetBi, align 2, !tbaa !5
     74   %storemerge655 = load i32, i32* bitcast (i32 (i16*, i32, i32, i32, i32, i32, i32, i32)** getelementptr inbounds ([3 x i32 (i16*, i32, i32, i32, i32, i32, i32, i32)*], [3 x i32 (i16*, i32, i32, i32, i32, i32, i32, i32)*]* @computeBiPred2, i32 0, i32 1) to i32*), align 4
     75   store i32 %storemerge655, i32* bitcast (i32 (i16*, i32, i32, i32, i32, i32, i32, i32)** @computeBiPred to i32*), align 4, !tbaa !14
     76   %9 = load i16, i16* %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
     80 
     81 land.lhs.true277:                                 ; preds = %entry
     82   %10 = load i16, i16* %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
     88 
     89 if.else289:                                       ; preds = %land.lhs.true277, %entry
     90   br label %if.end290
     91 
     92 if.end290:                                        ; preds = %if.else289, %land.lhs.true277
     93   %storemerge = phi i32 [ 1, %if.else289 ], [ 0, %land.lhs.true277 ]
     94   store i32 %storemerge, i32* @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
     97 
     98 for.body.lr.ph:                                   ; preds = %if.end290
     99   %conv328 = sext i16 %pred_mv_y to i32
    100   br label %for.body
    101 
    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, i16* %mv_y, align 2, !tbaa !5
    110   %conv321 = sext i16 %12 to i32
    111   %add324 = add nsw i32 0, %conv321
    112   %13 = load i32*, i32** @mvbits, align 4, !tbaa !14
    113   %14 = load i32, i32* undef, align 4, !tbaa !1
    114   %sub329 = sub nsw i32 %add324, %conv328
    115   %arrayidx330 = getelementptr inbounds i32, i32* %13, i32 %sub329
    116   %15 = load i32, i32* %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
    122 
    123 if.end336:                                        ; preds = %for.body
    124   ; CHECK:      jalr  $25
    125   ; CHECK-NOT:  move  $ra, {{.*}}
    126   ; CHECK:      j     $BB{{.*}}
    127   %add337 = add nsw i32 %add320, %shl
    128   %add338 = add nsw i32 %add324, 0
    129   %call340 = tail call i32 undef(i16* %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
    135   br label %for.inc
    136 
    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, i16* %mv_x, align 2, !tbaa !5
    140   br label %for.body
    141 
    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
    145 
    146 for.body415.lr.ph:                                ; preds = %if.end358
    147   %16 = load i16, i16* %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
    152 
    153 if.end436:                                        ; preds = %for.body415.lr.ph
    154   %add438 = add nsw i32 %add423, 0
    155   %call440 = tail call i32 @foobar(i16* %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
    158   br label %if.end461
    159 
    160 if.end461:                                        ; preds = %if.end436, %for.body415.lr.ph, %if.end358
    161   ret void
    162 }
    163 
    164 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "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 }
    166 
    167 !llvm.ident = !{!0}
    168 
    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}
    184