2 ; RUN: opt -loop-vectorize -S -mcpu=skx --debug-only=loop-vectorize < %s 2>&1| FileCheck %s
\r
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
\r
5 target triple = "x86_64-unknown-linux-gnu"
\r
7 @A = global [10240 x i64] zeroinitializer, align 16
\r
8 @B = global [10240 x i64] zeroinitializer, align 16
\r
10 ; Function Attrs: nounwind uwtable
\r
11 define void @load_i64_stride2() {
\r
12 ;CHECK-LABEL: load_i64_stride2
\r
13 ;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load
\r
14 ;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load
\r
15 ;CHECK: Found an estimated cost of 1 for VF 4 For instruction: %1 = load
\r
16 ;CHECK: Found an estimated cost of 2 for VF 8 For instruction: %1 = load
\r
20 for.body: ; preds = %for.body, %entry
\r
21 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
\r
22 %0 = shl nsw i64 %indvars.iv, 1
\r
23 %arrayidx = getelementptr inbounds [10240 x i64], [10240 x i64]* @A, i64 0, i64 %0
\r
24 %1 = load i64, i64* %arrayidx, align 16
\r
25 %arrayidx2 = getelementptr inbounds [10240 x i64], [10240 x i64]* @B, i64 0, i64 %indvars.iv
\r
26 store i64 %1, i64* %arrayidx2, align 8
\r
27 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
\r
28 %exitcond = icmp eq i64 %indvars.iv.next, 1024
\r
29 br i1 %exitcond, label %for.end, label %for.body
\r
31 for.end: ; preds = %for.body
\r
35 define void @load_i64_stride3() {
\r
36 ;CHECK-LABEL: load_i64_stride3
\r
37 ;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load
\r
38 ;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load
\r
39 ;CHECK: Found an estimated cost of 2 for VF 4 For instruction: %1 = load
\r
40 ;CHECK: Found an estimated cost of 3 for VF 8 For instruction: %1 = load
\r
44 for.body: ; preds = %for.body, %entry
\r
45 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
\r
46 %0 = mul nsw i64 %indvars.iv, 3
\r
47 %arrayidx = getelementptr inbounds [10240 x i64], [10240 x i64]* @A, i64 0, i64 %0
\r
48 %1 = load i64, i64* %arrayidx, align 16
\r
49 %arrayidx2 = getelementptr inbounds [10240 x i64], [10240 x i64]* @B, i64 0, i64 %indvars.iv
\r
50 store i64 %1, i64* %arrayidx2, align 8
\r
51 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
\r
52 %exitcond = icmp eq i64 %indvars.iv.next, 1024
\r
53 br i1 %exitcond, label %for.end, label %for.body
\r
55 for.end: ; preds = %for.body
\r
59 define void @load_i64_stride4() {
\r
60 ;CHECK-LABEL: load_i64_stride4
\r
61 ;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load
\r
62 ;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load
\r
63 ;CHECK: Found an estimated cost of 2 for VF 4 For instruction: %1 = load
\r
64 ;CHECK: Found an estimated cost of 5 for VF 8 For instruction: %1 = load
\r
68 for.body: ; preds = %for.body, %entry
\r
69 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
\r
70 %0 = mul nsw i64 %indvars.iv, 4
\r
71 %arrayidx = getelementptr inbounds [10240 x i64], [10240 x i64]* @A, i64 0, i64 %0
\r
72 %1 = load i64, i64* %arrayidx, align 16
\r
73 %arrayidx2 = getelementptr inbounds [10240 x i64], [10240 x i64]* @B, i64 0, i64 %indvars.iv
\r
74 store i64 %1, i64* %arrayidx2, align 8
\r
75 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
\r
76 %exitcond = icmp eq i64 %indvars.iv.next, 1024
\r
77 br i1 %exitcond, label %for.end, label %for.body
\r
79 for.end: ; preds = %for.body
\r