diff options
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp | 7 |
2 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 618d7a8c561..348f8308099 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -5207,8 +5207,8 @@ static bool getTargetConstantBitsFromNode(SDValue Op, unsigned EltSizeInBits, EltBits.resize(NumElts, APInt(EltSizeInBits, 0)); for (unsigned i = 0; i != NumElts; ++i) { - APInt UndefEltBits = UndefBits.lshr(i * EltSizeInBits); - UndefEltBits = UndefEltBits.zextOrTrunc(EltSizeInBits); + unsigned BitOffset = i * EltSizeInBits; + APInt UndefEltBits = UndefBits.extractBits(EltSizeInBits, BitOffset); // Only treat an element as UNDEF if all bits are UNDEF. if (UndefEltBits.isAllOnesValue()) { @@ -5223,7 +5223,7 @@ static bool getTargetConstantBitsFromNode(SDValue Op, unsigned EltSizeInBits, if (UndefEltBits.getBoolValue() && !AllowPartialUndefs) return false; - APInt Bits = MaskBits.lshr(i * EltSizeInBits).zextOrTrunc(EltSizeInBits); + APInt Bits = MaskBits.extractBits(EltSizeInBits, BitOffset); EltBits[i] = Bits.getZExtValue(); } return true; @@ -6421,7 +6421,7 @@ static Constant *getConstantVector(MVT VT, const APInt &SplatValue, SmallVector<Constant *, 32> ConstantVec; for (unsigned i = 0; i < NumElm; i++) { - APInt Val = SplatValue.lshr(ScalarSize * i).trunc(ScalarSize); + APInt Val = SplatValue.extractBits(ScalarSize, ScalarSize * i); Constant *Const; if (VT.isFloatingPoint()) { assert((ScalarSize == 32 || ScalarSize == 64) && diff --git a/llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp b/llvm/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp index 41ad0971461..c24b74f7480 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) { - APInt EltUndef = UndefBits.lshr(i * MaskEltSizeInBits); - EltUndef = EltUndef.zextOrTrunc(MaskEltSizeInBits); + unsigned BitOffset = i * MaskEltSizeInBits; + APInt EltUndef = UndefBits.extractBits(MaskEltSizeInBits, BitOffset); // Only treat the element as UNDEF if all bits are UNDEF, otherwise // treat it as zero. @@ -88,8 +88,7 @@ static bool extractConstantMask(const Constant *C, unsigned MaskEltSizeInBits, continue; } - APInt EltBits = MaskBits.lshr(i * MaskEltSizeInBits); - EltBits = EltBits.zextOrTrunc(MaskEltSizeInBits); + APInt EltBits = MaskBits.extractBits(MaskEltSizeInBits, BitOffset); RawMask[i] = EltBits.getZExtValue(); } |