[llvm] r268306 - [X86][SSE] Added placeholder for 128/256-bit wide shuffle combines
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon May 2 14:12:48 PDT 2016
Author: rksimon
Date: Mon May 2 16:12:48 2016
New Revision: 268306
URL: http://llvm.org/viewvc/llvm-project?rev=268306&view=rev
Log:
[X86][SSE] Added placeholder for 128/256-bit wide shuffle combines
Begun adding placeholder for future support for vperm2f128/vshuff64x2 style 128/256-bit wide 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=268306&r1=268305&r2=268306&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon May 2 16:12:48 2016
@@ -23999,13 +23999,21 @@ static bool combineX86ShuffleChain(SDVal
SDValue Res;
- if (Mask.size() == 1) {
+ unsigned NumMaskElts = Mask.size();
+ if (NumMaskElts == 1) {
assert(Mask[0] == 0 && "Invalid shuffle index found!");
DCI.CombineTo(Root.getNode(), DAG.getBitcast(RootVT, Input),
/*AddTo*/ true);
return true;
}
+ unsigned RootSizeInBits = RootVT.getSizeInBits();
+ unsigned MaskEltSizeInBits = RootSizeInBits / NumMaskElts;
+
+ // TODO - handle 128/256-bit wide vector shuffles.
+ if (MaskEltSizeInBits > 64)
+ return false;
+
// Use the float domain if the operand type is a floating point type.
bool FloatDomain = VT.isFloatingPoint();
@@ -24093,7 +24101,7 @@ static bool combineX86ShuffleChain(SDVal
if (Depth == 1 && Root->getOpcode() == Shuffle)
return false; // Nothing to do!
MVT ShuffleVT;
- switch (Mask.size()) {
+ switch (NumMaskElts) {
case 8:
ShuffleVT = MVT::v8i16;
break;
@@ -24133,12 +24141,12 @@ static bool combineX86ShuffleChain(SDVal
ShuffleVT = MVT::v8f32;
}
- if (isSequentialOrUndefOrZeroInRange(Mask, /*Pos*/ 0, /*Size*/ Mask.size(),
+ if (isSequentialOrUndefOrZeroInRange(Mask, /*Pos*/ 0, /*Size*/ NumMaskElts,
/*Low*/ 0) &&
- Mask.size() <= ShuffleVT.getVectorNumElements()) {
+ NumMaskElts <= ShuffleVT.getVectorNumElements()) {
unsigned BlendMask = 0;
unsigned ShuffleSize = ShuffleVT.getVectorNumElements();
- unsigned MaskRatio = ShuffleSize / Mask.size();
+ unsigned MaskRatio = ShuffleSize / NumMaskElts;
if (Depth == 1 && Root.getOpcode() == X86ISD::BLENDI)
return false;
@@ -24174,7 +24182,7 @@ static bool combineX86ShuffleChain(SDVal
(VT.is512BitVector() && Subtarget.hasBWI()))) {
SmallVector<SDValue, 16> PSHUFBMask;
int NumBytes = VT.getSizeInBits() / 8;
- int Ratio = NumBytes / Mask.size();
+ int Ratio = NumBytes / NumMaskElts;
for (int i = 0; i < NumBytes; ++i) {
int M = Mask[i / Ratio];
if (M == SM_SentinelUndef) {
More information about the llvm-commits
mailing list