@@ -3944,18 +3944,39 @@ ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty, unsigned &FreeSSERegs,
3944
3944
return ABIArgInfo::getDirect (llvm::IntegerType::get (getVMContext (), Width));
3945
3945
}
3946
3946
3947
- // Bool type is always extended to the ABI, other builtin types are not
3948
- // extended.
3949
- const BuiltinType *BT = Ty->getAs <BuiltinType>();
3950
- if (BT && BT->getKind () == BuiltinType::Bool)
3951
- return ABIArgInfo::getExtend (Ty);
3947
+ if (const BuiltinType *BT = Ty->getAs <BuiltinType>()) {
3948
+ switch (BT->getKind ()) {
3949
+ case BuiltinType::Bool:
3950
+ // Bool type is always extended to the ABI, other builtin types are not
3951
+ // extended.
3952
+ return ABIArgInfo::getExtend (Ty);
3952
3953
3953
- // Mingw64 GCC uses the old 80 bit extended precision floating point unit. It
3954
- // passes them indirectly through memory.
3955
- if (IsMingw64 && BT && BT->getKind () == BuiltinType::LongDouble) {
3956
- const llvm::fltSemantics *LDF = &getTarget ().getLongDoubleFormat ();
3957
- if (LDF == &llvm::APFloat::x87DoubleExtended ())
3958
- return ABIArgInfo::getIndirect (Align, /* ByVal=*/ false );
3954
+ case BuiltinType::LongDouble:
3955
+ // Mingw64 GCC uses the old 80 bit extended precision floating point
3956
+ // unit. It passes them indirectly through memory.
3957
+ if (IsMingw64) {
3958
+ const llvm::fltSemantics *LDF = &getTarget ().getLongDoubleFormat ();
3959
+ if (LDF == &llvm::APFloat::x87DoubleExtended ())
3960
+ return ABIArgInfo::getIndirect (Align, /* ByVal=*/ false );
3961
+ break ;
3962
+ }
3963
+
3964
+ case BuiltinType::Int128:
3965
+ case BuiltinType::UInt128:
3966
+ // If it's a parameter type, the normal ABI rule is that arguments larger
3967
+ // than 8 bytes are passed indirectly. GCC follows it. We follow it too,
3968
+ // even though it isn't particularly efficient.
3969
+ if (!IsReturnType)
3970
+ return ABIArgInfo::getIndirect (Align, /* ByVal=*/ false );
3971
+
3972
+ // Mingw64 GCC returns i128 in XMM0. Coerce to v2i64 to handle that.
3973
+ // Clang matches them for compatibility.
3974
+ return ABIArgInfo::getDirect (
3975
+ llvm::VectorType::get (llvm::Type::getInt64Ty (getVMContext ()), 2 ));
3976
+
3977
+ default :
3978
+ break ;
3979
+ }
3959
3980
}
3960
3981
3961
3982
return ABIArgInfo::getDirect ();
0 commit comments