1 ; RUN: opt < %s -passes=loop-vectorize,dce,instcombine -pass-remarks=loop-vectorize -pass-remarks-analysis=loop-vectorize -pass-remarks-missed=loop-vectorize -S 2>&1 | FileCheck %s
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"
5 target triple = "x86_64-unknown-linux"
7 ; First loop produced diagnostic pass remark.
8 ;CHECK: remark: {{.*}}:0:0: vectorized loop (vectorization width: 4, interleaved count: 2)
9 ; Second loop produces diagnostic analysis remark.
10 ;CHECK: remark: {{.*}}:0:0: vectorized loop (vectorization width: 4, interleaved count: 1)
12 ; We are vectorizing with 6 runtime checks.
13 ;CHECK-LABEL: func1x6(
16 define i32 @func1x6(ptr nocapture %out, ptr nocapture %A, ptr nocapture %B, ptr nocapture %C, ptr nocapture %D, ptr nocapture %E, ptr nocapture %F) {
20 for.body: ; preds = %for.body, %entry
21 %i.016 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
22 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %i.016
23 %0 = load i32, ptr %arrayidx, align 4
24 %arrayidx1 = getelementptr inbounds i32, ptr %B, i64 %i.016
25 %1 = load i32, ptr %arrayidx1, align 4
26 %add = add nsw i32 %1, %0
27 %arrayidx2 = getelementptr inbounds i32, ptr %C, i64 %i.016
28 %2 = load i32, ptr %arrayidx2, align 4
29 %add3 = add nsw i32 %add, %2
30 %arrayidx4 = getelementptr inbounds i32, ptr %E, i64 %i.016
31 %3 = load i32, ptr %arrayidx4, align 4
32 %add5 = add nsw i32 %add3, %3
33 %arrayidx6 = getelementptr inbounds i32, ptr %F, i64 %i.016
34 %4 = load i32, ptr %arrayidx6, align 4
35 %add7 = add nsw i32 %add5, %4
36 %arrayidx8 = getelementptr inbounds i32, ptr %out, i64 %i.016
37 store i32 %add7, ptr %arrayidx8, align 4
38 %inc = add i64 %i.016, 1
39 %exitcond = icmp eq i64 %inc, 256
40 br i1 %exitcond, label %for.end, label %for.body
42 for.end: ; preds = %for.body
46 ; We are vectorizing with 12 runtime checks.
47 ;CHECK-LABEL: func2x6(
50 define i32 @func2x6(ptr nocapture %out, ptr nocapture %out2, ptr nocapture %A, ptr nocapture %B, ptr nocapture %C, ptr nocapture %D, ptr nocapture %E, ptr nocapture %F) {
54 for.body: ; preds = %for.body, %entry
55 %i.037 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
56 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %i.037
57 %0 = load i32, ptr %arrayidx, align 4
58 %arrayidx1 = getelementptr inbounds i32, ptr %B, i64 %i.037
59 %1 = load i32, ptr %arrayidx1, align 4
60 %add = add nsw i32 %1, %0
61 %arrayidx2 = getelementptr inbounds i32, ptr %C, i64 %i.037
62 %2 = load i32, ptr %arrayidx2, align 4
63 %add3 = add nsw i32 %add, %2
64 %arrayidx4 = getelementptr inbounds i32, ptr %E, i64 %i.037
65 %3 = load i32, ptr %arrayidx4, align 4
66 %add5 = add nsw i32 %add3, %3
67 %arrayidx6 = getelementptr inbounds i32, ptr %F, i64 %i.037
68 %4 = load i32, ptr %arrayidx6, align 4
69 %add7 = add nsw i32 %add5, %4
70 %arrayidx8 = getelementptr inbounds i32, ptr %out, i64 %i.037
71 store i32 %add7, ptr %arrayidx8, align 4
72 %5 = load i32, ptr %arrayidx, align 4
73 %6 = load i32, ptr %arrayidx1, align 4
74 %add11 = add nsw i32 %6, %5
75 %7 = load i32, ptr %arrayidx2, align 4
76 %add13 = add nsw i32 %add11, %7
77 %8 = load i32, ptr %arrayidx4, align 4
78 %add15 = add nsw i32 %add13, %8
79 %9 = load i32, ptr %arrayidx6, align 4
80 %add17 = add nsw i32 %add15, %9
81 %arrayidx18 = getelementptr inbounds i32, ptr %out2, i64 %i.037
82 store i32 %add17, ptr %arrayidx18, align 4
83 %inc = add i64 %i.037, 1
84 %exitcond = icmp eq i64 %inc, 256
85 br i1 %exitcond, label %for.end, label %for.body
87 for.end: ; preds = %for.body