diff options
author | Craig Topper <craig.topper@gmail.com> | 2017-02-11 22:57:12 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2017-02-11 22:57:12 +0000 |
commit | 1c37e991e66592f31338b7b59f76ca7652da2aa3 (patch) | |
tree | dcb40b7a65e08b6afd5ee4f126dffba503314816 /llvm/lib/Target/X86/X86ISelLowering.cpp | |
parent | b633adedc75c0e450cef812dabe55dd0ee19040b (diff) | |
download | bcm5719-llvm-1c37e991e66592f31338b7b59f76ca7652da2aa3.tar.gz bcm5719-llvm-1c37e991e66592f31338b7b59f76ca7652da2aa3.zip |
[X86] Move code for using blendi for insert_subvector out to an isel pattern. This gives the DAG combiner more opportunity to optimize without needing to dig through the blend.
llvm-svn: 294876
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index e7417b75ae7..0de7d1c173c 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -34152,33 +34152,6 @@ static SDValue combineInsertSubvector(SDNode *N, SelectionDAG &DAG, MVT OpVT = N->getSimpleValueType(0); MVT SubVecVT = SubVec.getSimpleValueType(); - // For insertion into the zero index (low half) of a 256-bit vector, it is - // more efficient to generate a blend with immediate instead of an insert*128. - // We are still creating an INSERT_SUBVECTOR below with an undef node to - // extend the subvector to the size of the result vector. Make sure that - // we are not recursing on that node by checking for undef here. - if (IdxVal == 0 && OpVT.is256BitVector() && !Vec.isUndef()) { - SDValue Vec256 = DAG.getNode(ISD::INSERT_SUBVECTOR, dl, OpVT, - DAG.getUNDEF(OpVT), SubVec, N->getOperand(2)); - - // Integers must be cast to 32-bit because there is only vpblendd; - // vpblendw can't be used for this because it has a handicapped mask. - // If we don't have AVX2, then cast to float. Using a wrong domain blend - // is still more efficient than using the wrong domain vinsertf128 that - // will be created by InsertSubVector(). - MVT CastVT = OpVT; - if (OpVT.isInteger()) - CastVT = Subtarget.hasAVX2() ? MVT::v8i32 : MVT::v8f32; - - // The blend instruction, and therefore its mask, depend on the data type. - unsigned MaskVal = CastVT.getScalarSizeInBits() == 64 ? 0x03 : 0x0f; - SDValue Mask = DAG.getConstant(MaskVal, dl, MVT::i8); - Vec = DAG.getBitcast(CastVT, Vec); - Vec256 = DAG.getBitcast(CastVT, Vec256); - Vec256 = DAG.getNode(X86ISD::BLENDI, dl, CastVT, Vec, Vec256, Mask); - return DAG.getBitcast(OpVT, Vec256); - } - // If we're inserting into the upper half of a 256-bit vector with a vector // that was extracted from the upper half of a 256-bit vector, we should // use a blend instead. |