mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Move the SplatByte helper to APInt and generalize it a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175621 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -505,6 +505,17 @@ public:
|
||||
return getAllOnesValue(numBits).lshr(numBits - loBitsSet);
|
||||
}
|
||||
|
||||
/// \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;
|
||||
}
|
||||
|
||||
/// \brief Determine if two APInts have the same value, after zero-extending
|
||||
/// one of them (if needed!) to ensure that the bit-widths match.
|
||||
static bool isSameValue(const APInt &I1, const APInt &I2) {
|
||||
|
Reference in New Issue
Block a user