We have been tracking the performance of EVL tail folding in the loop vectorizer on RISC-V for a while now, and after much hard work from various contributors we think it should be generally profitable to enable by default now. With tail folding there is a 21% improvement on 525.x264_r on SPEC CPU 2017 on the BPI-F3 (-march=rva22u64_v -O3 -flto), as well as a 30% geomean codesize reduction on SPEC and TSVC, with no significant regressions detected. Now that we are early into the LLVM 22.x development cycle it seems like a good time to enable it to catch any issues. There are still more EVL related items of work being tracked in #123069, which should continue to improve performance.
69 lines
2.4 KiB
LLVM
69 lines
2.4 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt -S -mtriple=riscv64 -mattr=+zve32x -passes=loop-vectorize < %s | FileCheck %s
|
|
|
|
define void @small_trip_count_min_vlen_128(ptr nocapture %a) nounwind vscale_range(4,1024) {
|
|
; CHECK-LABEL: @small_trip_count_min_vlen_128(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: br label [[LOOP1:%.*]]
|
|
; CHECK: loop:
|
|
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ [[IV_NEXT:%.*]], [[LOOP1]] ], [ 0, [[ENTRY:%.*]] ]
|
|
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i32, ptr [[TMP1:%.*]], i32 [[IV]]
|
|
; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[GEP]], align 4
|
|
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[V]], 1
|
|
; CHECK-NEXT: store i32 [[ADD]], ptr [[GEP]], align 4
|
|
; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
|
|
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[IV]], 3
|
|
; CHECK-NEXT: br i1 [[COND]], label [[EXIT:%.*]], label [[LOOP1]]
|
|
; CHECK: exit:
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
br label %loop
|
|
|
|
loop:
|
|
%iv = phi i32 [ %iv.next, %loop ], [ 0, %entry ]
|
|
%gep = getelementptr inbounds i32, ptr %a, i32 %iv
|
|
%v = load i32, ptr %gep, align 4
|
|
%add = add nsw i32 %v, 1
|
|
store i32 %add, ptr %gep, align 4
|
|
%iv.next = add i32 %iv, 1
|
|
%cond = icmp eq i32 %iv, 3
|
|
br i1 %cond, label %exit, label %loop
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
define void @small_trip_count_min_vlen_32(ptr nocapture %a) nounwind vscale_range(1,1024) {
|
|
; CHECK-LABEL: @small_trip_count_min_vlen_32(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: br label [[LOOP1:%.*]]
|
|
; CHECK: loop:
|
|
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ [[IV_NEXT:%.*]], [[LOOP1]] ], [ 0, [[ENTRY:%.*]] ]
|
|
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i32, ptr [[TMP1:%.*]], i32 [[IV]]
|
|
; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[GEP]], align 4
|
|
; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[V]], 1
|
|
; CHECK-NEXT: store i32 [[ADD]], ptr [[GEP]], align 4
|
|
; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
|
|
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[IV]], 3
|
|
; CHECK-NEXT: br i1 [[COND]], label [[EXIT:%.*]], label [[LOOP1]]
|
|
; CHECK: exit:
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
br label %loop
|
|
|
|
loop:
|
|
%iv = phi i32 [ %iv.next, %loop ], [ 0, %entry ]
|
|
%gep = getelementptr inbounds i32, ptr %a, i32 %iv
|
|
%v = load i32, ptr %gep, align 4
|
|
%add = add nsw i32 %v, 1
|
|
store i32 %add, ptr %gep, align 4
|
|
%iv.next = add i32 %iv, 1
|
|
%cond = icmp eq i32 %iv, 3
|
|
br i1 %cond, label %exit, label %loop
|
|
|
|
exit:
|
|
ret void
|
|
}
|