[APInt] Rewrite getLoBits in a way that will do one less memory allocation in the multiword case. Rewrite getHiBits to use the class method version of lshr instead of the one in APIntOps. NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299243 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper
2017-03-31 18:48:14 +00:00
parent 3eae0cb165
commit 406105d95e
2 changed files with 22 additions and 3 deletions
+4 -3
View File
@@ -724,13 +724,14 @@ bool APInt::isSplat(unsigned SplatSizeInBits) const {
/// This function returns the high "numBits" bits of this APInt.
APInt APInt::getHiBits(unsigned numBits) const {
return APIntOps::lshr(*this, BitWidth - numBits);
return this->lshr(BitWidth - numBits);
}
/// This function returns the low "numBits" bits of this APInt.
APInt APInt::getLoBits(unsigned numBits) const {
return APIntOps::lshr(APIntOps::shl(*this, BitWidth - numBits),
BitWidth - numBits);
APInt Result(getLowBitsSet(BitWidth, numBits));
Result &= *this;
return Result;
}
unsigned APInt::countLeadingZerosSlowCase() const {