[llvm-commits] [llvm] r57831 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Duncan Sands baldrick at free.fr
Mon Oct 20 08:56:33 PDT 2008


Author: baldrick
Date: Mon Oct 20 10:56:33 2008
New Revision: 57831

URL: http://llvm.org/viewvc/llvm-project?rev=57831&view=rev
Log:
Have X86 custom lowering for LegalizeTypes use
LowerOperation if it doesn't know what else to do.
This methods should probably be factorized some,
but this is good enough for the moment.  Have
LowerATOMIC_BINARY_64 use EXTRACT_ELEMENT rather
than assuming the operand is a BUILD_PAIR (if it
is then getNode will automagically simplify the
EXTRACT_ELEMENT).  This way LowerATOMIC_BINARY_64
usable from LegalizeTypes.

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=57831&r1=57830&r2=57831&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Oct 20 10:56:33 2008
@@ -5980,7 +5980,7 @@
   case MVT::i64: 
     if (Subtarget->is64Bit()) {
       Reg = X86::RAX; size = 8;
-    } else //Should go away when LowerType stuff lands
+    } else //Should go away when LegalizeType stuff lands
       return SDValue(ExpandATOMIC_CMP_SWAP(Op.getNode(), DAG), 0);
     break;
   };
@@ -6044,9 +6044,10 @@
   
   SDValue Chain = Node->getOperand(0);
   SDValue In1 = Node->getOperand(1);
-  assert(Node->getOperand(2).getNode()->getOpcode()==ISD::BUILD_PAIR);
-  SDValue In2L = Node->getOperand(2).getNode()->getOperand(0);
-  SDValue In2H = Node->getOperand(2).getNode()->getOperand(1);
+  SDValue In2L = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32,
+                             Node->getOperand(2), DAG.getIntPtrConstant(0));
+  SDValue In2H = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32,
+                             Node->getOperand(2), DAG.getIntPtrConstant(1));
   // This is a generalized SDNode, not an AtomicSDNode, so it doesn't
   // have a MemOperand.  Pass the info through as a normal operand.
   SDValue LSI = DAG.getMemOperand(cast<MemSDNode>(Node)->getMemOperand());
@@ -6082,12 +6083,12 @@
 SDValue X86TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) {
   switch (Op.getOpcode()) {
   default: assert(0 && "Should not custom lower this!");
-  case ISD::ATOMIC_CMP_SWAP_8:  
-  case ISD::ATOMIC_CMP_SWAP_16: 
-  case ISD::ATOMIC_CMP_SWAP_32: 
+  case ISD::ATOMIC_CMP_SWAP_8:
+  case ISD::ATOMIC_CMP_SWAP_16:
+  case ISD::ATOMIC_CMP_SWAP_32:
   case ISD::ATOMIC_CMP_SWAP_64: return LowerCMP_SWAP(Op,DAG);
-  case ISD::ATOMIC_LOAD_SUB_8:  
-  case ISD::ATOMIC_LOAD_SUB_16: 
+  case ISD::ATOMIC_LOAD_SUB_8:
+  case ISD::ATOMIC_LOAD_SUB_16:
   case ISD::ATOMIC_LOAD_SUB_32: return LowerLOAD_SUB(Op,DAG);
   case ISD::ATOMIC_LOAD_SUB_64: return (Subtarget->is64Bit()) ?
                                         LowerLOAD_SUB(Op,DAG) :
@@ -6155,7 +6156,8 @@
 /// with a new node built out of custom code.
 SDNode *X86TargetLowering::ReplaceNodeResults(SDNode *N, SelectionDAG &DAG) {
   switch (N->getOpcode()) {
-  default: assert(0 && "Should not custom lower this!");
+  default:
+    return X86TargetLowering::LowerOperation(SDValue (N, 0), DAG).getNode();
   case ISD::FP_TO_SINT:         return ExpandFP_TO_SINT(N, DAG);
   case ISD::READCYCLECOUNTER:   return ExpandREADCYCLECOUNTER(N, DAG);
   case ISD::ATOMIC_CMP_SWAP_64: return ExpandATOMIC_CMP_SWAP(N, DAG);





More information about the llvm-commits mailing list