1; RUN: opt < %s -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine -S | FileCheck %s 2 3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 4;CHECK-LABEL: @foo( 5;CHECK: fadd fast <4 x float> 6;CHECK: ret 7define float @foo(float* nocapture %A, i32* nocapture %n) nounwind uwtable readonly ssp { 8entry: 9 br label %for.body 10 11for.body: ; preds = %for.body, %entry 12 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 13 %sum.04 = phi float [ 0.000000e+00, %entry ], [ %add, %for.body ] 14 %arrayidx = getelementptr inbounds float, float* %A, i64 %indvars.iv 15 %0 = load float, float* %arrayidx, align 4 16 %add = fadd fast float %sum.04, %0 17 %indvars.iv.next = add i64 %indvars.iv, 1 18 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 19 %exitcond = icmp eq i32 %lftr.wideiv, 200 20 br i1 %exitcond, label %for.end, label %for.body 21 22for.end: ; preds = %for.body 23 ret float %add 24} 25 26;CHECK-LABEL: @foosub( 27;CHECK: fsub fast <4 x float> 28;CHECK: ret 29define float @foosub(float* nocapture %A, i32* nocapture %n) nounwind uwtable readonly ssp { 30entry: 31 br label %for.body 32 33for.body: ; preds = %for.body, %entry 34 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 35 %sum.04 = phi float [ 0.000000e+00, %entry ], [ %sub, %for.body ] 36 %arrayidx = getelementptr inbounds float, float* %A, i64 %indvars.iv 37 %0 = load float, float* %arrayidx, align 4 38 %sub = fsub fast float %sum.04, %0 39 %indvars.iv.next = add i64 %indvars.iv, 1 40 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 41 %exitcond = icmp eq i32 %lftr.wideiv, 200 42 br i1 %exitcond, label %for.end, label %for.body 43 44for.end: ; preds = %for.body 45 ret float %sub 46} 47 48;CHECK-LABEL: @foodiv( 49;CHECK: fdiv fast <4 x float> 50;CHECK: ret 51define float @foodiv(float* nocapture %A, i32* nocapture %n) nounwind uwtable readonly ssp { 52entry: 53 br label %for.body 54 55for.body: ; preds = %for.body, %entry 56 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 57 %sum.04 = phi float [ 1.000000e+00, %entry ], [ %sub, %for.body ] 58 %arrayidx = getelementptr inbounds float, float* %A, i64 %indvars.iv 59 %0 = load float, float* %arrayidx, align 4 60 %sub = fdiv fast float %sum.04, %0 61 %indvars.iv.next = add i64 %indvars.iv, 1 62 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 63 %exitcond = icmp eq i32 %lftr.wideiv, 200 64 br i1 %exitcond, label %for.end, label %for.body 65 66for.end: ; preds = %for.body 67 ret float %sub 68} 69 70;CHECK-LABEL: @foonodiv( 71;CHECK-NOT: fdiv fast <4 x float> 72;CHECK: ret 73define float @foonodiv(float* nocapture %A, i32* nocapture %n) nounwind uwtable readonly ssp { 74entry: 75 br label %for.body 76 77for.body: ; preds = %for.body, %entry 78 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 79 %sum.04 = phi float [ 1.000000e+00, %entry ], [ %sub, %for.body ] 80 %arrayidx = getelementptr inbounds float, float* %A, i64 %indvars.iv 81 %0 = load float, float* %arrayidx, align 4 82 %sub = fdiv fast float %0, %sum.04 83 %indvars.iv.next = add i64 %indvars.iv, 1 84 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 85 %exitcond = icmp eq i32 %lftr.wideiv, 200 86 br i1 %exitcond, label %for.end, label %for.body 87 88for.end: ; preds = %for.body 89 ret float %sub 90} 91