summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2017-02-24 18:31:04 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2017-02-24 18:31:04 +0000
commitcdf2bd656a68b614a2224d69072f43690b5141d2 (patch)
treeabbb2a37bd01ef815b2976005c000bb2b4635f76 /llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
parentb078439250daafafa7e0ac01b11beed071566d5b (diff)
downloadbcm5719-llvm-cdf2bd656a68b614a2224d69072f43690b5141d2.tar.gz
bcm5719-llvm-cdf2bd656a68b614a2224d69072f43690b5141d2.zip
Revert: r296141 [APInt] Add APInt::extractBits() method to extract APInt subrange
The current pattern for extract bits in range is typically: Mask.lshr(BitOffset).trunc(SubSizeInBits); Which can be particularly slow for large APInts (MaskSizeInBits > 64) as they require the allocation of memory for the temporary variable. This is another of the compile time issues identified in PR32037 (see also D30265). This patch adds the APInt::extractBits() helper method which avoids the temporary memory allocation. Differential Revision: https://reviews.llvm.org/D30336 llvm-svn: 296147
Diffstat (limited to 'llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp')
-rw-r--r--llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp b/llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
index c24b74f7480..41ad0971461 100644
--- a/llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
+++ b/llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp
@@ -77,8 +77,8 @@ static bool extractConstantMask(const Constant *C, unsigned MaskEltSizeInBits,
RawMask.resize(NumMaskElts, 0);
for (unsigned i = 0; i != NumMaskElts; ++i) {
- unsigned BitOffset = i * MaskEltSizeInBits;
- APInt EltUndef = UndefBits.extractBits(MaskEltSizeInBits, BitOffset);
+ APInt EltUndef = UndefBits.lshr(i * MaskEltSizeInBits);
+ EltUndef = EltUndef.zextOrTrunc(MaskEltSizeInBits);
// Only treat the element as UNDEF if all bits are UNDEF, otherwise
// treat it as zero.
@@ -88,7 +88,8 @@ static bool extractConstantMask(const Constant *C, unsigned MaskEltSizeInBits,
continue;
}
- APInt EltBits = MaskBits.extractBits(MaskEltSizeInBits, BitOffset);
+ APInt EltBits = MaskBits.lshr(i * MaskEltSizeInBits);
+ EltBits = EltBits.zextOrTrunc(MaskEltSizeInBits);
RawMask[i] = EltBits.getZExtValue();
}
OpenPOWER on IntegriCloud