brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · eec3b4b Raw
125 lines · plain
1; RUN: opt < %s -S -passes=loop-unroll -mcpu=nehalem | FileCheck %s2; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=0 | FileCheck -check-prefix=CHECK-NOUNRL %s3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"4target triple = "x86_64-unknown-linux-gnu"5 6define void @foo(ptr noalias nocapture readnone %ip, double %alpha, ptr noalias nocapture %a, ptr noalias nocapture readonly %b) #0 {7entry:8  br label %vector.body9 10vector.body:                                      ; preds = %vector.body, %entry11  %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]12  %0 = getelementptr inbounds double, ptr %b, i64 %index13  %wide.load = load <2 x double>, ptr %0, align 814  %.sum9 = or i64 %index, 215  %1 = getelementptr double, ptr %b, i64 %.sum916  %wide.load8 = load <2 x double>, ptr %1, align 817  %2 = fadd <2 x double> %wide.load, <double 1.000000e+00, double 1.000000e+00>18  %3 = fadd <2 x double> %wide.load8, <double 1.000000e+00, double 1.000000e+00>19  %4 = getelementptr inbounds double, ptr %a, i64 %index20  store <2 x double> %2, ptr %4, align 821  %.sum10 = or i64 %index, 222  %5 = getelementptr double, ptr %a, i64 %.sum1023  store <2 x double> %3, ptr %5, align 824  %index.next = add i64 %index, 425  %6 = icmp eq i64 %index.next, 160026  br i1 %6, label %for.end, label %vector.body27 28; FIXME: We should probably unroll this loop by a factor of 2, but the cost29; model needs to be fixed to account for instructions likely to be folded30; as part of an addressing mode.31; CHECK-LABEL: @foo32; CHECK-NOUNRL-LABEL: @foo33 34for.end:                                          ; preds = %vector.body35  ret void36}37 38define void @bar(ptr noalias nocapture readnone %ip, double %alpha, ptr noalias nocapture %a, ptr noalias nocapture readonly %b) #0 {39entry:40  br label %vector.body41 42vector.body:                                      ; preds = %vector.body, %entry43  %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]44  %v0 = getelementptr inbounds double, ptr %b, i64 %index45  %wide.load = load <2 x double>, ptr %v0, align 846  %v4 = fadd <2 x double> %wide.load, <double 1.000000e+00, double 1.000000e+00>47  %v5 = fmul <2 x double> %v4, <double 8.000000e+00, double 8.000000e+00>48  %v6 = getelementptr inbounds double, ptr %a, i64 %index49  store <2 x double> %v5, ptr %v6, align 850  %index.next = add i64 %index, 251  %v10 = icmp eq i64 %index.next, 160052  br i1 %v10, label %for.end, label %vector.body53 54; FIXME: We should probably unroll this loop by a factor of 2, but the cost55; model needs to first to fixed to account for instructions likely to be folded56; as part of an addressing mode.57 58; CHECK-LABEL: @bar59; CHECK: fadd60; CHECK-NEXT: fmul61; CHECK: fadd62; CHECK-NEXT: fmul63 64; CHECK-NOUNRL-LABEL: @bar65; CHECK-NOUNRL: fadd66; CHECK-NOUNRL-NEXT: fmul67; CHECK-NOUNRL-NOT: fadd68 69for.end:                                          ; preds = %vector.body70  ret void71}72 73define zeroext i16 @test1(ptr nocapture readonly %arr, i32 %n) #0 {74entry:75  %cmp25 = icmp eq i32 %n, 076  br i1 %cmp25, label %for.end, label %for.body77 78for.body:                                         ; preds = %entry, %for.body79  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]80  %reduction.026 = phi i16 [ %add14, %for.body ], [ 0, %entry ]81  %arrayidx = getelementptr inbounds i16, ptr %arr, i64 %indvars.iv82  %0 = load i16, ptr %arrayidx, align 283  %mul = shl i16 %0, 184  %add = add i16 %mul, %reduction.02685  %sext = mul i64 %indvars.iv, 1288490188886  %idxprom3 = ashr exact i64 %sext, 3287  %arrayidx4 = getelementptr inbounds i16, ptr %arr, i64 %idxprom388  %1 = load i16, ptr %arrayidx4, align 289  %mul2 = shl i16 %1, 190  %add7 = add i16 %add, %mul291  %sext28 = mul i64 %indvars.iv, 2147483648092  %idxprom10 = ashr exact i64 %sext28, 3293  %arrayidx11 = getelementptr inbounds i16, ptr %arr, i64 %idxprom1094  %2 = load i16, ptr %arrayidx11, align 295  %mul3 = shl i16 %2, 196  %add14 = add i16 %add7, %mul397  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 198  %lftr.wideiv = trunc i64 %indvars.iv.next to i3299  %exitcond = icmp eq i32 %lftr.wideiv, %n100  br i1 %exitcond, label %for.end, label %for.body101 102for.end:                                          ; preds = %for.body, %entry103  %reduction.0.lcssa = phi i16 [ 0, %entry ], [ %add14, %for.body ]104  ret i16 %reduction.0.lcssa105 106; This loop is too large to be partially unrolled (size=16)107 108; CHECK-LABEL: @test1109; CHECK: br110; CHECK: br111; CHECK: br112; CHECK: br113; CHECK-NOT: br114 115; CHECK-NOUNRL-LABEL: @test1116; CHECK-NOUNRL: br117; CHECK-NOUNRL: br118; CHECK-NOUNRL: br119; CHECK-NOUNRL: br120; CHECK-NOUNRL-NOT: br121}122 123attributes #0 = { nounwind uwtable }124 125