diff options
| author | Craig Topper <craig.topper@gmail.com> | 2017-05-02 06:32:27 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2017-05-02 06:32:27 +0000 |
| commit | 9881bd9c1d624a1e5261606dd724223a9207abbb (patch) | |
| tree | 79113bbaac240c2913aba2ced314a57b753b7e2d | |
| parent | 1e91919ac1853e2a1296f96407894fbc9964d37a (diff) | |
| download | bcm5719-llvm-9881bd9c1d624a1e5261606dd724223a9207abbb.tar.gz bcm5719-llvm-9881bd9c1d624a1e5261606dd724223a9207abbb.zip | |
[APInt] Move APInt::getSplat out of line.
I think this method is probably too complex to be inlined.
llvm-svn: 301901
| -rw-r--r-- | llvm/include/llvm/ADT/APInt.h | 10 | ||||
| -rw-r--r-- | llvm/lib/Support/APInt.cpp | 11 |
2 files changed, 12 insertions, 9 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index dd12d51e7bd..6d74f344aad 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/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/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index e01e6f5e79f..b6c8cbee66d 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/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) { |

