diff options
author | Richard Trieu <rtrieu@google.com> | 2018-10-31 02:10:51 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2018-10-31 02:10:51 +0000 |
commit | 3b778bc3cec73f904457d70d6f956e1aafe1b550 (patch) | |
tree | 1cf4f61f60c0bb9fd54d53e0ea37539aa7b32cef /lib/CodeGen/TargetInfo.cpp | |
parent | 2f518e7be034f2ac2fde544f2ff335f847d45ebd (diff) |
Revert r345676 due to test failure.
This was causing CodeGen/mingw-long-double.c to start failing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345691 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | lib/CodeGen/TargetInfo.cpp | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index ba9eadb38d..11551a3619 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -3943,40 +3943,18 @@ ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty, unsigned &FreeSSERegs, // Otherwise, coerce it to a small integer. return ABIArgInfo::getDirect(llvm::IntegerType::get(getVMContext(), Width)); } + // Bool type is always extended to the ABI, other builtin types are not + // extended. + const BuiltinType *BT = Ty->getAs<BuiltinType>(); + if (BT && BT->getKind() == BuiltinType::Bool) + return ABIArgInfo::getExtend(Ty); - if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) { - switch (BT->getKind()) { - case BuiltinType::Bool: - // Bool type is always extended to the ABI, other builtin types are not - // extended. - return ABIArgInfo::getExtend(Ty); - - case BuiltinType::LongDouble: - // Mingw64 GCC uses the old 80 bit extended precision floating point - // unit. It passes them indirectly through memory. - if (IsMingw64) { - const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat(); - if (LDF == &llvm::APFloat::x87DoubleExtended()) - return ABIArgInfo::getIndirect(Align, /*ByVal=*/false); - break; - } - - case BuiltinType::Int128: - case BuiltinType::UInt128: - // If it's a parameter type, the normal ABI rule is that arguments larger - // than 8 bytes are passed indirectly. GCC follows it. We follow it too, - // even though it isn't particularly efficient. - if (!IsReturnType) - return ABIArgInfo::getIndirect(Align, /*ByVal=*/false); - - // Mingw64 GCC returns i128 in XMM0. Coerce to v2i64 to handle that. - // Clang matches them for compatibility. - return ABIArgInfo::getDirect( - llvm::VectorType::get(llvm::Type::getInt64Ty(getVMContext()), 2)); - - default: - break; - } + // Mingw64 GCC uses the old 80 bit extended precision floating point unit. It + // passes them indirectly through memory. + if (IsMingw64 && BT && BT->getKind() == BuiltinType::LongDouble) { + const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat(); + if (LDF == &llvm::APFloat::x87DoubleExtended()) + return ABIArgInfo::getIndirect(Align, /*ByVal=*/false); } return ABIArgInfo::getDirect(); |