This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Extend use of SHXADD instructions in RVV spill/reload code.
ClosedPublic

Authored by jacquesguan on Jul 6 2022, 2:21 AM.

Details

Summary

This patch extends D124824. It uses SHXADD+SLLI to emit 3, 5, or 9 multiplied by a power 2.

Diff Detail

Event Timeline

jacquesguan created this revision.Jul 6 2022, 2:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 6 2022, 2:21 AM
jacquesguan requested review of this revision.Jul 6 2022, 2:21 AM
craig.topper added inline comments.Jul 9 2022, 12:27 PM
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
1809

NumOfVReg % 3 == 0 when we really matched the (NumOfVReg % 9 == 0 && isPowerOf2_64(NumOfVReg / 9) case. Any number divisible by 9 is also divisible by 3.

llvm/test/CodeGen/RISCV/rvv/allocate-lmul-2-4-8.ll
238

Should we be testing more than sh1add?

craig.topper requested changes to this revision.Jul 9 2022, 12:28 PM
This revision now requires changes to proceed.Jul 9 2022, 12:28 PM

Address comment.

jacquesguan marked 2 inline comments as done.Jul 10 2022, 11:53 PM
jacquesguan added inline comments.
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
1809

Done, thanks.

llvm/test/CodeGen/RISCV/rvv/allocate-lmul-2-4-8.ll
238

Done, I add cases of sh2add and sh3add.

This revision is now accepted and ready to land.Jul 11 2022, 9:42 AM
craig.topper requested changes to this revision.Jul 11 2022, 9:44 AM
craig.topper added inline comments.
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
1822

Do we need a new GPR here?

This revision now requires changes to proceed.Jul 11 2022, 9:44 AM
frasercrmck added inline comments.Jul 11 2022, 9:47 AM
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
1822

And if we do need a new GPR, can we guarantee we don't need an extra emergency spill slot?

jacquesguan marked 2 inline comments as done.

Address comment.

jacquesguan added inline comments.Jul 11 2022, 7:19 PM
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
1822

Done, I changed to reuse VL.

craig.topper added inline comments.Jul 11 2022, 8:26 PM
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
1823

This needs RegState::Kill because it ends the lifetime of the previous definition of VL.

Address comment.

jacquesguan marked an inline comment as done.Jul 12 2022, 1:23 AM
jacquesguan added inline comments.
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
1823

Done.

This revision is now accepted and ready to land.Jul 14 2022, 10:00 AM
This revision was landed with ongoing or failed builds.Jul 17 2022, 8:03 PM
This revision was automatically updated to reflect the committed changes.
jacquesguan marked an inline comment as done.