[llvm] r295845 - [X86][SSE] Use APInt::getBitsSet() instead of APInt::getLowBitsSet().shl() separately. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 22 07:04:55 PST 2017
Author: rksimon
Date: Wed Feb 22 09:04:55 2017
New Revision: 295845
URL: http://llvm.org/viewvc/llvm-project?rev=295845&view=rev
Log:
[X86][SSE] Use APInt::getBitsSet() instead of APInt::getLowBitsSet().shl() separately. NFCI.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=295845&r1=295844&r2=295845&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Feb 22 09:04:55 2017
@@ -5239,14 +5239,15 @@ static bool getTargetConstantBitsFromNod
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();
}
Modified: llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp?rev=295845&r1=295844&r2=295845&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp Wed Feb 22 09:04:55 2017
@@ -57,15 +57,16 @@ static bool extractConstantMask(const Co
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.
More information about the llvm-commits
mailing list