From 9881bd9c1d624a1e5261606dd724223a9207abbb Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 2 May 2017 06:32:27 +0000 Subject: [APInt] Move APInt::getSplat out of line. I think this method is probably too complex to be inlined. llvm-svn: 301901 --- llvm/lib/Support/APInt.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'llvm/lib/Support/APInt.cpp') diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index e01e6f5..b6c8cbe 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) { -- cgit v1.1