From: Craig Topper Date: Tue, 2 May 2017 06:32:27 +0000 (+0000) Subject: [APInt] Move APInt::getSplat out of line. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d66f52694bdfabf0081a1d40b99fca0c189a988;p=llvm [APInt] Move APInt::getSplat out of line. I think this method is probably too complex to be inlined. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301901 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index dd12d51e7bd..6d74f344aad 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -617,15 +617,7 @@ public: } /// \brief Return a value containing V broadcasted over NewLen bits. - static APInt getSplat(unsigned NewLen, const APInt &V) { - assert(NewLen >= V.getBitWidth() && "Can't splat to smaller bit width!"); - - APInt Val = V.zextOrSelf(NewLen); - for (unsigned I = V.getBitWidth(); I < NewLen; I <<= 1) - Val |= Val << I; - - return Val; - } + static APInt getSplat(unsigned NewLen, const APInt &V); /// \brief Determine if two APInts have the same value, after zero-extending /// one of them (if needed!) to ensure that the bit-widths match. diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index e01e6f5e79f..b6c8cbee66d 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -609,6 +609,17 @@ APInt APInt::getLoBits(unsigned numBits) const { return Result; } +/// Return a value containing V broadcasted over NewLen bits. +APInt APInt::getSplat(unsigned NewLen, const APInt &V) { + assert(NewLen >= V.getBitWidth() && "Can't splat to smaller bit width!"); + + APInt Val = V.zextOrSelf(NewLen); + for (unsigned I = V.getBitWidth(); I < NewLen; I <<= 1) + Val |= Val << I; + + return Val; +} + unsigned APInt::countLeadingZerosSlowCase() const { unsigned Count = 0; for (int i = getNumWords()-1; i >= 0; --i) {