diff options
author | Chris Lattner <sabre@nondot.org> | 2010-08-26 20:05:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-08-26 20:05:13 +0000 |
commit | d774ae9ed11730123f526d2918734ad659643f69 (patch) | |
tree | b2ca0aa0d0d68404fc45ab0534d1e852d81b30f9 /clang/lib/CodeGen/TargetInfo.cpp | |
parent | 5fca8ca8cdc81b2d7593dc02e8c9060ad4b3f621 (diff) | |
download | bcm5719-llvm-d774ae9ed11730123f526d2918734ad659643f69.tar.gz bcm5719-llvm-d774ae9ed11730123f526d2918734ad659643f69.zip |
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.
llvm-svn: 112211
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 958f740bec3..05bea0cf859 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/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(); |