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