Rename getMaximumUnrollFactor -> getMaxInterleaveFactor; also rename option names...
[oota-llvm.git] / test / Transforms / LoopVectorize / runtime-limit.ll
1 ; RUN: opt < %s  -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine -S | FileCheck %s
2
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4 target triple = "x86_64-apple-macosx10.8.0"
5
6 ; We are vectorizing with 6 runtime checks.
7 ;CHECK-LABEL: func1x6(
8 ;CHECK: <4 x i32>
9 ;CHECK: ret
10 define i32 @func1x6(i32* nocapture %out, i32* nocapture %A, i32* nocapture %B, i32* nocapture %C, i32* nocapture %D, i32* nocapture %E, i32* nocapture %F) {
11 entry:
12   br label %for.body
13
14 for.body:                                         ; preds = %for.body, %entry
15   %i.016 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
16   %arrayidx = getelementptr inbounds i32* %A, i64 %i.016
17   %0 = load i32* %arrayidx, align 4
18   %arrayidx1 = getelementptr inbounds i32* %B, i64 %i.016
19   %1 = load i32* %arrayidx1, align 4
20   %add = add nsw i32 %1, %0
21   %arrayidx2 = getelementptr inbounds i32* %C, i64 %i.016
22   %2 = load i32* %arrayidx2, align 4
23   %add3 = add nsw i32 %add, %2
24   %arrayidx4 = getelementptr inbounds i32* %E, i64 %i.016
25   %3 = load i32* %arrayidx4, align 4
26   %add5 = add nsw i32 %add3, %3
27   %arrayidx6 = getelementptr inbounds i32* %F, i64 %i.016
28   %4 = load i32* %arrayidx6, align 4
29   %add7 = add nsw i32 %add5, %4
30   %arrayidx8 = getelementptr inbounds i32* %out, i64 %i.016
31   store i32 %add7, i32* %arrayidx8, align 4
32   %inc = add i64 %i.016, 1
33   %exitcond = icmp eq i64 %inc, 256
34   br i1 %exitcond, label %for.end, label %for.body
35
36 for.end:                                          ; preds = %for.body
37   ret i32 undef
38 }
39
40 ; We are not vectorizing with 12 runtime checks.
41 ;CHECK-LABEL: func2x6(
42 ;CHECK-NOT: <4 x i32>
43 ;CHECK: ret
44 define i32 @func2x6(i32* nocapture %out, i32* nocapture %out2, i32* nocapture %A, i32* nocapture %B, i32* nocapture %C, i32* nocapture %D, i32* nocapture %E, i32* nocapture %F) {
45 entry:
46   br label %for.body
47
48 for.body:                                         ; preds = %for.body, %entry
49   %i.037 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
50   %arrayidx = getelementptr inbounds i32* %A, i64 %i.037
51   %0 = load i32* %arrayidx, align 4
52   %arrayidx1 = getelementptr inbounds i32* %B, i64 %i.037
53   %1 = load i32* %arrayidx1, align 4
54   %add = add nsw i32 %1, %0
55   %arrayidx2 = getelementptr inbounds i32* %C, i64 %i.037
56   %2 = load i32* %arrayidx2, align 4
57   %add3 = add nsw i32 %add, %2
58   %arrayidx4 = getelementptr inbounds i32* %E, i64 %i.037
59   %3 = load i32* %arrayidx4, align 4
60   %add5 = add nsw i32 %add3, %3
61   %arrayidx6 = getelementptr inbounds i32* %F, i64 %i.037
62   %4 = load i32* %arrayidx6, align 4
63   %add7 = add nsw i32 %add5, %4
64   %arrayidx8 = getelementptr inbounds i32* %out, i64 %i.037
65   store i32 %add7, i32* %arrayidx8, align 4
66   %5 = load i32* %arrayidx, align 4
67   %6 = load i32* %arrayidx1, align 4
68   %add11 = add nsw i32 %6, %5
69   %7 = load i32* %arrayidx2, align 4
70   %add13 = add nsw i32 %add11, %7
71   %8 = load i32* %arrayidx4, align 4
72   %add15 = add nsw i32 %add13, %8
73   %9 = load i32* %arrayidx6, align 4
74   %add17 = add nsw i32 %add15, %9
75   %arrayidx18 = getelementptr inbounds i32* %out2, i64 %i.037
76   store i32 %add17, i32* %arrayidx18, align 4
77   %inc = add i64 %i.037, 1
78   %exitcond = icmp eq i64 %inc, 256
79   br i1 %exitcond, label %for.end, label %for.body
80
81 for.end:                                          ; preds = %for.body
82   ret i32 undef
83 }
84