diff options
author | Nate Begeman <natebegeman@mac.com> | 2009-04-29 22:47:44 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2009-04-29 22:47:44 +0000 |
commit | b44aad7c75421736354c1f04cd7f824d4720e6ae (patch) | |
tree | 23ef4feb2d2917e632cae10e2d73878b8fba4f3b /lib/Target/X86 | |
parent | 78d63c8f5ce166ad0b96d78d733f3bc4b693dda7 (diff) | |
download | external_llvm-b44aad7c75421736354c1f04cd7f824d4720e6ae.zip external_llvm-b44aad7c75421736354c1f04cd7f824d4720e6ae.tar.gz external_llvm-b44aad7c75421736354c1f04cd7f824d4720e6ae.tar.bz2 |
Fix infinite recursion in the C++ code which handles movddup by making it unnecessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70425 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86')
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 43 | ||||
-rw-r--r-- | lib/Target/X86/X86InstrSSE.td | 16 |
2 files changed, 13 insertions, 46 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index b2ed3b8..72aadef 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -2884,44 +2884,6 @@ static SDValue PromoteSplat(ShuffleVectorSDNode *SV, SelectionDAG &DAG, return DAG.getNode(ISD::BIT_CONVERT, dl, VT, V1); } -/// isVectorLoad - Returns true if the node is a vector load, a scalar -/// load that's promoted to vector, or a load bitcasted. -static bool isVectorLoad(SDValue Op) { - assert(Op.getValueType().isVector() && "Expected a vector type"); - if (Op.getOpcode() == ISD::SCALAR_TO_VECTOR || - Op.getOpcode() == ISD::BIT_CONVERT) { - return isa<LoadSDNode>(Op.getOperand(0)); - } - return isa<LoadSDNode>(Op); -} - - -/// CanonicalizeMovddup - Cannonicalize movddup shuffle to v2f64. -/// -static SDValue CanonicalizeMovddup(ShuffleVectorSDNode *SV, SelectionDAG &DAG, - bool HasSSE3) { - // If we have sse3 and shuffle has more than one use or input is a load, then - // use movddup. Otherwise, use movlhps. - SDValue V1 = SV->getOperand(0); - - bool UseMovddup = HasSSE3 && (!SV->hasOneUse() || isVectorLoad(V1)); - MVT PVT = UseMovddup ? MVT::v2f64 : MVT::v4f32; - MVT VT = SV->getValueType(0); - if (VT == PVT) - return SDValue(SV, 0); - - DebugLoc dl = SV->getDebugLoc(); - V1 = DAG.getNode(ISD::BIT_CONVERT, dl, PVT, V1); - if (PVT.getVectorNumElements() == 2) { - int Mask[2] = { 0, 0 }; - V1 = DAG.getVectorShuffle(PVT, dl, V1, DAG.getUNDEF(PVT), Mask); - } else { - int Mask[4] = { 0, 1, 0, 1 }; - V1 = DAG.getVectorShuffle(PVT, dl, V1, DAG.getUNDEF(PVT), Mask); - } - return DAG.getNode(ISD::BIT_CONVERT, dl, VT, V1); -} - /// getShuffleVectorZeroOrUndef - Return a vector_shuffle of the specified /// vector of zero or undef vector. This produces a shuffle where the low /// element of V2 is swizzled into the zero/undef vector, landing at element @@ -3977,11 +3939,6 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) { if (isZeroShuffle(SVOp)) return getZeroVector(VT, Subtarget->hasSSE2(), DAG, dl); - // Canonicalize movddup shuffles. - if (V2IsUndef && Subtarget->hasSSE2() && VT.getSizeInBits() == 128 && - X86::isMOVDDUPMask(SVOp)) - return CanonicalizeMovddup(SVOp, DAG, Subtarget->hasSSE3()); - // Promote splats to v4f32. if (SVOp->isSplat()) { if (isMMX || NumElems < 4) diff --git a/lib/Target/X86/X86InstrSSE.td b/lib/Target/X86/X86InstrSSE.td index a10f443..d650bb3 100644 --- a/lib/Target/X86/X86InstrSSE.td +++ b/lib/Target/X86/X86InstrSSE.td @@ -748,10 +748,12 @@ def MOVHLPSrr : PSI<0x12, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1, VR128: } // AddedComplexity } // Constraints = "$src1 = $dst" -let AddedComplexity = 20 in +let AddedComplexity = 20 in { def : Pat<(v4f32 (movddup VR128:$src, (undef))), (MOVLHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; - +def : Pat<(v2i64 (movddup VR128:$src, (undef))), + (MOVLHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; +} @@ -2430,9 +2432,17 @@ def MOVDDUPrm : S3DI<0x12, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), def : Pat<(movddup (bc_v2f64 (v2i64 (scalar_to_vector (loadi64 addr:$src)))), (undef)), (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; + +let AddedComplexity = 5 in { def : Pat<(movddup (memopv2f64 addr:$src), (undef)), (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; - +def : Pat<(movddup (bc_v4f32 (memopv2f64 addr:$src)), (undef)), + (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; +def : Pat<(movddup (memopv2i64 addr:$src), (undef)), + (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; +def : Pat<(movddup (bc_v4i32 (memopv2i64 addr:$src)), (undef)), + (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; +} // Arithmetic let Constraints = "$src1 = $dst" in { |