[PATCH] D139135: [RISCV] Teach RISCVMatInt to prefer li+slli over lui+addi(w) for compressibility.

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 1 12:33:26 PST 2022


jrtc27 added inline comments.


================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp:185
     int64_t ShiftedVal = Val >> TrailingZeros;
-    RISCVMatInt::InstSeq TmpSeq;
-    generateInstSeqImpl(ShiftedVal, ActiveFeatures, TmpSeq);
-    TmpSeq.push_back(RISCVMatInt::Inst(RISCV::SLLI, TrailingZeros));
+    // If we can use LI+SLLI instead of LUI+ADDI(W) prefer that since its more
+    // compressible.
----------------
This is confusing, LI is a pseudo implemented using this function but here you mean it to be what C.LI expands to. Though it doesn’t help there’s the LI alias that’s deemed canonical (which I don’t like but came from binutils).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139135



More information about the llvm-commits mailing list