[PATCH] D80907: [PowerPC] refactor convertToImmediateForm - NFC

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 2 02:12:44 PDT 2020


steven.zhang added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:2659
   // If this is a reg+reg instruction that has a reg+imm form,
   // and one of the operands is produced by LI, convert it now.
   if (HasImmForm)
----------------
shchenz wrote:
> steven.zhang wrote:
> > Please update the comments as it is NOT always LI now.
> Not very clear about this comment.
> 
> `transformToImmFormFedByLI` will check LI opcode inside it like other functions `transformToImmFormFedByLI` & `simplifyToLI`
Before moving the transformToImmFormFedByLi into the if clause, the comments didn't align with the implementation. It is ok now.


================
Comment at: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:3421
+    // Set the bits (        MB + 32        ) to (        ME + 32        ).
+    uint64_t Mask = ((1LLU << (32 - MB)) - 1) & ~((1LLU << (31 - ME)) - 1);
+    InVal &= Mask;
----------------
It can be improved with APInt utility.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80907





More information about the llvm-commits mailing list