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