Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=i386-apple-macosx -mcpu=core2 -mattr=+sse | FileCheck %s
      2 ; PR11940: Do not optimize away movb %al, %ch
      3 
      4 %struct.APInt = type { i64* }
      5 
      6 declare noalias i8* @calloc(i32, i32) nounwind
      7 
      8 define void @bug(%struct.APInt* noalias nocapture sret %agg.result, %struct.APInt* nocapture %this, i32 %rotateAmt) nounwind align 2 {
      9 entry:
     10 ; CHECK: bug:
     11   %call = tail call i8* @calloc(i32 1, i32 32)
     12   %call.i = tail call i8* @calloc(i32 1, i32 32) nounwind
     13   %0 = bitcast i8* %call.i to i64*
     14   %rem.i = and i32 %rotateAmt, 63
     15   %div.i = lshr i32 %rotateAmt, 6
     16   %cmp.i = icmp eq i32 %rem.i, 0
     17   br i1 %cmp.i, label %for.cond.preheader.i, label %if.end.i
     18 
     19 for.cond.preheader.i:                             ; preds = %entry
     20   %sub.i = sub i32 4, %div.i
     21   %cmp23.i = icmp eq i32 %div.i, 4
     22   br i1 %cmp23.i, label %for.body9.lr.ph.i, label %for.body.lr.ph.i
     23 
     24 for.body.lr.ph.i:                                 ; preds = %for.cond.preheader.i
     25   %pVal.i = getelementptr inbounds %struct.APInt* %this, i32 0, i32 0
     26   %.pre5.i = load i64** %pVal.i, align 4
     27   br label %for.body.i
     28 
     29 for.body.i:                                       ; preds = %for.body.i, %for.body.lr.ph.i
     30   %i.04.i = phi i32 [ 0, %for.body.lr.ph.i ], [ %inc.i, %for.body.i ]
     31   %add.i = add i32 %i.04.i, %div.i
     32   %arrayidx.i = getelementptr inbounds i64* %.pre5.i, i32 %add.i
     33   %1 = load i64* %arrayidx.i, align 4
     34   %arrayidx3.i = getelementptr inbounds i64* %0, i32 %i.04.i
     35   store i64 %1, i64* %arrayidx3.i, align 4
     36   %inc.i = add i32 %i.04.i, 1
     37   %cmp2.i = icmp ult i32 %inc.i, %sub.i
     38   br i1 %cmp2.i, label %for.body.i, label %if.end.i
     39 
     40 if.end.i:                                         ; preds = %for.body.i, %entry
     41   %cmp81.i = icmp eq i32 %div.i, 3
     42   br i1 %cmp81.i, label %_ZNK5APInt4lshrEj.exit, label %for.body9.lr.ph.i
     43 
     44 for.body9.lr.ph.i:                                ; preds = %if.end.i, %for.cond.preheader.i
     45   %sub58.i = sub i32 3, %div.i
     46   %pVal11.i = getelementptr inbounds %struct.APInt* %this, i32 0, i32 0
     47   %sh_prom.i = zext i32 %rem.i to i64
     48   %sub17.i = sub i32 64, %rem.i
     49   %sh_prom18.i = zext i32 %sub17.i to i64
     50   %.pre.i = load i64** %pVal11.i, align 4
     51   br label %for.body9.i
     52 
     53 for.body9.i:                                      ; preds = %for.body9.i, %for.body9.lr.ph.i
     54 ; CHECK: %for.body9.i
     55 ; CHECK: movb
     56 ; CHECK: shrdl
     57   %i6.02.i = phi i32 [ 0, %for.body9.lr.ph.i ], [ %inc21.i, %for.body9.i ]
     58   %add10.i = add i32 %i6.02.i, %div.i
     59   %arrayidx12.i = getelementptr inbounds i64* %.pre.i, i32 %add10.i
     60   %2 = load i64* %arrayidx12.i, align 4
     61   %shr.i = lshr i64 %2, %sh_prom.i
     62   %add14.i = add i32 %add10.i, 1
     63   %arrayidx16.i = getelementptr inbounds i64* %.pre.i, i32 %add14.i
     64   %3 = load i64* %arrayidx16.i, align 4
     65   %shl.i = shl i64 %3, %sh_prom18.i
     66   %or.i = or i64 %shl.i, %shr.i
     67   %arrayidx19.i = getelementptr inbounds i64* %0, i32 %i6.02.i
     68   store i64 %or.i, i64* %arrayidx19.i, align 4
     69   %inc21.i = add i32 %i6.02.i, 1
     70   %cmp8.i = icmp ult i32 %inc21.i, %sub58.i
     71   br i1 %cmp8.i, label %for.body9.i, label %_ZNK5APInt4lshrEj.exit
     72 
     73 _ZNK5APInt4lshrEj.exit:                           ; preds = %for.body9.i, %if.end.i
     74   %call.i1 = tail call i8* @calloc(i32 1, i32 32) nounwind
     75   %4 = getelementptr inbounds %struct.APInt* %agg.result, i32 0, i32 0
     76   store i64* %0, i64** %4, align 4
     77   ret void
     78 }
     79