[llvm] r314656 - [X86][SSE] matchBinaryVectorShuffle - add support for different src/dst value shuffle types
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 2 02:45:09 PDT 2017
Author: rksimon
Date: Mon Oct 2 02:45:08 2017
New Revision: 314656
URL: http://llvm.org/viewvc/llvm-project?rev=314656&view=rev
Log:
[X86][SSE] matchBinaryVectorShuffle - add support for different src/dst value shuffle types
Preparation for support for combining to PACKSS/PACKUS
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=314656&r1=314655&r2=314656&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Oct 2 02:45:08 2017
@@ -27373,7 +27373,7 @@ static bool matchBinaryVectorShuffle(MVT
SDValue &V1, SDValue &V2, SDLoc &DL,
SelectionDAG &DAG,
const X86Subtarget &Subtarget,
- unsigned &Shuffle, MVT &ShuffleVT,
+ unsigned &Shuffle, MVT &SrcVT, MVT &DstVT,
bool IsUnary) {
unsigned EltSizeInBits = MaskVT.getScalarSizeInBits();
@@ -27381,26 +27381,26 @@ static bool matchBinaryVectorShuffle(MVT
if (isTargetShuffleEquivalent(Mask, {0, 0}) && AllowFloatDomain) {
V2 = V1;
Shuffle = X86ISD::MOVLHPS;
- ShuffleVT = MVT::v4f32;
+ SrcVT = DstVT = MVT::v4f32;
return true;
}
if (isTargetShuffleEquivalent(Mask, {1, 1}) && AllowFloatDomain) {
V2 = V1;
Shuffle = X86ISD::MOVHLPS;
- ShuffleVT = MVT::v4f32;
+ SrcVT = DstVT = MVT::v4f32;
return true;
}
if (isTargetShuffleEquivalent(Mask, {0, 3}) && Subtarget.hasSSE2() &&
(AllowFloatDomain || !Subtarget.hasSSE41())) {
std::swap(V1, V2);
Shuffle = X86ISD::MOVSD;
- ShuffleVT = MaskVT;
+ SrcVT = DstVT = MaskVT;
return true;
}
if (isTargetShuffleEquivalent(Mask, {4, 1, 2, 3}) &&
(AllowFloatDomain || !Subtarget.hasSSE41())) {
Shuffle = X86ISD::MOVSS;
- ShuffleVT = MaskVT;
+ SrcVT = DstVT = MaskVT;
return true;
}
}
@@ -27413,9 +27413,9 @@ static bool matchBinaryVectorShuffle(MVT
(MaskVT.is512BitVector() && Subtarget.hasAVX512())) {
if (matchVectorShuffleWithUNPCK(MaskVT, V1, V2, Shuffle, IsUnary, Mask, DL,
DAG, Subtarget)) {
- ShuffleVT = MaskVT;
- if (ShuffleVT.is256BitVector() && !Subtarget.hasAVX2())
- ShuffleVT = (32 == EltSizeInBits ? MVT::v8f32 : MVT::v4f64);
+ SrcVT = DstVT = MaskVT;
+ if (MaskVT.is256BitVector() && !Subtarget.hasAVX2())
+ SrcVT = DstVT = (32 == EltSizeInBits ? MVT::v8f32 : MVT::v4f64);
return true;
}
}
@@ -27748,15 +27748,15 @@ static SDValue combineX86ShuffleChain(Ar
}
if (matchBinaryVectorShuffle(MaskVT, Mask, AllowFloatDomain, AllowIntDomain,
- V1, V2, DL, DAG, Subtarget, Shuffle, ShuffleVT,
- UnaryShuffle)) {
+ V1, V2, DL, DAG, Subtarget, Shuffle, ShuffleSrcVT,
+ ShuffleVT, UnaryShuffle)) {
if (Depth == 1 && Root.getOpcode() == Shuffle)
return SDValue(); // Nothing to do!
if (IsEVEXShuffle && (NumRootElts != ShuffleVT.getVectorNumElements()))
return SDValue(); // AVX512 Writemask clash.
- V1 = DAG.getBitcast(ShuffleVT, V1);
+ V1 = DAG.getBitcast(ShuffleSrcVT, V1);
DCI.AddToWorklist(V1.getNode());
- V2 = DAG.getBitcast(ShuffleVT, V2);
+ V2 = DAG.getBitcast(ShuffleSrcVT, V2);
DCI.AddToWorklist(V2.getNode());
Res = DAG.getNode(Shuffle, DL, ShuffleVT, V1, V2);
DCI.AddToWorklist(Res.getNode());
More information about the llvm-commits
mailing list