forked from OSchip/llvm-project
[X86][SSE] Use APInt::getBitsSet() instead of APInt::getLowBitsSet().shl() separately. NFCI.
llvm-svn: 295845
This commit is contained in:
parent
a6f369c727
commit
3a895c4873
|
@ -5239,14 +5239,15 @@ static bool getTargetConstantBitsFromNode(SDValue Op, unsigned EltSizeInBits,
|
|||
if (ISD::isBuildVectorOfConstantSDNodes(Op.getNode())) {
|
||||
for (unsigned i = 0, e = Op.getNumOperands(); i != e; ++i) {
|
||||
const SDValue &Src = Op.getOperand(i);
|
||||
unsigned BitOffset = i * SrcEltSizeInBits;
|
||||
if (Src.isUndef()) {
|
||||
APInt Undefs = APInt::getLowBitsSet(SizeInBits, SrcEltSizeInBits);
|
||||
UndefBits |= Undefs.shl(i * SrcEltSizeInBits);
|
||||
unsigned HiBits = BitOffset + SrcEltSizeInBits;
|
||||
UndefBits |= APInt::getBitsSet(SizeInBits, BitOffset, HiBits);
|
||||
continue;
|
||||
}
|
||||
auto *Cst = cast<ConstantSDNode>(Src);
|
||||
APInt Bits = Cst->getAPIntValue().zextOrTrunc(SrcEltSizeInBits);
|
||||
MaskBits |= Bits.zext(SizeInBits).shl(i * SrcEltSizeInBits);
|
||||
MaskBits |= Bits.zext(SizeInBits).shl(BitOffset);
|
||||
}
|
||||
return SplitBitData();
|
||||
}
|
||||
|
|
|
@ -57,15 +57,16 @@ static bool extractConstantMask(const Constant *C, unsigned MaskEltSizeInBits,
|
|||
if (!COp || (!isa<UndefValue>(COp) && !isa<ConstantInt>(COp)))
|
||||
return false;
|
||||
|
||||
unsigned BitOffset = i * CstEltSizeInBits;
|
||||
|
||||
if (isa<UndefValue>(COp)) {
|
||||
APInt EltUndef = APInt::getLowBitsSet(CstSizeInBits, CstEltSizeInBits);
|
||||
UndefBits |= EltUndef.shl(i * CstEltSizeInBits);
|
||||
unsigned HiBits = BitOffset + CstEltSizeInBits;
|
||||
UndefBits |= APInt::getBitsSet(CstSizeInBits, BitOffset, HiBits);
|
||||
continue;
|
||||
}
|
||||
|
||||
APInt EltBits = cast<ConstantInt>(COp)->getValue();
|
||||
EltBits = EltBits.zextOrTrunc(CstSizeInBits);
|
||||
MaskBits |= EltBits.shl(i * CstEltSizeInBits);
|
||||
auto *Elt = cast<ConstantInt>(COp);
|
||||
MaskBits |= Elt->getValue().zextOrTrunc(CstSizeInBits).shl(BitOffset);
|
||||
}
|
||||
|
||||
// Now extract the undef/constant bit data into the raw shuffle masks.
|
||||
|
|
Loading…
Reference in New Issue