aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-26 20:05:13 +0000
committerChris Lattner <sabre@nondot.org>2010-08-26 20:05:13 +0000
commitbbae8b40cd37d5b2815f8450cb588a41da89d7e5 (patch)
tree8706eee3f273148518665a31cfbd9a5dc0771add /lib/CodeGen/TargetInfo.cpp
parentf164b6eb26567fe0e651389318d9a1ad70b774be (diff)
fix 2xi16 to pass as i32 instead of <2 x i16>. The former passes in
memory (as required) the later now passes in an xmm register. This fixes gcc.dg/compat/vector_1 on x86-32. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112211 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetInfo.cpp')
-rw-r--r--lib/CodeGen/TargetInfo.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index 958f740bec..05bea0cf85 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -589,6 +589,25 @@ ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty) const {
return getIndirectResult(Ty);
}
+ if (const VectorType *VT = Ty->getAs<VectorType>()) {
+ // On Darwin, some vectors are returned in registers.
+ if (IsDarwinVectorABI) {
+ uint64_t Size = getContext().getTypeSize(Ty);
+
+ // Always return in register if it fits in a general purpose
+ // register, or if it is 64 bits and has a single element.
+ if ((Size == 8 || Size == 16 || Size == 32) ||
+ (Size == 64 && VT->getNumElements() == 1))
+ return ABIArgInfo::getDirect(llvm::IntegerType::get(getVMContext(),
+ Size));
+
+ return ABIArgInfo::getIndirect(0);
+ }
+
+ return ABIArgInfo::getDirect();
+ }
+
+
if (const EnumType *EnumTy = Ty->getAs<EnumType>())
Ty = EnumTy->getDecl()->getIntegerType();