[llvm-commits] [llvm] r112657 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86InstrSSE.td

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Tue Aug 31 15:22:11 PDT 2010


Author: bruno
Date: Tue Aug 31 17:22:11 2010
New Revision: 112657

URL: http://llvm.org/viewvc/llvm-project?rev=112657&view=rev
Log:
Use x86 specific MOVSHDUP node and add more patterns to match it

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
    llvm/trunk/lib/Target/X86/X86InstrSSE.td

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=112657&r1=112656&r2=112657&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Aug 31 17:22:11 2010
@@ -2586,6 +2586,7 @@
   case X86ISD::SHUFPS:
   case X86ISD::MOVLHPS:
   case X86ISD::MOVHLPS:
+  case X86ISD::MOVSHDUP:
   case X86ISD::MOVSS:
   case X86ISD::MOVSD:
   case X86ISD::PUNPCKLDQ:
@@ -2595,6 +2596,17 @@
 }
 
 static SDValue getTargetShuffleNode(unsigned Opc, DebugLoc dl, EVT VT,
+                                               SDValue V1, SelectionDAG &DAG) {
+  switch(Opc) {
+  default: llvm_unreachable("Unknown x86 shuffle node");
+  case X86ISD::MOVSHDUP:
+    return DAG.getNode(Opc, dl, VT, V1);
+  }
+
+  return SDValue();
+}
+
+static SDValue getTargetShuffleNode(unsigned Opc, DebugLoc dl, EVT VT,
                           SDValue V1, unsigned TargetMask, SelectionDAG &DAG) {
   switch(Opc) {
   default: llvm_unreachable("Unknown x86 shuffle node");
@@ -5053,6 +5065,7 @@
   bool V1IsSplat = false;
   bool V2IsSplat = false;
   bool HasSSE2 = Subtarget->hasSSE2() || Subtarget->hasAVX();
+  bool HasSSE3 = Subtarget->hasSSE3() || Subtarget->hasAVX();
   MachineFunction &MF = DAG.getMachineFunction();
   bool OptForSize = MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize);
 
@@ -5152,8 +5165,10 @@
     if (X86::isMOVHLPSMask(SVOp))
       return getMOVHighToLow(Op, dl, DAG);
 
-    if (X86::isMOVSHDUPMask(SVOp) ||
-        X86::isMOVSLDUPMask(SVOp) ||
+    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))
       return Op;

Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=112657&r1=112656&r2=112657&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Aug 31 17:22:11 2010
@@ -5847,12 +5847,12 @@
 // Shuffle with MOVSHDUP
 def : Pat<(v4i32 (X86Movshdup VR128:$src)),
           (MOVSHDUPrr VR128:$src)>;
-def : Pat<(v4i32 (X86MovshdupLd addr:$src)),
+def : Pat<(v4i32 (X86Movshdup (bc_v4i32 (memopv2i64 addr:$src)))),
           (MOVSHDUPrm addr:$src)>;
 
 def : Pat<(v4f32 (X86Movshdup VR128:$src)),
           (MOVSHDUPrr VR128:$src)>;
-def : Pat<(v4f32 (X86MovshdupLd addr:$src)),
+def : Pat<(X86Movshdup (memopv4f32 addr:$src)),
           (MOVSHDUPrm addr:$src)>;
 
 // Shuffle with MOVSLDUP





More information about the llvm-commits mailing list