summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2017-02-22 15:04:55 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2017-02-22 15:04:55 +0000
commit3a895c48732ab84b68e2453a8b869cc9c5050e9a (patch)
tree31a0915edf2018b6379fafc2abaecff61c1c2a1f /llvm/lib/Target
parenta6f369c7276ede7a0613aff3b5ecb37a22b3d3eb (diff)
downloadbcm5719-llvm-3a895c48732ab84b68e2453a8b869cc9c5050e9a.tar.gz
bcm5719-llvm-3a895c48732ab84b68e2453a8b869cc9c5050e9a.zip
[X86][SSE] Use APInt::getBitsSet() instead of APInt::getLowBitsSet().shl() separately. NFCI.
llvm-svn: 295845
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp7
-rw-r--r--llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp11
2 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index faabe37d4fa..e0aafe3692a 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -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();
}
diff --git a/llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp b/llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
index 11115524c81..4d278d4b05a 100644
--- a/llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
+++ b/llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
@@ -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.
OpenPOWER on IntegriCloud