2 ; RUN: opt -loop-vectorize -S -mattr=avx512f --debug-only=loop-vectorize < %s 2>&1| FileCheck %s
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 @A = global [10240 x i32] zeroinitializer, align 16
8 @B = global [10240 x i32] zeroinitializer, align 16
10 ; Function Attrs: nounwind uwtable
11 define void @store_i32_interleave4() {
12 ;CHECK-LABEL: store_i32_interleave4
13 ;CHECK: Found an estimated cost of 1 for VF 1 For instruction: store i32 %add16
14 ;CHECK: Found an estimated cost of 5 for VF 2 For instruction: store i32 %add16
15 ;CHECK: Found an estimated cost of 5 for VF 4 For instruction: store i32 %add16
16 ;CHECK: Found an estimated cost of 11 for VF 8 For instruction: store i32 %add16
17 ;CHECK: Found an estimated cost of 22 for VF 16 For instruction: store i32 %add16
21 for.cond.cleanup: ; preds = %for.body
24 for.body: ; preds = %entry, %for.body
25 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
26 %arrayidx = getelementptr inbounds [10240 x i32], [10240 x i32]* @A, i64 0, i64 %indvars.iv
27 %0 = load i32, i32* %arrayidx, align 16
28 %arrayidx2 = getelementptr inbounds [10240 x i32], [10240 x i32]* @B, i64 0, i64 %indvars.iv
29 store i32 %0, i32* %arrayidx2, align 16
30 %add = add nsw i32 %0, 1
31 %1 = or i64 %indvars.iv, 1
32 %arrayidx7 = getelementptr inbounds [10240 x i32], [10240 x i32]* @B, i64 0, i64 %1
33 store i32 %add, i32* %arrayidx7, align 4
34 %add10 = add nsw i32 %0, 2
35 %2 = or i64 %indvars.iv, 2
36 %arrayidx13 = getelementptr inbounds [10240 x i32], [10240 x i32]* @B, i64 0, i64 %2
37 store i32 %add10, i32* %arrayidx13, align 8
38 %add16 = add nsw i32 %0, 3
39 %3 = or i64 %indvars.iv, 3
40 %arrayidx19 = getelementptr inbounds [10240 x i32], [10240 x i32]* @B, i64 0, i64 %3
41 store i32 %add16, i32* %arrayidx19, align 4
42 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 4
43 %cmp = icmp slt i64 %indvars.iv.next, 1024
44 br i1 %cmp, label %for.body, label %for.cond.cleanup
47 define void @store_i32_interleave5() {
48 ;CHECK-LABEL: store_i32_interleave5
49 ;CHECK: Found an estimated cost of 1 for VF 1 For instruction: store i32 %add22
50 ;CHECK: Found an estimated cost of 7 for VF 2 For instruction: store i32 %add22
51 ;CHECK: Found an estimated cost of 14 for VF 4 For instruction: store i32 %add22
52 ;CHECK: Found an estimated cost of 21 for VF 8 For instruction: store i32 %add22
53 ;CHECK: Found an estimated cost of 35 for VF 16 For instruction: store i32 %add22
57 for.cond.cleanup: ; preds = %for.body
60 for.body: ; preds = %entry, %for.body
61 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
62 %arrayidx = getelementptr inbounds [10240 x i32], [10240 x i32]* @A, i64 0, i64 %indvars.iv
63 %0 = load i32, i32* %arrayidx, align 4
64 %arrayidx2 = getelementptr inbounds [10240 x i32], [10240 x i32]* @B, i64 0, i64 %indvars.iv
65 store i32 %0, i32* %arrayidx2, align 4
66 %add = add nsw i32 %0, 1
67 %1 = add nuw nsw i64 %indvars.iv, 1
68 %arrayidx7 = getelementptr inbounds [10240 x i32], [10240 x i32]* @B, i64 0, i64 %1
69 store i32 %add, i32* %arrayidx7, align 4
70 %add10 = add nsw i32 %0, 2
71 %2 = add nuw nsw i64 %indvars.iv, 2
72 %arrayidx13 = getelementptr inbounds [10240 x i32], [10240 x i32]* @B, i64 0, i64 %2
73 store i32 %add10, i32* %arrayidx13, align 4
74 %add16 = add nsw i32 %0, 3
75 %3 = add nuw nsw i64 %indvars.iv, 3
76 %arrayidx19 = getelementptr inbounds [10240 x i32], [10240 x i32]* @B, i64 0, i64 %3
77 store i32 %add16, i32* %arrayidx19, align 4
78 %add22 = add nsw i32 %0, 4
79 %4 = add nuw nsw i64 %indvars.iv, 4
80 %arrayidx25 = getelementptr inbounds [10240 x i32], [10240 x i32]* @B, i64 0, i64 %4
81 store i32 %add22, i32* %arrayidx25, align 4
82 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 5
83 %cmp = icmp slt i64 %indvars.iv.next, 1024
84 br i1 %cmp, label %for.body, label %for.cond.cleanup