brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.3 KiB · 5f13c8e Raw
191 lines · plain
1; REQUIRES: asserts2; RUN: opt -passes=loop-vectorize -mcpu=neoverse-v1 -disable-output %s -debug \3; RUN:   -prefer-predicate-over-epilogue=scalar-epilogue 2>&1 | FileCheck %s4 5target triple="aarch64--linux-gnu"6 7; CHECK: LV: Checking a loop in 'gather_nxv4i32_loaded_index'8; CHECK: LV: Found an estimated cost of 81 for VF vscale x 4 For instruction:   %1 = load float, ptr %arrayidx3, align 49define void @gather_nxv4i32_loaded_index(ptr noalias nocapture readonly %a, ptr noalias nocapture readonly %b, ptr noalias nocapture %c, i64 %n) #0 {10entry:11  br label %for.body12 13for.body:                                         ; preds = %entry, %for.body14  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]15  %arrayidx = getelementptr inbounds i64, ptr %b, i64 %indvars.iv16  %0 = load i64, ptr %arrayidx, align 817  %arrayidx3 = getelementptr inbounds float, ptr %a, i64 %018  %1 = load float, ptr %arrayidx3, align 419  %arrayidx5 = getelementptr inbounds float, ptr %c, i64 %indvars.iv20  store float %1, ptr %arrayidx5, align 421  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 122  %exitcond.not = icmp eq i64 %indvars.iv.next, %n23  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !024 25for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry26  ret void27}28 29; CHECK: LV: Checking a loop in 'scatter_nxv4i32_loaded_index'30; CHECK: LV: Found an estimated cost of 81 for VF vscale x 4 For instruction:   store float %1, ptr %arrayidx5, align 431define void @scatter_nxv4i32_loaded_index(ptr noalias nocapture readonly %a, ptr noalias nocapture readonly %b, ptr noalias nocapture %c, i64 %n) #0 {32entry:33  br label %for.body34 35for.body:                                         ; preds = %entry, %for.body36  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]37  %arrayidx = getelementptr inbounds i64, ptr %b, i64 %indvars.iv38  %0 = load i64, ptr %arrayidx, align 839  %arrayidx3 = getelementptr inbounds float, ptr %a, i64 %indvars.iv40  %1 = load float, ptr %arrayidx3, align 441  %arrayidx5 = getelementptr inbounds float, ptr %c, i64 %042  store float %1, ptr %arrayidx5, align 443  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 144  %exitcond.not = icmp eq i64 %indvars.iv.next, %n45  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !046 47for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry48  ret void49}50 51; NOTE: For runtime-determined strides the vectoriser versions the loop and adds SCEV checks52; to ensure the stride value is always 1. Therefore, it can assume a contiguous load and a cost of 1.53; CHECK: LV: Checking a loop in 'gather_nxv4i32_unknown_stride'54; CHECK: LV: Found an estimated cost of 1 for VF vscale x 4 For instruction:   %0 = load float, ptr %arrayidx, align 455define void @gather_nxv4i32_unknown_stride(ptr noalias nocapture readonly %a, ptr noalias nocapture %b, i64 %stride, i64 %n) #0 {56entry:57  br label %for.body58 59for.body:                                         ; preds = %entry, %for.body60  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]61  %indvars.iv.stride2 = mul i64 %indvars.iv, %stride62  %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv.stride263  %0 = load float, ptr %arrayidx, align 464  %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %indvars.iv65  store float %0, ptr %arrayidx2, align 466  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 167  %exitcond.not = icmp eq i64 %indvars.iv.next, %n68  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !069 70for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry71  ret void72}73 74; NOTE: For runtime-determined strides the vectoriser versions the loop and adds SCEV checks75; to ensure the stride value is always 1. Therefore, it can assume a contiguous load and cost is 1.76; CHECK: LV: Checking a loop in 'scatter_nxv4i32_unknown_stride'77; CHECK: LV: Found an estimated cost of 1 for VF vscale x 4 For instruction:   store float %0, ptr %arrayidx2, align 478define void @scatter_nxv4i32_unknown_stride(ptr noalias nocapture readonly %a, ptr noalias nocapture %b, i64 %stride, i64 %n) #0 {79entry:80  br label %for.body81 82for.body:                                         ; preds = %entry, %for.body83  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]84  %indvars.iv.stride2 = mul i64 %indvars.iv, %stride85  %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv86  %0 = load float, ptr %arrayidx, align 487  %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %indvars.iv.stride288  store float %0, ptr %arrayidx2, align 489  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 190  %exitcond.not = icmp eq i64 %indvars.iv.next, %n91  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !092 93for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry94  ret void95}96 97; CHECK: LV: Checking a loop in 'gather_nxv4i32_stride2'98; CHECK: LV: Found an estimated cost of 2 for VF vscale x 4 For instruction:   %0 = load float, ptr %arrayidx, align 499define void @gather_nxv4i32_stride2(ptr noalias nocapture readonly %a, ptr noalias nocapture readonly %b, i64 %n) #0 {100entry:101  br label %for.body102 103for.body:                                         ; preds = %entry, %for.body104  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]105  %indvars.iv.stride2 = mul i64 %indvars.iv, 2106  %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv.stride2107  %0 = load float, ptr %arrayidx, align 4108  %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %indvars.iv109  store float %0, ptr %arrayidx2, align 4110  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1111  %exitcond.not = icmp eq i64 %indvars.iv.next, %n112  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !0113 114for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry115  ret void116}117 118; CHECK: LV: Checking a loop in 'scatter_nxv4i32_stride2'119; CHECK: LV: Found an estimated cost of 81 for VF vscale x 4 For instruction:   store float %0, ptr %arrayidx2, align 4120define void @scatter_nxv4i32_stride2(ptr noalias nocapture readonly %a, ptr noalias nocapture readonly %b, i64 %n) #0 {121entry:122  br label %for.body123 124for.body:                                         ; preds = %entry, %for.body125  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]126  %indvars.iv.stride2 = mul i64 %indvars.iv, 2127  %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv128  %0 = load float, ptr %arrayidx, align 4129  %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %indvars.iv.stride2130  store float %0, ptr %arrayidx2, align 4131  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1132  %exitcond.not = icmp eq i64 %indvars.iv.next, %n133  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !0134 135for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry136  ret void137}138 139 140; CHECK: LV: Checking a loop in 'gather_nxv4i32_stride64'141; CHECK: LV: Found an estimated cost of 81 for VF vscale x 4 For instruction:   %0 = load float, ptr %arrayidx, align 4142define void @gather_nxv4i32_stride64(ptr noalias nocapture readonly %a, ptr noalias nocapture readonly %b, i64 %n) #0 {143entry:144  br label %for.body145 146for.body:                                         ; preds = %entry, %for.body147  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]148  %indvars.iv.stride2 = mul i64 %indvars.iv, 64149  %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv.stride2150  %0 = load float, ptr %arrayidx, align 4151  %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %indvars.iv152  store float %0, ptr %arrayidx2, align 4153  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1154  %exitcond.not = icmp eq i64 %indvars.iv.next, %n155  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !0156 157for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry158  ret void159}160 161; CHECK: LV: Checking a loop in 'scatter_nxv4i32_stride64'162; CHECK: LV: Found an estimated cost of 81 for VF vscale x 4 For instruction:   store float %0, ptr %arrayidx2, align 4163define void @scatter_nxv4i32_stride64(ptr noalias nocapture readonly %a, ptr noalias nocapture readonly %b, i64 %n) #0 {164entry:165  br label %for.body166 167for.body:                                         ; preds = %entry, %for.body168  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]169  %indvars.iv.stride2 = mul i64 %indvars.iv, 64170  %arrayidx = getelementptr inbounds float, ptr %b, i64 %indvars.iv171  %0 = load float, ptr %arrayidx, align 4172  %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %indvars.iv.stride2173  store float %0, ptr %arrayidx2, align 4174  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1175  %exitcond.not = icmp eq i64 %indvars.iv.next, %n176  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !0177 178for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry179  ret void180}181 182 183attributes #0 = { vscale_range(1, 16) "target-features"="+sve" }184 185!0 = distinct !{!0, !1, !2, !3, !4, !5}186!1 = !{!"llvm.loop.mustprogress"}187!2 = !{!"llvm.loop.vectorize.width", i32 4}188!3 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}189!4 = !{!"llvm.loop.interleave.count", i32 1}190!5 = !{!"llvm.loop.vectorize.enable", i1 true}191