72 lines · plain
1; REQUIRES: asserts2; RUN: opt < %s -passes=loop-vectorize -debug -disable-output -force-ordered-reductions=true -hints-allow-reordering=false \3; RUN: -prefer-predicate-over-epilogue=scalar-epilogue -force-vector-interleave=1 -S 2>&1 | FileCheck %s --check-prefix=CHECK-VSCALE14; RUN: opt < %s -passes=loop-vectorize -debug -disable-output -force-ordered-reductions=true -hints-allow-reordering=false \5; RUN: -prefer-predicate-over-epilogue=scalar-epilogue -force-vector-interleave=1 \6; RUN: -mcpu=neoverse-v1 -S 2>&1 | FileCheck %s --check-prefix=CHECK-VSCALE27; RUN: opt < %s -passes=loop-vectorize -debug -disable-output -force-ordered-reductions=true -hints-allow-reordering=false \8; RUN: -prefer-predicate-over-epilogue=scalar-epilogue -force-vector-interleave=1 \9; RUN: -mcpu=neoverse-n2 -S 2>&1 | FileCheck %s --check-prefix=CHECK-VSCALE110 11target triple="aarch64-unknown-linux-gnu"12 13; CHECK-VSCALE2-LABEL: LV: Checking a loop in 'fadd_strict32'14; CHECK-VSCALE2: Cost of 4 for VF vscale x 2:15; CHECK-VSCALE2: REDUCE ir<%add> = ir<%sum.07> + reduce.fadd (ir<%0>)16; CHECK-VSCALE2: Cost of 8 for VF vscale x 4:17; CHECK-VSCALE2: REDUCE ir<%add> = ir<%sum.07> + reduce.fadd (ir<%0>)18; CHECK-VSCALE1-LABEL: LV: Checking a loop in 'fadd_strict32'19; CHECK-VSCALE1: Cost of 2 for VF vscale x 2:20; CHECK-VSCALE1: REDUCE ir<%add> = ir<%sum.07> + reduce.fadd (ir<%0>)21; CHECK-VSCALE1: Cost of 4 for VF vscale x 4:22; CHECK-VSCALE1: REDUCE ir<%add> = ir<%sum.07> + reduce.fadd (ir<%0>)23 24define float @fadd_strict32(ptr noalias nocapture readonly %a, i64 %n) #0 {25entry:26 br label %for.body27 28for.body:29 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]30 %sum.07 = phi float [ 0.000000e+00, %entry ], [ %add, %for.body ]31 %arrayidx = getelementptr inbounds float, ptr %a, i64 %iv32 %0 = load float, ptr %arrayidx, align 433 %add = fadd float %0, %sum.0734 %iv.next = add nuw nsw i64 %iv, 135 %exitcond.not = icmp eq i64 %iv.next, %n36 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !037 38for.end:39 ret float %add40}41 42 43; CHECK-VSCALE2-LABEL: LV: Checking a loop in 'fadd_strict64'44; CHECK-VSCALE2: Cost of 4 for VF vscale x 2:45; CHECK-VSCALE2: REDUCE ir<%add> = ir<%sum.07> + reduce.fadd (ir<%0>)46; CHECK-VSCALE1-LABEL: LV: Checking a loop in 'fadd_strict64'47; CHECK-VSCALE1: Cost of 2 for VF vscale x 2:48; CHECK-VSCALE1: REDUCE ir<%add> = ir<%sum.07> + reduce.fadd (ir<%0>)49 50define double @fadd_strict64(ptr noalias nocapture readonly %a, i64 %n) #0 {51entry:52 br label %for.body53 54for.body:55 %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]56 %sum.07 = phi double [ 0.000000e+00, %entry ], [ %add, %for.body ]57 %arrayidx = getelementptr inbounds double, ptr %a, i64 %iv58 %0 = load double, ptr %arrayidx, align 459 %add = fadd double %0, %sum.0760 %iv.next = add nuw nsw i64 %iv, 161 %exitcond.not = icmp eq i64 %iv.next, %n62 br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !063 64for.end:65 ret double %add66}67 68attributes #0 = { "target-features"="+sve" vscale_range(1, 16) }69 70!0 = distinct !{!0, !1}71!1 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}72