[llvm] r294852 - [X86] Merge repeated getScalarValueSizeInBits calls. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 11 08:42:08 PST 2017
Author: rksimon
Date: Sat Feb 11 10:42:07 2017
New Revision: 294852
URL: http://llvm.org/viewvc/llvm-project?rev=294852&view=rev
Log:
[X86] Merge repeated getScalarValueSizeInBits calls. NFCI.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=294852&r1=294851&r2=294852&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Feb 11 10:42:07 2017
@@ -5162,6 +5162,9 @@ static bool getTargetConstantBitsFromNod
assert((SizeInBits % EltSizeInBits) == 0 && "Can't split constant!");
unsigned NumElts = SizeInBits / EltSizeInBits;
+ unsigned SrcEltSizeInBits = VT.getScalarSizeInBits();
+ unsigned NumSrcElts = SizeInBits / SrcEltSizeInBits;
+
// Extract all the undef/constant element data and pack into single bitsets.
APInt UndefBits(SizeInBits, 0);
APInt MaskBits(SizeInBits, 0);
@@ -5214,7 +5217,6 @@ static bool getTargetConstantBitsFromNod
// Extract constant bits from build vector.
if (ISD::isBuildVectorOfConstantSDNodes(Op.getNode())) {
- unsigned SrcEltSizeInBits = VT.getScalarSizeInBits();
for (unsigned i = 0, e = Op.getNumOperands(); i != e; ++i) {
const SDValue &Src = Op.getOperand(i);
if (Src.isUndef()) {
@@ -5249,15 +5251,13 @@ static bool getTargetConstantBitsFromNod
// Extract constant bits from a broadcasted constant pool scalar.
if (Op.getOpcode() == X86ISD::VBROADCAST &&
- EltSizeInBits <= Op.getScalarValueSizeInBits()) {
+ EltSizeInBits <= SrcEltSizeInBits) {
if (auto *Broadcast = getTargetConstantFromNode(Op.getOperand(0))) {
APInt Bits, Undefs;
if (ExtractConstantBits(Broadcast, Bits, Undefs)) {
- unsigned NumBroadcastBits = Op.getScalarValueSizeInBits();
- unsigned NumBroadcastElts = SizeInBits / NumBroadcastBits;
- for (unsigned i = 0; i != NumBroadcastElts; ++i) {
- MaskBits |= Bits.shl(i * NumBroadcastBits);
- UndefBits |= Undefs.shl(i * NumBroadcastBits);
+ for (unsigned i = 0; i != NumSrcElts; ++i) {
+ MaskBits |= Bits.shl(i * SrcEltSizeInBits);
+ UndefBits |= Undefs.shl(i * SrcEltSizeInBits);
}
return SplitBitData();
}
More information about the llvm-commits
mailing list