1; RUN: opt -basicaa -loop-vectorize -S -mcpu=core-avx2 < %s | FileCheck %s 2 3;float inc = 0.5; 4;void foo(float *A, unsigned N) { 5; 6; for (unsigned i=0; i<N; i++){ 7; A[i] += inc; 8; } 9;} 10 11; CHECK-LABEL: foo 12; CHECK: vector.body 13; CHECK: load <8 x float> 14; CHECK: fadd <8 x float> 15; CHECK: store <8 x float> 16 17target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 18target triple = "x86_64-unknown-linux-gnu" 19 20@inc = global float 5.000000e-01, align 4 21 22define void @foo(float* nocapture %A, i32 %N) #0 { 23entry: 24 %cmp3 = icmp eq i32 %N, 0 25 br i1 %cmp3, label %for.end, label %for.body.preheader 26 27for.body.preheader: ; preds = %entry 28 br label %for.body 29 30for.body: ; preds = %for.body.preheader, %for.body 31 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ] 32 %0 = load float, float* @inc, align 4 33 %arrayidx = getelementptr inbounds float, float* %A, i64 %indvars.iv 34 %1 = load float, float* %arrayidx, align 4 35 %add = fadd float %0, %1 36 store float %add, float* %arrayidx, align 4 37 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 38 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 39 %exitcond = icmp eq i32 %lftr.wideiv, %N 40 br i1 %exitcond, label %for.end.loopexit, label %for.body 41 42for.end.loopexit: ; preds = %for.body 43 br label %for.end 44 45for.end: ; preds = %for.end.loopexit, %entry 46 ret void 47} 48