114 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 i16] zeroinitializer, align 168@B = global [10240 x i16] zeroinitializer, align 169 10; Function Attrs: nounwind uwtable11define void @load_i16_stride2() {12;CHECK-LABEL: load_i16_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 2 for VF 8 For instruction: %1 = load17;CHECK: Found an estimated cost of 2 for VF 16 For instruction: %1 = load18;CHECK: Found an estimated cost of 3 for VF 32 For instruction: %1 = load19entry:20 br label %for.body21 22for.body: ; preds = %for.body, %entry23 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]24 %0 = shl nsw i64 %indvars.iv, 125 %arrayidx = getelementptr inbounds [10240 x i16], ptr @A, i64 0, i64 %026 %1 = load i16, ptr %arrayidx, align 427 %arrayidx2 = getelementptr inbounds [10240 x i16], ptr @B, i64 0, i64 %indvars.iv28 store i16 %1, ptr %arrayidx2, align 229 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 130 %exitcond = icmp eq i64 %indvars.iv.next, 102431 br i1 %exitcond, label %for.end, label %for.body32 33for.end: ; preds = %for.body34 ret void35}36 37define void @load_i16_stride3() {38;CHECK-LABEL: load_i16_stride339;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load40;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load41;CHECK: Found an estimated cost of 2 for VF 4 For instruction: %1 = load42;CHECK: Found an estimated cost of 2 for VF 8 For instruction: %1 = load43;CHECK: Found an estimated cost of 3 for VF 16 For instruction: %1 = load44;CHECK: Found an estimated cost of 5 for VF 32 For instruction: %1 = load45entry:46 br label %for.body47 48for.body: ; preds = %for.body, %entry49 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]50 %0 = mul nsw i64 %indvars.iv, 351 %arrayidx = getelementptr inbounds [10240 x i16], ptr @A, i64 0, i64 %052 %1 = load i16, ptr %arrayidx, align 453 %arrayidx2 = getelementptr inbounds [10240 x i16], ptr @B, i64 0, i64 %indvars.iv54 store i16 %1, ptr %arrayidx2, align 255 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 156 %exitcond = icmp eq i64 %indvars.iv.next, 102457 br i1 %exitcond, label %for.end, label %for.body58 59for.end: ; preds = %for.body60 ret void61}62 63define void @load_i16_stride4() {64;CHECK-LABEL: load_i16_stride465;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load66;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load67;CHECK: Found an estimated cost of 2 for VF 4 For instruction: %1 = load68;CHECK: Found an estimated cost of 2 for VF 8 For instruction: %1 = load69;CHECK: Found an estimated cost of 3 for VF 16 For instruction: %1 = load70;CHECK: Found an estimated cost of 8 for VF 32 For instruction: %1 = load71entry:72 br label %for.body73 74for.body: ; preds = %for.body, %entry75 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]76 %0 = shl nsw i64 %indvars.iv, 277 %arrayidx = getelementptr inbounds [10240 x i16], ptr @A, i64 0, i64 %078 %1 = load i16, ptr %arrayidx, align 479 %arrayidx2 = getelementptr inbounds [10240 x i16], ptr @B, i64 0, i64 %indvars.iv80 store i16 %1, ptr %arrayidx2, align 281 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 182 %exitcond = icmp eq i64 %indvars.iv.next, 102483 br i1 %exitcond, label %for.end, label %for.body84 85for.end: ; preds = %for.body86 ret void87}88 89define void @load_i16_stride5() {90;CHECK-LABEL: load_i16_stride591;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load92;CHECK: Found an estimated cost of 2 for VF 2 For instruction: %1 = load93;CHECK: Found an estimated cost of 2 for VF 4 For instruction: %1 = load94;CHECK: Found an estimated cost of 3 for VF 8 For instruction: %1 = load95;CHECK: Found an estimated cost of 5 for VF 16 For instruction: %1 = load96;CHECK: Found an estimated cost of 10 for VF 32 For instruction: %1 = load97entry:98 br label %for.body99 100for.body: ; preds = %for.body, %entry101 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]102 %0 = mul nsw i64 %indvars.iv, 5103 %arrayidx = getelementptr inbounds [10240 x i16], ptr @A, i64 0, i64 %0104 %1 = load i16, ptr %arrayidx, align 4105 %arrayidx2 = getelementptr inbounds [10240 x i16], ptr @B, i64 0, i64 %indvars.iv106 store i16 %1, ptr %arrayidx2, align 2107 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1108 %exitcond = icmp eq i64 %indvars.iv.next, 1024109 br i1 %exitcond, label %for.end, label %for.body110 111for.end: ; preds = %for.body112 ret void113}114