[PATCH] D81006: [PowerPC] fix a bug for folding RLWINM(LI) to LI due to wrap mask

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 17:54:46 PDT 2020


steven.zhang added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:3420
     InVal = InVal.rotl(SH);
-    // Set the bits (        MB + 32        ) to (        ME + 32        ).
-    uint64_t Mask = ((1LLU << (32 - MB)) - 1) & ~((1LLU << (31 - ME)) - 1);
+    APInt Mask = APInt::getBitsSetWithWrap(32, 32 - ME - 1, 32 - MB);
+    // Current APInt::getBitsSetWithWrap sets all bits to 0 if loBit is equal
----------------
Can we fix this in the wrap?It does nothing now if lo == hi. But as it is [lo,hi), if lo == hi, we expect it to be all ones if it is with wrap.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81006





More information about the llvm-commits mailing list