1 ; RUN: opt -passes=loop-vectorize -S -mcpu=core-avx2 < %s | FileCheck %s
4 ;void foo(ptr A, unsigned N) {
6 ; for (unsigned i=0; i<N; i++){
13 ; CHECK: load <8 x float>
14 ; CHECK: fadd <8 x float>
15 ; CHECK: store <8 x float>
17 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
18 target triple = "x86_64-unknown-linux-gnu"
20 @inc = global float 5.000000e-01, align 4
22 define void @foo(ptr nocapture %A, i32 %N) #0 {
24 %cmp3 = icmp eq i32 %N, 0
25 br i1 %cmp3, label %for.end, label %for.body.preheader
27 for.body.preheader: ; preds = %entry
30 for.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, ptr @inc, align 4
33 %arrayidx = getelementptr inbounds float, ptr %A, i64 %indvars.iv
34 %1 = load float, ptr %arrayidx, align 4
35 %add = fadd float %0, %1
36 store float %add, ptr %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
42 for.end.loopexit: ; preds = %for.body
45 for.end: ; preds = %for.end.loopexit, %entry