[APInt] Add support for multiplying by a uint64_t.

This makes multiply similar to add, sub, xor, and, and or.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302402 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper
2017-05-08 04:55:09 +00:00
parent 20c59f10e5
commit 1e5158d3c8
3 changed files with 40 additions and 0 deletions
+10
View File
@@ -256,6 +256,16 @@ APInt& APInt::operator*=(const APInt& RHS) {
return *this;
}
APInt& APInt::operator*=(uint64_t RHS) {
if (isSingleWord()) {
U.VAL *= RHS;
} else {
unsigned NumWords = getNumWords();
tcMultiplyPart(U.pVal, U.pVal, RHS, 0, NumWords, NumWords, false);
}
return clearUnusedBits();
}
bool APInt::EqualSlowCase(const APInt& RHS) const {
return std::equal(U.pVal, U.pVal + getNumWords(), RHS.U.pVal);
}