diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-07-28 23:47:21 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-07-28 23:47:21 +0000 |
| commit | f4ba08aeafae2d8fed8c11dc59435a739decbda4 (patch) | |
| tree | f7400d98cf869a91ce93e6aae8da0469524ee7bc /clang/lib | |
| parent | 4b8585ef6a2ce8943e963d61dc3406d5579ce365 (diff) | |
| download | bcm5719-llvm-f4ba08aeafae2d8fed8c11dc59435a739decbda4.tar.gz bcm5719-llvm-f4ba08aeafae2d8fed8c11dc59435a739decbda4.zip | |
pass argument vectors in a type that corresponds to the user type if
possible. This improves the example to pass <4 x float> instead of
<2 x double> but we still get awful code, and still don't get the
return value right.
llvm-svn: 109700
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 613e2f62819..fc5e91fb7d0 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -1432,10 +1432,22 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, // AMD64-ABI 3.2.3p3: Rule 4. If the class is SSEUP, the // eightbyte is passed in the upper half of the last used SSE - // register. + // register. This only happens when 128-bit vectors are passed. case SSEUp: - assert(Lo == SSE && "Unexpected SSEUp classification."); + assert(Lo == SSE && "Unexpected SSEUp classification"); ResType = llvm::VectorType::get(llvm::Type::getDoubleTy(VMContext), 2); + + // If the preferred type is a 16-byte vector, prefer to pass it. + if (const llvm::VectorType *VT = + dyn_cast_or_null<llvm::VectorType>(PrefType)) { + const llvm::Type *EltTy = VT->getElementType(); + if (VT->getBitWidth() == 128 && + (EltTy->isFloatTy() || EltTy->isDoubleTy() || + EltTy->isIntegerTy(8) || EltTy->isIntegerTy(16) || + EltTy->isIntegerTy(32) || EltTy->isIntegerTy(64) || + EltTy->isIntegerTy(128))) + ResType = PrefType; + } break; } |

