111 lines · plain
1; REQUIRES: asserts2; RUN: opt -passes=loop-vectorize -S -mattr=avx512f --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 i32] zeroinitializer, align 168@B = global [10240 x i32] zeroinitializer, align 169 10; Function Attrs: nounwind uwtable11define void @load_int_stride2() {12;CHECK-LABEL: load_int_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 2 for VF 16 For instruction: %1 = load18entry:19 br label %for.body20 21for.body: ; preds = %for.body, %entry22 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]23 %0 = shl nsw i64 %indvars.iv, 124 %arrayidx = getelementptr inbounds [10240 x i32], ptr @A, i64 0, i64 %025 %1 = load i32, ptr %arrayidx, align 426 %arrayidx2 = getelementptr inbounds [10240 x i32], ptr @B, i64 0, i64 %indvars.iv27 store i32 %1, ptr %arrayidx2, align 228 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 129 %exitcond = icmp eq i64 %indvars.iv.next, 102430 br i1 %exitcond, label %for.end, label %for.body31 32for.end: ; preds = %for.body33 ret void34}35 36define void @load_int_stride3() {37;CHECK-LABEL: load_int_stride338;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load39;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load40;CHECK: Found an estimated cost of 1 for VF 4 For instruction: %1 = load41;CHECK: Found an estimated cost of 2 for VF 8 For instruction: %1 = load42;CHECK: Found an estimated cost of 3 for VF 16 For instruction: %1 = load43entry:44 br label %for.body45 46for.body: ; preds = %for.body, %entry47 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]48 %0 = mul nsw i64 %indvars.iv, 349 %arrayidx = getelementptr inbounds [10240 x i32], ptr @A, i64 0, i64 %050 %1 = load i32, ptr %arrayidx, align 451 %arrayidx2 = getelementptr inbounds [10240 x i32], ptr @B, i64 0, i64 %indvars.iv52 store i32 %1, ptr %arrayidx2, align 253 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 154 %exitcond = icmp eq i64 %indvars.iv.next, 102455 br i1 %exitcond, label %for.end, label %for.body56 57for.end: ; preds = %for.body58 ret void59}60 61define void @load_int_stride4() {62;CHECK-LABEL: load_int_stride463;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load64;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load65;CHECK: Found an estimated cost of 1 for VF 4 For instruction: %1 = load66;CHECK: Found an estimated cost of 2 for VF 8 For instruction: %1 = load67;CHECK: Found an estimated cost of 5 for VF 16 For instruction: %1 = load68entry:69 br label %for.body70 71for.body: ; preds = %for.body, %entry72 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]73 %0 = shl nsw i64 %indvars.iv, 274 %arrayidx = getelementptr inbounds [10240 x i32], ptr @A, i64 0, i64 %075 %1 = load i32, ptr %arrayidx, align 476 %arrayidx2 = getelementptr inbounds [10240 x i32], ptr @B, i64 0, i64 %indvars.iv77 store i32 %1, ptr %arrayidx2, align 278 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 179 %exitcond = icmp eq i64 %indvars.iv.next, 102480 br i1 %exitcond, label %for.end, label %for.body81 82for.end: ; preds = %for.body83 ret void84}85 86define void @load_int_stride5() {87;CHECK-LABEL: load_int_stride588;CHECK: Found an estimated cost of 1 for VF 1 For instruction: %1 = load89;CHECK: Found an estimated cost of 1 for VF 2 For instruction: %1 = load90;CHECK: Found an estimated cost of 2 for VF 4 For instruction: %1 = load91;CHECK: Found an estimated cost of 3 for VF 8 For instruction: %1 = load92;CHECK: Found an estimated cost of 6 for VF 16 For instruction: %1 = load93entry:94 br label %for.body95 96for.body: ; preds = %for.body, %entry97 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]98 %0 = mul nsw i64 %indvars.iv, 599 %arrayidx = getelementptr inbounds [10240 x i32], ptr @A, i64 0, i64 %0100 %1 = load i32, ptr %arrayidx, align 4101 %arrayidx2 = getelementptr inbounds [10240 x i32], ptr @B, i64 0, i64 %indvars.iv102 store i32 %1, ptr %arrayidx2, align 2103 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1104 %exitcond = icmp eq i64 %indvars.iv.next, 1024105 br i1 %exitcond, label %for.end, label %for.body106 107for.end: ; preds = %for.body108 ret void109}110 111