2 ; RUN: opt -loop-vectorize -S -mcpu=core-avx2 --debug-only=loop-vectorize -vectorizer-maximize-bandwidth < %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 ; Function Attrs: norecurse nounwind uwtable
8 define void @doit_stride3(i8* nocapture %Ptr, i32 %Nels) local_unnamed_addr {
9 ;CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: store i8 %conv4
10 ;CHECK: LV: Found an estimated cost of 8 for VF 2 For instruction: store i8 %conv4
11 ;CHECK: LV: Found an estimated cost of 9 for VF 4 For instruction: store i8 %conv4
12 ;CHECK: LV: Found an estimated cost of 12 for VF 8 For instruction: store i8 %conv4
13 ;CHECK: LV: Found an estimated cost of 13 for VF 16 For instruction: store i8 %conv4
14 ;CHECK: LV: Found an estimated cost of 16 for VF 32 For instruction: store i8 %conv4
16 %cmp14 = icmp sgt i32 %Nels, 0
17 br i1 %cmp14, label %for.body.lr.ph, label %for.end
20 %conv = trunc i32 %Nels to i8
21 %conv1 = shl i8 %conv, 1
22 %conv4 = shl i8 %conv, 2
26 %i.016 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
27 %Ptr.addr.015 = phi i8* [ %Ptr, %for.body.lr.ph ], [ %incdec.ptr5, %for.body ]
28 %incdec.ptr = getelementptr inbounds i8, i8* %Ptr.addr.015, i64 1
29 store i8 %conv, i8* %Ptr.addr.015, align 1
30 %incdec.ptr2 = getelementptr inbounds i8, i8* %Ptr.addr.015, i64 2
31 store i8 %conv1, i8* %incdec.ptr, align 1
32 %incdec.ptr5 = getelementptr inbounds i8, i8* %Ptr.addr.015, i64 3
33 store i8 %conv4, i8* %incdec.ptr2, align 1
34 %inc = add nuw nsw i32 %i.016, 1
35 %exitcond = icmp eq i32 %inc, %Nels
36 br i1 %exitcond, label %for.end.loopexit, label %for.body
45 ; Function Attrs: norecurse nounwind uwtable
46 define void @doit_stride4(i8* nocapture %Ptr, i32 %Nels) local_unnamed_addr {
47 ;CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: store i8 %conv7
48 ;CHECK: LV: Found an estimated cost of 13 for VF 2 For instruction: store i8 %conv7
49 ;CHECK: LV: Found an estimated cost of 10 for VF 4 For instruction: store i8 %conv7
50 ;CHECK: LV: Found an estimated cost of 11 for VF 8 For instruction: store i8 %conv7
51 ;CHECK: LV: Found an estimated cost of 12 for VF 16 For instruction: store i8 %conv7
52 ;CHECK: LV: Found an estimated cost of 16 for VF 32 For instruction: store i8 %conv7
54 %cmp19 = icmp sgt i32 %Nels, 0
55 br i1 %cmp19, label %for.body.lr.ph, label %for.end
58 %conv = trunc i32 %Nels to i8
59 %conv1 = shl i8 %conv, 1
60 %conv4 = shl i8 %conv, 2
61 %mul6 = mul nsw i32 %Nels, 5
62 %conv7 = trunc i32 %mul6 to i8
66 %i.021 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
67 %Ptr.addr.020 = phi i8* [ %Ptr, %for.body.lr.ph ], [ %incdec.ptr8, %for.body ]
68 %incdec.ptr = getelementptr inbounds i8, i8* %Ptr.addr.020, i64 1
69 store i8 %conv, i8* %Ptr.addr.020, align 1
70 %incdec.ptr2 = getelementptr inbounds i8, i8* %Ptr.addr.020, i64 2
71 store i8 %conv1, i8* %incdec.ptr, align 1
72 %incdec.ptr5 = getelementptr inbounds i8, i8* %Ptr.addr.020, i64 3
73 store i8 %conv4, i8* %incdec.ptr2, align 1
74 %incdec.ptr8 = getelementptr inbounds i8, i8* %Ptr.addr.020, i64 4
75 store i8 %conv7, i8* %incdec.ptr5, align 1
76 %inc = add nuw nsw i32 %i.021, 1
77 %exitcond = icmp eq i32 %inc, %Nels
78 br i1 %exitcond, label %for.end.loopexit, label %for.body