Revert r345676 due to test failure.

This was causing CodeGen/mingw-long-double.c to start failing.

llvm-svn: 345691
This commit is contained in:
Richard Trieu 2018-10-31 02:10:51 +00:00
parent ef83ddc3c9
commit 4ff6697b7e
2 changed files with 11 additions and 49 deletions

View File

@ -3943,40 +3943,18 @@ ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty, unsigned &FreeSSERegs,
// Otherwise, coerce it to a small integer. // Otherwise, coerce it to a small integer.
return ABIArgInfo::getDirect(llvm::IntegerType::get(getVMContext(), Width)); return ABIArgInfo::getDirect(llvm::IntegerType::get(getVMContext(), Width));
} }
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 // Bool type is always extended to the ABI, other builtin types are not
// extended. // extended.
const BuiltinType *BT = Ty->getAs<BuiltinType>();
if (BT && BT->getKind() == BuiltinType::Bool)
return ABIArgInfo::getExtend(Ty); return ABIArgInfo::getExtend(Ty);
case BuiltinType::LongDouble: // Mingw64 GCC uses the old 80 bit extended precision floating point unit. It
// Mingw64 GCC uses the old 80 bit extended precision floating point // passes them indirectly through memory.
// unit. It passes them indirectly through memory. if (IsMingw64 && BT && BT->getKind() == BuiltinType::LongDouble) {
if (IsMingw64) {
const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat(); const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat();
if (LDF == &llvm::APFloat::x87DoubleExtended()) if (LDF == &llvm::APFloat::x87DoubleExtended())
return ABIArgInfo::getIndirect(Align, /*ByVal=*/false); 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;
}
} }
return ABIArgInfo::getDirect(); return ABIArgInfo::getDirect();

View File

@ -1,16 +0,0 @@
// RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm -o - %s \
// RUN: | FileCheck %s --check-prefix=GNU64
// RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -o - %s \
// RUN: | FileCheck %s --check-prefix=MSC64
typedef int int128_t __attribute__((mode(TI)));
int128_t foo() { return 0; }
// GNU64: define dso_local <2 x i64> @foo()
// MSC64: define dso_local <2 x i64> @foo()
int128_t bar(int128_t a, int128_t b) { return a * b; }
// GNU64: define dso_local <2 x i64> @bar(i128*, i128*)
// MSC64: define dso_local <2 x i64> @bar(i128*, i128*)