From a51941f3140cf0ed5c79bf828ff3e418fc5df71d Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 8 May 2017 04:55:09 +0000 Subject: [APInt] Add support for multiplying by a uint64_t. This makes multiply similar to add, sub, xor, and, and or. llvm-svn: 302402 --- llvm/lib/Support/APInt.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/Support/APInt.cpp') 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); } -- cgit v1.2.3