[PATCH] D145953: [RISCV] Fallback to scalable lowering costs for fixed length vectors
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 13 11:37:18 PDT 2023
reames added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp:342-348
+ // csrr a0, vlenb
+ // srli a0, a0, 3
+ // addi a0, a0, -1
+ // vsetvli a1, zero, e8, mf8, ta, mu (ignored)
+ // vid.v v9
+ // vrsub.vx v10, v9, a0
+ // vrgather.vv v9, v8, v10
----------------
luke wrote:
> Patch makes sense to me.
> Just something I saw whilst testing, we don't use vscale with fixed length vectors and could subtract it from the cost:
>
> ```
> define <4 x i8> @reverse(<4 x i8> %v0) {
> %v4i8 = shufflevector <4 x i8> %v0, <4 x i8> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
> ret <4 x i8> %v4i8
> }
> ```
> ```
> reverse:
> vsetivli zero, 4, e8, mf4, ta, ma
> vid.v v9
> vrsub.vi v10, v9, 3
> vrgather.vv v9, v8, v10
> vmv1r.v v8, v9
> ret
> ```
Addressed in https://reviews.llvm.org/D145973
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145953/new/
https://reviews.llvm.org/D145953
More information about the llvm-commits
mailing list