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

Baoshan Pang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 5 17:43:50 PST 2022


BaoshanPang marked 4 inline comments as done.
BaoshanPang added a comment.

@craig.topper

Please help to check the code again. Thanks.



================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp:343
+    int Rotate;
+    if (extractRotateInfo(Val, NegImm12, Rotate)) {
+      RISCVMatInt::InstSeq TmpSeq;
----------------
craig.topper wrote:
> 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"
Great idea. The code is much simpler now.


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