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