[PATCH] D81006: [PowerPC] fix a bug for folding RLWINM(LI) to LI due to wrap mask
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 5 19:32:21 PDT 2020
shchenz marked an inline comment as done.
shchenz 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
----------------
steven.zhang wrote:
> 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.
Yeah, Good idea. We should differentiate `getBitsSetWithWrap` & `getBitsSet` when `lo == hi`. I will post a `APInt` patch soon to improve this.
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