Home | History | Annotate | Download | only in LoopVectorize
      1 ; RUN: opt < %s  -loop-vectorize -force-vector-width=4 -force-vector-interleave=1 -instcombine -S | FileCheck %s
      2 
      3 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
      4 target triple = "arm64-apple-ios5.0.0"
      5 
      6 ; CHECK-LABEL: @foo(
      7 define void @foo(float* noalias %a, float* noalias %b, float* noalias %c, i32 %N) {
      8 entry:
      9   %cmp.4 = icmp sgt i32 %N, 0
     10   br i1 %cmp.4, label %for.body.preheader, label %for.end
     11 
     12 for.body.preheader:                               ; preds = %entry
     13   br label %for.body
     14 
     15 for.body:                                         ; preds = %for.body.preheader, %for.body
     16   %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
     17 
     18 ; Check that we don't lose !nontemporal hint when vectorizing loads.
     19 ; CHECK: %wide.load{{[0-9]*}} = load <4 x float>, <4 x float>* %{{[0-9]+}}, align 4, !nontemporal !0
     20   %arrayidx = getelementptr inbounds float, float* %b, i64 %indvars.iv
     21   %0 = load float, float* %arrayidx, align 4, !nontemporal !0
     22 
     23 ; Check that we don't introduce !nontemporal hint when the original scalar loads didn't have it.
     24 ; CHECK: %wide.load{{[0-9]+}} = load <4 x float>, <4 x float>* %{{[0-9]+}}, align 4{{$}}
     25   %arrayidx2 = getelementptr inbounds float, float* %c, i64 %indvars.iv
     26   %1 = load float, float* %arrayidx2, align 4
     27   %add = fadd float %0, %1
     28 
     29 ; Check that we don't lose !nontemporal hint when vectorizing stores.
     30 ; CHECK: store <4 x float> %{{[0-9]+}}, <4 x float>* %{{[0-9]+}}, align 4, !nontemporal !0
     31   %arrayidx4 = getelementptr inbounds float, float* %a, i64 %indvars.iv
     32   store float %add, float* %arrayidx4, align 4, !nontemporal !0
     33 
     34   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
     35   %lftr.wideiv = trunc i64 %indvars.iv.next to i32
     36   %exitcond = icmp eq i32 %lftr.wideiv, %N
     37   br i1 %exitcond, label %for.end.loopexit, label %for.body
     38 
     39 for.end.loopexit:                                 ; preds = %for.body
     40   br label %for.end
     41 
     42 for.end:                                          ; preds = %for.end.loopexit, %entry
     43 ; CHECK: ret void
     44   ret void
     45 }
     46 
     47 !0 = !{i32 1}
     48