diff options
author | Craig Topper <craig.topper@gmail.com> | 2017-05-08 04:55:09 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2017-05-08 04:55:09 +0000 |
commit | a51941f3140cf0ed5c79bf828ff3e418fc5df71d (patch) | |
tree | 54fc19ee211c039772021e5d0d50001100cf9d31 /llvm/lib/Support/APInt.cpp | |
parent | cd704cb6c4290643f232dc7e22b938705909dd6f (diff) | |
download | bcm5719-llvm-a51941f3140cf0ed5c79bf828ff3e418fc5df71d.tar.gz bcm5719-llvm-a51941f3140cf0ed5c79bf828ff3e418fc5df71d.zip |
[APInt] Add support for multiplying by a uint64_t.
This makes multiply similar to add, sub, xor, and, and or.
llvm-svn: 302402
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index ee5c9f9a577..e2cfb90d9e2 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -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); } |