|
| 1 | +; RUN: opt -passes=loop-vectorize -debug-only=loop-vectorize \ |
| 2 | +; RUN: -force-tail-folding-style=data-with-evl \ |
| 3 | +; RUN: -prefer-predicate-over-epilogue=predicate-dont-vectorize \ |
| 4 | +; RUN: -mtriple=riscv64 -mattr=+v -S < %s 2>&1 | FileCheck %s \ |
| 5 | +; RUN: --check-prefix=EVL |
| 6 | + |
| 7 | +; RUN: opt -passes=loop-vectorize -debug-only=loop-vectorize \ |
| 8 | +; RUN: -prefer-predicate-over-epilogue=predicate-dont-vectorize \ |
| 9 | +; RUN: -mtriple=riscv64 -mattr=+v -S < %s 2>&1 | FileCheck %s \ |
| 10 | +; RUN: --check-prefix=NO-EVL |
| 11 | + |
| 12 | +; EVL: Cost of 2 for VF vscale x 4: WIDEN-INTRINSIC vp<%{{.+}}> = call llvm.vp.merge(ir<true>, ir<%add>, ir<%rdx>, vp<%{{.+}}>) |
| 13 | +; EVL: LV: Found an estimated cost of 0 for VF vscale x 4 For instruction: %rdx = phi i32 [ %start, %entry ], [ %add, %for.body ] |
| 14 | + |
| 15 | +; NO-EVL: Cost of 0 for VF vscale x 4: EMIT vp<%{{.+}}> = select vp<%active.lane.mask>, ir<%add>, ir<%rdx> |
| 16 | +; NO-EVL: LV: Found an estimated cost of 0 for VF vscale x 4 For instruction: %rdx = phi i32 [ %start, %entry ], [ %add, %for.body ] |
| 17 | + |
| 18 | +define i32 @add(ptr %a, i64 %n, i32 %start) { |
| 19 | +entry: |
| 20 | + br label %for.body |
| 21 | + |
| 22 | +for.body: |
| 23 | + %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] |
| 24 | + %rdx = phi i32 [ %start, %entry ], [ %add, %for.body ] |
| 25 | + %arrayidx = getelementptr inbounds i32, ptr %a, i64 %iv |
| 26 | + %0 = load i32, ptr %arrayidx, align 4 |
| 27 | + %add = add nsw i32 %0, %rdx |
| 28 | + %iv.next = add nuw nsw i64 %iv, 1 |
| 29 | + %exitcond.not = icmp eq i64 %iv.next, %n |
| 30 | + br i1 %exitcond.not, label %for.end, label %for.body |
| 31 | + |
| 32 | +for.end: |
| 33 | + ret i32 %add |
| 34 | +} |
0 commit comments