forked from OSchip/llvm-project
[APInt] Move APInt::getSplat out of line.
I think this method is probably too complex to be inlined. llvm-svn: 301901
This commit is contained in:
parent
1e91919ac1
commit
9881bd9c1d
|
@ -617,15 +617,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Return a value containing V broadcasted over NewLen bits.
|
/// \brief Return a value containing V broadcasted over NewLen bits.
|
||||||
static APInt getSplat(unsigned NewLen, const APInt &V) {
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \brief Determine if two APInts have the same value, after zero-extending
|
/// \brief Determine if two APInts have the same value, after zero-extending
|
||||||
/// one of them (if needed!) to ensure that the bit-widths match.
|
/// one of them (if needed!) to ensure that the bit-widths match.
|
||||||
|
|
|
@ -609,6 +609,17 @@ APInt APInt::getLoBits(unsigned numBits) const {
|
||||||
return Result;
|
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 APInt::countLeadingZerosSlowCase() const {
|
||||||
unsigned Count = 0;
|
unsigned Count = 0;
|
||||||
for (int i = getNumWords()-1; i >= 0; --i) {
|
for (int i = getNumWords()-1; i >= 0; --i) {
|
||||||
|
|
Loading…
Reference in New Issue