[PATCH] D157373: [RISCV] add a compress optimization for stack inst.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 13 11:40:44 PDT 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:1313
+    // be compressed.
+    if (STI.hasStdExtC()) {
+      // riscv32: c.lwsp rd, offset[7:2] => 2^(6 + 2)
----------------
What about Zca?


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:1322
+      //          c.fsdsp rs2, offset[8:3] => 2^(6 + 3)
+      const uint64_t RVCompressLen = STI.getXLen() << 3;
+      // Avoid increasing extra instructions when ld/st can be compressed.
----------------
Use `* 8`. Let the compiler convert it to a shift.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157373



More information about the llvm-commits mailing list