1 ; RUN: opt < %s -loop-vectorize -mtriple=arm64-none-linux-gnu -mattr=+neon -S | FileCheck %s
2 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
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
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>
17 %cmp10 = icmp sgt i32 %size, 0
18 br i1 %cmp10, label %for.body.preheader, label %for.end
20 for.body.preheader: ; preds = %entry
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
37 for.end.loopexit: ; preds = %for.body
40 for.end: ; preds = %for.end.loopexit, %entry