[llvm] r275262 - [X86][SSE] Check for lane crossing shuffles before trying to combine to PSHUFB
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 13 05:48:41 PDT 2016
Author: rksimon
Date: Wed Jul 13 07:48:41 2016
New Revision: 275262
URL: http://llvm.org/viewvc/llvm-project?rev=275262&view=rev
Log:
[X86][SSE] Check for lane crossing shuffles before trying to combine to PSHUFB
Removes a return-on-fail that was making it tricky to add other variable mask shuffles.
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=275262&r1=275261&r2=275262&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jul 13 07:48:41 2016
@@ -25082,6 +25082,14 @@ static bool combineX86ShuffleChain(SDVal
if (MaskEltSizeInBits > 64)
return false;
+ // Determine the effective mask value type.
+ bool FloatDomain =
+ (VT.isFloatingPoint() || (VT.is256BitVector() && !Subtarget.hasAVX2())) &&
+ (32 <= MaskEltSizeInBits);
+ MVT MaskVT = FloatDomain ? MVT::getFloatingPointVT(MaskEltSizeInBits)
+ : MVT::getIntegerVT(MaskEltSizeInBits);
+ MaskVT = MVT::getVectorVT(MaskVT, NumMaskElts);
+
// Attempt to match the mask against known shuffle patterns.
MVT ShuffleVT;
unsigned Shuffle, PermuteImm;
@@ -25130,11 +25138,7 @@ static bool combineX86ShuffleChain(SDVal
(Subtarget.hasAVX() && VT.is256BitVector()))) {
// Convert VT to a type compatible with X86ISD::BLENDI.
// TODO - add 16i16 support (requires lane duplication).
- bool FloatDomain = VT.isFloatingPoint();
- MVT ShuffleVT = FloatDomain ? MVT::getFloatingPointVT(MaskEltSizeInBits)
- : MVT::getIntegerVT(MaskEltSizeInBits);
- ShuffleVT = MVT::getVectorVT(ShuffleVT, NumMaskElts);
-
+ MVT ShuffleVT = MaskVT;
if (Subtarget.hasAVX2()) {
if (ShuffleVT == MVT::v4i64)
ShuffleVT = MVT::v8i32;
@@ -25213,6 +25217,7 @@ static bool combineX86ShuffleChain(SDVal
// instructions, but in practice PSHUFB tends to be *very* fast so we're
// more aggressive.
if ((Depth >= 3 || HasVariableMask) &&
+ !is128BitLaneCrossingShuffleMask(MaskVT, Mask) &&
((VT.is128BitVector() && Subtarget.hasSSSE3()) ||
(VT.is256BitVector() && Subtarget.hasAVX2()) ||
(VT.is512BitVector() && Subtarget.hasBWI()))) {
@@ -25230,9 +25235,7 @@ static bool combineX86ShuffleChain(SDVal
continue;
}
M = Ratio * M + i % Ratio;
- // Check that we are not crossing lanes.
- if ((M / 16) != (i / 16))
- return false;
+ assert ((M / 16) == (i / 16) && "Lane crossing detected");
PSHUFBMask.push_back(DAG.getConstant(M, DL, MVT::i8));
}
MVT ByteVT = MVT::getVectorVT(MVT::i8, NumBytes);
More information about the llvm-commits
mailing list