[PATCH] D124824: [RISCV] Make use of SHXADD instructions in RVV spill/reload code.

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 3 13:59:42 PDT 2022


reames added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:1760
                                                MachineInstr::MIFlag Flag) const {
   assert(Amount > 0 && "There is no need to get VLEN scaled value.");
   assert(Amount % 8 == 0 &&
----------------
craig.topper wrote:
> 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
> 
> ```
> csrrd a0, vlenb
> sub sp, sp, a0
> slli a0, a0, 3
> add sp, sp, a0
> ```
> 
> instead of
> 
> ```
> csrrd a0, vlenb
> slli a1, a0, 3
> sub a0, a1, a0
> add sp, sp, a0
> ```
> 
> That would save a temporary register.
Separate commit please.  :)

Any chance this could be done in a post-process combine like thing?  Duplicating what appears to be generic multiple improvements seems like poor code structure.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124824/new/

https://reviews.llvm.org/D124824



More information about the llvm-commits mailing list