118 lines · plain
1; REQUIRES: asserts2; RUN: opt -passes=loop-vectorize -S -mattr=avx512bw --debug-only=loop-vectorize --disable-output < %s 2>&1| FileCheck %s3 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 i8] zeroinitializer, align 168@B = global [10240 x i8] zeroinitializer, align 169 10; Function Attrs: nounwind uwtable11define void @load_i8_stride2() {12;CHECK-LABEL: load_i8_stride213;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load14;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load15;CHECK: Found an estimated cost of 1 for VF 4 For instruction: %1 = load16;CHECK: Found an estimated cost of 1 for VF 8 For instruction: %1 = load17;CHECK: Found an estimated cost of 4 for VF 16 For instruction: %1 = load18;CHECK: Found an estimated cost of 8 for VF 32 For instruction: %1 = load19;CHECK: Found an estimated cost of 20 for VF 64 For instruction: %1 = load20entry:21 br label %for.body22 23for.body: ; preds = %for.body, %entry24 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]25 %0 = shl nsw i64 %indvars.iv, 126 %arrayidx = getelementptr inbounds [10240 x i8], ptr @A, i64 0, i64 %027 %1 = load i8, ptr %arrayidx, align 228 %arrayidx2 = getelementptr inbounds [10240 x i8], ptr @B, i64 0, i64 %indvars.iv29 store i8 %1, ptr %arrayidx2, align 130 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 131 %exitcond = icmp eq i64 %indvars.iv.next, 102432 br i1 %exitcond, label %for.end, label %for.body33 34for.end: ; preds = %for.body35 ret void36}37 38define void @load_i8_stride3() {39;CHECK-LABEL: load_i8_stride340;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load41;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load42;CHECK: Found an estimated cost of 1 for VF 4 For instruction: %1 = load43;CHECK: Found an estimated cost of 4 for VF 8 For instruction: %1 = load44;CHECK: Found an estimated cost of 13 for VF 16 For instruction: %1 = load45;CHECK: Found an estimated cost of 16 for VF 32 For instruction: %1 = load46;CHECK: Found an estimated cost of 25 for VF 64 For instruction: %1 = load47entry:48 br label %for.body49 50for.body: ; preds = %for.body, %entry51 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]52 %0 = mul nsw i64 %indvars.iv, 353 %arrayidx = getelementptr inbounds [10240 x i8], ptr @A, i64 0, i64 %054 %1 = load i8, ptr %arrayidx, align 255 %arrayidx2 = getelementptr inbounds [10240 x i8], ptr @B, i64 0, i64 %indvars.iv56 store i8 %1, ptr %arrayidx2, align 157 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 158 %exitcond = icmp eq i64 %indvars.iv.next, 102459 br i1 %exitcond, label %for.end, label %for.body60 61for.end: ; preds = %for.body62 ret void63}64 65define void @load_i8_stride4() {66;CHECK-LABEL: load_i8_stride467;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load68;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load69;CHECK: Found an estimated cost of 1 for VF 4 For instruction: %1 = load70;CHECK: Found an estimated cost of 4 for VF 8 For instruction: %1 = load71;CHECK: Found an estimated cost of 8 for VF 16 For instruction: %1 = load72;CHECK: Found an estimated cost of 20 for VF 32 For instruction: %1 = load73;CHECK: Found an estimated cost of 59 for VF 64 For instruction: %1 = load74entry:75 br label %for.body76 77for.body: ; preds = %for.body, %entry78 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]79 %0 = shl nsw i64 %indvars.iv, 280 %arrayidx = getelementptr inbounds [10240 x i8], ptr @A, i64 0, i64 %081 %1 = load i8, ptr %arrayidx, align 282 %arrayidx2 = getelementptr inbounds [10240 x i8], ptr @B, i64 0, i64 %indvars.iv83 store i8 %1, ptr %arrayidx2, align 184 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 185 %exitcond = icmp eq i64 %indvars.iv.next, 102486 br i1 %exitcond, label %for.end, label %for.body87 88for.end: ; preds = %for.body89 ret void90}91 92define void @load_i8_stride5() {93;CHECK-LABEL: load_i8_stride594;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load95;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load96;CHECK: Found an estimated cost of 4 for VF 4 For instruction: %1 = load97;CHECK: Found an estimated cost of 8 for VF 8 For instruction: %1 = load98;CHECK: Found an estimated cost of 20 for VF 16 For instruction: %1 = load99;CHECK: Found an estimated cost of 39 for VF 32 For instruction: %1 = load100;CHECK: Found an estimated cost of 78 for VF 64 For instruction: %1 = load101entry:102 br label %for.body103 104for.body: ; preds = %for.body, %entry105 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]106 %0 = mul nsw i64 %indvars.iv, 5107 %arrayidx = getelementptr inbounds [10240 x i8], ptr @A, i64 0, i64 %0108 %1 = load i8, ptr %arrayidx, align 2109 %arrayidx2 = getelementptr inbounds [10240 x i8], ptr @B, i64 0, i64 %indvars.iv110 store i8 %1, ptr %arrayidx2, align 1111 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1112 %exitcond = icmp eq i64 %indvars.iv.next, 1024113 br i1 %exitcond, label %for.end, label %for.body114 115for.end: ; preds = %for.body116 ret void117}118