• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; REQUIRES: asserts
2; RUN: opt -loop-vectorize -S -mattr=avx512f --debug-only=loop-vectorize < %s 2>&1 | FileCheck %s
3
4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5target triple = "x86_64-unknown-linux-gnu"
6
7@A = global [10240 x i32] zeroinitializer, align 16
8@B = global [10240 x i32] zeroinitializer, align 16
9
10; Function Attrs: nounwind uwtable
11define void @load_i32_interleave4() {
12;CHECK-LABEL: load_i32_interleave4
13;CHECK: Found an estimated cost of 1 for VF 1 For instruction:   %0 = load
14;CHECK: Found an estimated cost of 5 for VF 2 For instruction:   %0 = load
15;CHECK: Found an estimated cost of 5 for VF 4 For instruction:   %0 = load
16;CHECK: Found an estimated cost of 8 for VF 8 For instruction:   %0 = load
17;CHECK: Found an estimated cost of 22 for VF 16 For instruction:   %0 = load
18entry:
19  br label %for.body
20
21for.cond.cleanup:                                 ; preds = %for.body
22  ret void
23
24for.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  %1 = or i64 %indvars.iv, 1
29  %arrayidx2 = getelementptr inbounds [10240 x i32], [10240 x i32]* @A, i64 0, i64 %1
30  %2 = load i32, i32* %arrayidx2, align 4
31  %add3 = add nsw i32 %2, %0
32  %3 = or i64 %indvars.iv, 2
33  %arrayidx6 = getelementptr inbounds [10240 x i32], [10240 x i32]* @A, i64 0, i64 %3
34  %4 = load i32, i32* %arrayidx6, align 8
35  %add7 = add nsw i32 %add3, %4
36  %5 = or i64 %indvars.iv, 3
37  %arrayidx10 = getelementptr inbounds [10240 x i32], [10240 x i32]* @A, i64 0, i64 %5
38  %6 = load i32, i32* %arrayidx10, align 4
39  %add11 = add nsw i32 %add7, %6
40  %arrayidx13 = getelementptr inbounds [10240 x i32], [10240 x i32]* @B, i64 0, i64 %indvars.iv
41  store i32 %add11, i32* %arrayidx13, align 16
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
45}
46
47define void @load_i32_interleave5() {
48;CHECK-LABEL: load_i32_interleave5
49;CHECK: Found an estimated cost of 1 for VF 1 For instruction:   %0 = load
50;CHECK: Found an estimated cost of 6 for VF 2 For instruction:   %0 = load
51;CHECK: Found an estimated cost of 9 for VF 4 For instruction:   %0 = load
52;CHECK: Found an estimated cost of 18 for VF 8 For instruction:   %0 = load
53;CHECK: Found an estimated cost of 35 for VF 16 For instruction:   %0 = load
54entry:
55  br label %for.body
56
57for.cond.cleanup:                                 ; preds = %for.body
58  ret void
59
60for.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  %1 = add nuw nsw i64 %indvars.iv, 1
65  %arrayidx2 = getelementptr inbounds [10240 x i32], [10240 x i32]* @A, i64 0, i64 %1
66  %2 = load i32, i32* %arrayidx2, align 4
67  %add3 = add nsw i32 %2, %0
68  %3 = add nuw nsw i64 %indvars.iv, 2
69  %arrayidx6 = getelementptr inbounds [10240 x i32], [10240 x i32]* @A, i64 0, i64 %3
70  %4 = load i32, i32* %arrayidx6, align 4
71  %add7 = add nsw i32 %add3, %4
72  %5 = add nuw nsw i64 %indvars.iv, 3
73  %arrayidx10 = getelementptr inbounds [10240 x i32], [10240 x i32]* @A, i64 0, i64 %5
74  %6 = load i32, i32* %arrayidx10, align 4
75  %add11 = add nsw i32 %add7, %6
76  %7 = add nuw nsw i64 %indvars.iv, 4
77  %arrayidx14 = getelementptr inbounds [10240 x i32], [10240 x i32]* @A, i64 0, i64 %7
78  %8 = load i32, i32* %arrayidx14, align 4
79  %add15 = add nsw i32 %add11, %8
80  %arrayidx17 = getelementptr inbounds [10240 x i32], [10240 x i32]* @B, i64 0, i64 %indvars.iv
81  store i32 %add15, i32* %arrayidx17, 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
85}
86