[llvm-commits] [llvm-gcc-4.2] r49754 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp

Devang Patel dpatel at apple.com
Tue Apr 15 16:23:49 PDT 2008


Author: dpatel
Date: Tue Apr 15 18:23:37 2008
New Revision: 49754

URL: http://llvm.org/viewvc/llvm-project?rev=49754&view=rev
Log:
Use appropriate type for the second element while handling 
struct { float f[2]; char c; };

Modified:
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=49754&r1=49753&r2=49754&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Apr 15 18:23:37 2008
@@ -850,8 +850,12 @@
         } else if (Class[i+1] == X86_64_INTEGER_CLASS) {
           // struct { float f[2]; char c; } should be returned in SSE(low)
           // and INT (high).
-          Elts.push_back(VectorType::get(Type::FloatTy, 2));
-          Elts.push_back(Type::DoubleTy);
+          const Type *Ty = ConvertType(TreeType);
+          if (const StructType *STy = dyn_cast<StructType>(Ty)) {
+            Elts.push_back(VectorType::get(Type::FloatTy, 2));
+            Elts.push_back(STy->getElementType(1));
+          } else
+            assert(0 && "Not yet handled!");
         } else
           assert(0 && "Not yet handled!");
         ++i; // Already handled the next one.
@@ -958,7 +962,8 @@
     
     bool foundFloat = false;
     for (unsigned i = 0; i < Elts.size(); ++i) 
-      if (Elts[i]->isFloatingPoint())
+      if (Elts[i]->isFloatingPoint()
+          || Elts[i]->getTypeID() == Type::VectorTyID)
         foundFloat = true;
 
     return foundFloat;





More information about the llvm-commits mailing list