brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 1bacae7 Raw
95 lines · plain
1; REQUIRES: asserts2; RUN: opt -passes=loop-vectorize -force-vector-interleave=1 -S -debug-only=loop-vectorize < %s 2>%t | FileCheck %s3; RUN: cat %t | FileCheck %s --check-prefix=CHECK-COST4 5target triple = "aarch64-unknown-linux-gnu"6 7; CHECK-COST: Checking a loop in 'fixed_width'8; CHECK-COST: Cost of 10 for VF 2: WIDEN store vp<{{.+}}>, ir<2>, ir<{{.+}}>9; CHECK-COST: Cost of 20 for VF 4: WIDEN store vp<{{.+}}>, ir<2>, ir<{{.+}}>10; CHECK-COST: Selecting VF: 1.11 12; We should decide this loop is not worth vectorising using fixed width vectors13define void @fixed_width(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, i64 %n) #0 {14; CHECK-LABEL: @fixed_width(15; CHECK-NOT: vector.body16entry:17  %cmp6 = icmp sgt i64 %n, 018  br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup19 20for.body.preheader:                               ; preds = %entry21  br label %for.body22 23for.cond.cleanup.loopexit:                        ; preds = %for.inc24  br label %for.cond.cleanup25 26for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry27  ret void28 29for.body:                                         ; preds = %for.body.preheader, %for.inc30  %i.07 = phi i64 [ %inc, %for.inc ], [ 0, %for.body.preheader ]31  %arrayidx = getelementptr inbounds i32, ptr %b, i64 %i.0732  %0 = load i32, ptr %arrayidx, align 433  %tobool.not = icmp eq i32 %0, 034  br i1 %tobool.not, label %for.inc, label %if.then35 36if.then:                                          ; preds = %for.body37  %arrayidx1 = getelementptr inbounds i32, ptr %a, i64 %i.0738  store i32 2, ptr %arrayidx1, align 439  br label %for.inc40 41for.inc:                                          ; preds = %for.body, %if.then42  %inc = add nuw nsw i64 %i.07, 143  %exitcond.not = icmp eq i64 %inc, %n44  br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body, !llvm.loop !545}46 47 48; CHECK-COST: Checking a loop in 'scalable'49; CHECK-COST: Found an estimated cost of 1 for VF vscale x 4 For instruction:   store i32 2, ptr %arrayidx1, align 450 51define void @scalable(ptr noalias nocapture %a, ptr noalias nocapture readonly %b, i64 %n) #0 {52; CHECK-LABEL: @scalable(53; CHECK: vector.body54; CHECK: call void @llvm.masked.store.nxv4i32.p055entry:56  %cmp6 = icmp sgt i64 %n, 057  br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup58 59for.body.preheader:                               ; preds = %entry60  br label %for.body61 62for.cond.cleanup.loopexit:                        ; preds = %for.inc63  br label %for.cond.cleanup64 65for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry66  ret void67 68for.body:                                         ; preds = %for.body.preheader, %for.inc69  %i.07 = phi i64 [ %inc, %for.inc ], [ 0, %for.body.preheader ]70  %arrayidx = getelementptr inbounds i32, ptr %b, i64 %i.0771  %0 = load i32, ptr %arrayidx, align 472  %tobool.not = icmp eq i32 %0, 073  br i1 %tobool.not, label %for.inc, label %if.then74 75if.then:                                          ; preds = %for.body76  %arrayidx1 = getelementptr inbounds i32, ptr %a, i64 %i.0777  store i32 2, ptr %arrayidx1, align 478  br label %for.inc79 80for.inc:                                          ; preds = %for.body, %if.then81  %inc = add nuw nsw i64 %i.07, 182  %exitcond.not = icmp eq i64 %inc, %n83  br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body, !llvm.loop !084}85 86attributes #0 = { "target-features"="+neon,+sve" }87 88!0 = distinct !{!0, !1, !2, !3, !4}89!1 = !{!"llvm.loop.mustprogress"}90!2 = !{!"llvm.loop.vectorize.width", i32 4}91!3 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}92!4 = !{!"llvm.loop.vectorize.enable", i1 true}93!5 = distinct !{!5, !6}94!6 = !{!"llvm.loop.vectorize.scalable.enable", i1 false}95