We can use SH1ADD, SH2ADD, SH3ADD to multipy by 3, 5, and 9 respectively.
We could extend this to 3, 5, or 9 multiplied by a power 2 by also
emitting a SLLI.
While there remove the code that looks up TII. We're already a
member of RISCV's TII.
Paths
| Differential D124824
[RISCV] Make use of SHXADD instructions in RVV spill/reload code. ClosedPublic Authored by craig.topper on May 2 2022, 11:32 PM.
Details Summary We can use SH1ADD, SH2ADD, SH3ADD to multipy by 3, 5, and 9 respectively. We could extend this to 3, 5, or 9 multiplied by a power 2 by also While there remove the code that looks up TII. We're already a
Diff Detail
Event TimelineThis revision is now accepted and ready to land.May 3 2022, 1:07 PM
This revision was landed with ongoing or failed builds.May 3 2022, 7:41 PM Closed by commit rG9cce9a126cca: [RISCV] Make use of SHXADD instructions in RVV spill/reload code. (authored by craig.topper). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 426906 llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
llvm/test/CodeGen/RISCV/rvv/allocate-lmul-2-4-8.ll
|
I'm considering merging this with it's one caller. There might be some more optimization opportunities if we include the ADD/SUB to SP.
For example, vlenb * 7 + sp could become
instead of
That would save a temporary register.