1 ; RUN: opt < %s -loop-vectorize -mtriple=aarch64-none-linux-gnu -mattr=+neon -S | FileCheck %s 2 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128" 3 4 ; Function Attrs: nounwind 5 define i32* @array_add(i32* noalias nocapture readonly %a, i32* noalias nocapture readonly %b, i32* %c, i32 %size) { 6 ;CHECK-LABEL: array_add 7 ;CHECK: load <4 x i32> 8 ;CHECK: load <4 x i32> 9 ;CHECK: load <4 x i32> 10 ;CHECK: load <4 x i32> 11 ;CHECK: add nsw <4 x i32> 12 ;CHECK: add nsw <4 x i32> 13 ;CHECK: store <4 x i32> 14 ;CHECK: store <4 x i32> 15 ;CHECK: ret 16 entry: 17 %cmp10 = icmp sgt i32 %size, 0 18 br i1 %cmp10, label %for.body.preheader, label %for.end 19 20 for.body.preheader: ; preds = %entry 21 br label %for.body 22 23 for.body: ; preds = %for.body.preheader, %for.body 24 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ] 25 %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv 26 %0 = load i32, i32* %arrayidx, align 4 27 %arrayidx2 = getelementptr inbounds i32, i32* %b, i64 %indvars.iv 28 %1 = load i32, i32* %arrayidx2, align 4 29 %add = add nsw i32 %1, %0 30 %arrayidx4 = getelementptr inbounds i32, i32* %c, i64 %indvars.iv 31 store i32 %add, i32* %arrayidx4, align 4 32 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 33 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 34 %exitcond = icmp eq i32 %lftr.wideiv, %size 35 br i1 %exitcond, label %for.end.loopexit, label %for.body 36 37 for.end.loopexit: ; preds = %for.body 38 br label %for.end 39 40 for.end: ; preds = %for.end.loopexit, %entry 41 ret i32* %c 42 } 43