forked from OSchip/llvm-project
Use x86 specific MOVSLDUP node, add more patterns to match it and remove useless load nodes
llvm-svn: 112661
This commit is contained in:
parent
9129998061
commit
4b56d87290
|
@ -2587,6 +2587,7 @@ static bool isTargetShuffle(unsigned Opcode) {
|
|||
case X86ISD::MOVLHPS:
|
||||
case X86ISD::MOVHLPS:
|
||||
case X86ISD::MOVSHDUP:
|
||||
case X86ISD::MOVSLDUP:
|
||||
case X86ISD::MOVSS:
|
||||
case X86ISD::MOVSD:
|
||||
case X86ISD::PUNPCKLDQ:
|
||||
|
@ -2600,6 +2601,7 @@ static SDValue getTargetShuffleNode(unsigned Opc, DebugLoc dl, EVT VT,
|
|||
switch(Opc) {
|
||||
default: llvm_unreachable("Unknown x86 shuffle node");
|
||||
case X86ISD::MOVSHDUP:
|
||||
case X86ISD::MOVSLDUP:
|
||||
return DAG.getNode(Opc, dl, VT, V1);
|
||||
}
|
||||
|
||||
|
@ -5168,9 +5170,10 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const {
|
|||
if (X86::isMOVSHDUPMask(SVOp) && HasSSE3 && V2IsUndef && NumElems == 4)
|
||||
return getTargetShuffleNode(X86ISD::MOVSHDUP, dl, VT, V1, DAG);
|
||||
|
||||
if (X86::isMOVSLDUPMask(SVOp) ||
|
||||
X86::isMOVHLPSMask(SVOp) ||
|
||||
X86::isMOVLPMask(SVOp))
|
||||
if (X86::isMOVSLDUPMask(SVOp) && HasSSE3 && V2IsUndef && NumElems == 4)
|
||||
return getTargetShuffleNode(X86ISD::MOVSLDUP, dl, VT, V1, DAG);
|
||||
|
||||
if (X86::isMOVLPMask(SVOp))
|
||||
return Op;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,6 @@ def SDTShuff2OpI : SDTypeProfile<1, 2, [SDTCisVec<0>,
|
|||
def SDTShuff3OpI : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0,1>,
|
||||
SDTCisSameAs<0,2>, SDTCisInt<3>]>;
|
||||
|
||||
def SDTShuff1OpLd : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisPtrTy<1>]>;
|
||||
def SDTShuff2OpLd : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
|
||||
SDTCisPtrTy<2>]>;
|
||||
|
||||
|
@ -157,11 +156,6 @@ def X86Movddup : SDNode<"X86ISD::MOVDDUP", SDTShuff1Op>;
|
|||
def X86Movshdup : SDNode<"X86ISD::MOVSHDUP", SDTShuff1Op>;
|
||||
def X86Movsldup : SDNode<"X86ISD::MOVSLDUP", SDTShuff1Op>;
|
||||
|
||||
def X86MovshdupLd : SDNode<"X86ISD::MOVSHDUP_LD", SDTShuff1OpLd,
|
||||
[SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
|
||||
def X86MovsldupLd : SDNode<"X86ISD::MOVSLDUP_LD", SDTShuff1OpLd,
|
||||
[SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
|
||||
|
||||
def X86Movsd : SDNode<"X86ISD::MOVSD", SDTShuff2Op>;
|
||||
def X86Movss : SDNode<"X86ISD::MOVSS", SDTShuff2Op>;
|
||||
|
||||
|
|
|
@ -5847,7 +5847,7 @@ def : Pat<(v4i32 (X86Movsd VR128:$src1, VR128:$src2)),
|
|||
// Shuffle with MOVSHDUP
|
||||
def : Pat<(v4i32 (X86Movshdup VR128:$src)),
|
||||
(MOVSHDUPrr VR128:$src)>;
|
||||
def : Pat<(v4i32 (X86Movshdup (bc_v4i32 (memopv2i64 addr:$src)))),
|
||||
def : Pat<(X86Movshdup (bc_v4i32 (memopv2i64 addr:$src))),
|
||||
(MOVSHDUPrm addr:$src)>;
|
||||
|
||||
def : Pat<(v4f32 (X86Movshdup VR128:$src)),
|
||||
|
@ -5858,12 +5858,12 @@ def : Pat<(X86Movshdup (memopv4f32 addr:$src)),
|
|||
// Shuffle with MOVSLDUP
|
||||
def : Pat<(v4i32 (X86Movsldup VR128:$src)),
|
||||
(MOVSLDUPrr VR128:$src)>;
|
||||
def : Pat<(v4i32 (X86MovsldupLd addr:$src)),
|
||||
def : Pat<(X86Movsldup (bc_v4i32 (memopv2i64 addr:$src))),
|
||||
(MOVSLDUPrm addr:$src)>;
|
||||
|
||||
def : Pat<(v4f32 (X86Movsldup VR128:$src)),
|
||||
(MOVSLDUPrr VR128:$src)>;
|
||||
def : Pat<(v4f32 (X86MovsldupLd addr:$src)),
|
||||
def : Pat<(X86Movsldup (memopv4f32 addr:$src)),
|
||||
(MOVSLDUPrm addr:$src)>;
|
||||
|
||||
// Shuffle with PSHUFHW
|
||||
|
|
Loading…
Reference in New Issue