[llvm-commits] [llvm] r65177 - in /llvm/branches/Apple/Dib: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/ret-mmx.ll

Bill Wendling isanbard at gmail.com
Fri Feb 20 14:10:36 PST 2009


Author: void
Date: Fri Feb 20 16:10:36 2009
New Revision: 65177

URL: http://llvm.org/viewvc/llvm-project?rev=65177&view=rev
Log:
Pull r65152 into Dib:

Support return of MMX values in 64-bit mode.

Added:
    llvm/branches/Apple/Dib/test/CodeGen/X86/ret-mmx.ll
      - copied unchanged from r65152, llvm/trunk/test/CodeGen/X86/ret-mmx.ll
Modified:
    llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp?rev=65177&r1=65176&r2=65177&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp Fri Feb 20 16:10:36 2009
@@ -1069,10 +1069,22 @@
         isScalarFPTypeInSSEReg(RVLocs[i].getValVT())) {
       CopyVT = MVT::f80;
     }
-    
-    Chain = DAG.getCopyFromReg(Chain, dl, RVLocs[i].getLocReg(),
-                               CopyVT, InFlag).getValue(1);
-    SDValue Val = Chain.getValue(0);
+
+    SDValue Val;
+    if (Is64Bit && CopyVT.isVector() && CopyVT.getSizeInBits() == 64) {
+      // For x86-64, MMX values are returned in XMM0 and XMM1. Issue an
+      // extract_vector_elt to i64 and then bit_convert it to the desired type.
+      Chain = DAG.getCopyFromReg(Chain, dl, VA.getLocReg(),
+                                 MVT::v2i64, InFlag).getValue(1);
+      Val = Chain.getValue(0);
+      Val = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, MVT::i64,
+                        Val, DAG.getConstant(0, MVT::i64));
+      Val = DAG.getNode(ISD::BIT_CONVERT, dl, CopyVT, Val);
+    } else {
+      Chain = DAG.getCopyFromReg(Chain, dl, VA.getLocReg(),
+                                 CopyVT, InFlag).getValue(1);
+      Val = Chain.getValue(0);
+    }
     InFlag = Chain.getValue(2);
 
     if (CopyVT != RVLocs[i].getValVT()) {





More information about the llvm-commits mailing list