[llvm-commits] [llvm-gcc-4.2] r48906 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
Evan Cheng
evan.cheng at apple.com
Thu Mar 27 18:54:18 PDT 2008
Author: evancheng
Date: Thu Mar 27 20:54:17 2008
New Revision: 48906
URL: http://llvm.org/viewvc/llvm-project?rev=48906&view=rev
Log:
Fix x86-64 abi bug. A 128-bit struct can be passed in a i64 integer followed by a SSE register.
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=48906&r1=48905&r2=48906&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 Thu Mar 27 20:54:17 2008
@@ -764,6 +764,7 @@
case X86_64_INTEGER_CLASS:
case X86_64_INTEGERSI_CLASS:
Elts.push_back(Type::Int64Ty);
+ Bytes -= 8;
break;
case X86_64_SSE_CLASS:
// If it's a SSE class argument, then one of the followings are possible:
@@ -772,12 +773,13 @@
// <2 x i64>, or <2 x f64>.
// 3. 1 x SSE + 1 x SSESF, size is 12: 1 x Double, 1 x Float.
// 4. 2 x SSE, size is 16: 2 x Double.
- if (NumClasses == 1) {
- if (Bytes == 8)
+ if ((NumClasses-i) == 1) {
+ if (Bytes == 8) {
Elts.push_back(Type::DoubleTy);
- else
+ Bytes -= 8;
+ } else
assert(0 && "Not yet handled!");
- } else if (NumClasses == 2) {
+ } else if ((NumClasses-i) == 2) {
if (Class[i+1] == X86_64_SSEUP_CLASS) {
const Type *Ty = ConvertType(TreeType);
if (const StructType *STy = dyn_cast<StructType>(Ty))
@@ -790,24 +792,31 @@
Elts.push_back(VectorType::get(Type::Int64Ty, 2));
else
Elts.push_back(VectorType::get(Type::DoubleTy, 2));
+ Bytes -= 8;
} else {
assert(VTy->getNumElements() == 4);
if (VTy->getElementType()->isInteger())
Elts.push_back(VectorType::get(Type::Int32Ty, 4));
else
Elts.push_back(VectorType::get(Type::FloatTy, 4));
+ Bytes -= 4;
}
- } else if (llvm_x86_is_all_integer_types(Ty))
+ } else if (llvm_x86_is_all_integer_types(Ty)) {
Elts.push_back(VectorType::get(Type::Int32Ty, 4));
- else
+ Bytes -= 4;
+ } else {
Elts.push_back(VectorType::get(Type::FloatTy, 4));
+ Bytes -= 4;
+ }
} else if (Class[i+1] == X86_64_SSESF_CLASS) {
assert(Bytes == 12 && "Not yet handled!");
Elts.push_back(Type::DoubleTy);
Elts.push_back(Type::FloatTy);
+ Bytes -= 12;
} else if (Class[i+1] == X86_64_SSE_CLASS) {
Elts.push_back(Type::DoubleTy);
Elts.push_back(Type::DoubleTy);
+ Bytes -= 16;
} else
assert(0 && "Not yet handled!");
++i; // Already handled the next one.
@@ -816,9 +825,11 @@
break;
case X86_64_SSESF_CLASS:
Elts.push_back(Type::FloatTy);
+ Bytes -= 4;
break;
case X86_64_SSEDF_CLASS:
Elts.push_back(Type::DoubleTy);
+ Bytes -= 8;
break;
case X86_64_X87_CLASS:
case X86_64_X87UP_CLASS:
More information about the llvm-commits
mailing list