[PATCH] D116574: [RISCV] Materializing constants with 'rori'

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 5 15:11:51 PST 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp:343
+    int Rotate;
+    if (extractRotateInfo(Val, NegImm12, Rotate)) {
+      RISCVMatInt::InstSeq TmpSeq;
----------------
craig.topper wrote:
> You could return `Rotate` from the function instead of a bool and use 0 to mean no rotate.
> 
> And instead of having NegImm12 as an output parameter, you could use the returned Rotate amount to rotate Val left in this if block before using it in the ADDI. That way you wouldn't have two different places in extractRotateInfo rotating Val left to commute NegImm12.
Err... that should have said "compute" not "commute"


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116574



More information about the llvm-commits mailing list