The original change had a bug where it allowed SEW mutation. This is wrong in multiple ways, but an easy example is that the slide amount is in units of SEW, and thus that changing SEW changes the slide offset. I'd reverted this in 33314693 intending to more majorly rework the patch because in addition to the bug, I'd noticed a potential oppurtunity to increase scope. After implementing that variant, and realizing it triggered nowhere, I decided to go back to the prior patch with the minimal fix. Note there's no separate test case for the fix. This is because we already had multiple, and I just didn't realize the impact of the original test diff. Adding one more test would have been unlikely to catch that human error. Original commit message.. Noticed this while looking at some SLP output. If we have an extractelement, we're probably using a slidedown into an destination with no contents. Given this, we can allow the slideup to use a larger VL and clobber tail elements of the destination vector. Doing this allows us to avoid vsetvli toggles in many fixed length vector examples. Differential Revision: https://reviews.llvm.org/D148834
32 lines
1.3 KiB
LLVM
32 lines
1.3 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc -start-after codegenprepare -mtriple=riscv64 -mattr=-v -o - %s | FileCheck --check-prefix=CHECK-NOV %s
|
|
; RUN: llc -start-after codegenprepare -mtriple=riscv64 -mattr=+v -o - %s | FileCheck --check-prefix=CHECK-V %s
|
|
|
|
; Reproducer for https://github.com/llvm/llvm-project/issues/55168.
|
|
; We should always return 1 (and not -1).
|
|
define i32 @test(i32 %call.i) {
|
|
; CHECK-NOV-LABEL: test:
|
|
; CHECK-NOV: # %bb.0:
|
|
; CHECK-NOV-NEXT: li a0, 1
|
|
; CHECK-NOV-NEXT: ret
|
|
;
|
|
; CHECK-V-LABEL: test:
|
|
; CHECK-V: # %bb.0:
|
|
; CHECK-V-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
|
|
; CHECK-V-NEXT: vslide1down.vx v8, v8, a0
|
|
; CHECK-V-NEXT: lui a0, 524288
|
|
; CHECK-V-NEXT: vslide1down.vx v8, v8, a0
|
|
; CHECK-V-NEXT: addiw a0, a0, 2
|
|
; CHECK-V-NEXT: vmslt.vx v0, v8, a0
|
|
; CHECK-V-NEXT: vmv.v.i v8, 0
|
|
; CHECK-V-NEXT: vmerge.vim v8, v8, 1, v0
|
|
; CHECK-V-NEXT: vslidedown.vi v8, v8, 1
|
|
; CHECK-V-NEXT: vmv.x.s a0, v8
|
|
; CHECK-V-NEXT: ret
|
|
%t2 = insertelement <2 x i32> <i32 poison, i32 -2147483648>, i32 %call.i, i64 0
|
|
%t3 = icmp slt <2 x i32> %t2, <i32 -2147483646, i32 -2147483646>
|
|
%t4 = zext <2 x i1> %t3 to <2 x i32>
|
|
%t6 = extractelement <2 x i32> %t4, i64 1
|
|
ret i32 %t6
|
|
}
|