@@ -2472,10 +2472,10 @@ GetSSETypeAtOffset(llvm::Type *IRType, unsigned IROffset,
24722472
24732473
24742474// / GetINTEGERTypeAtOffset - The ABI specifies that a value should be passed in
2475- // / an 8-byte GPR . This means that we either have a scalar or we are talking
2476- // / about the high or low part of an up-to-16-byte struct. This routine picks
2475+ // / one or more 8-byte GPRs . This means that we either have a scalar or we are talking
2476+ // / about the high and/ or low part of an up-to-16-byte struct. This routine picks
24772477// / the best LLVM IR type to represent this, which may be i64 or may be anything
2478- // / else that the backend will pass in a GPR that works better (e.g. i8, %foo*,
2478+ // / else that the backend will pass in GPRs that works better (e.g. i8, %foo*,
24792479// / etc).
24802480// /
24812481// / PrefType is an LLVM IR type that corresponds to (part of) the IR type for
@@ -2534,6 +2534,17 @@ GetINTEGERTypeAtOffset(llvm::Type *IRType, unsigned IROffset,
25342534 SourceOffset);
25352535 }
25362536
2537+ // if we have a 128-bit integer, we can pass it safely using an i128
2538+ // so we return that if the IROffset is 0 and no type otherwise
2539+ if (IRType->isIntegerTy (128 )) {
2540+ if (IROffset == 0 ) {
2541+ return IRType;
2542+ } else {
2543+ assert (IROffset == 8 );
2544+ return nullptr ;
2545+ }
2546+ }
2547+
25372548 // Okay, we don't have any better idea of what to pass, so we pass this in an
25382549 // integer register that isn't too big to fit the rest of the struct.
25392550 unsigned TySizeInBytes =
@@ -2594,14 +2605,6 @@ GetX86_64ByValArgumentPair(llvm::Type *Lo, llvm::Type *Hi,
25942605
25952606ABIArgInfo X86_64ABIInfo::
25962607classifyReturnType (QualType RetTy) const {
2597- // return int128 as i128
2598- if (const BuiltinType *BT = RetTy->getAs <BuiltinType>()) {
2599- BuiltinType::Kind k = BT->getKind ();
2600- if (k == BuiltinType::Int128 || k == BuiltinType::UInt128) {
2601- return ABIArgInfo::getDirect ();
2602- }
2603- }
2604-
26052608 // AMD64-ABI 3.2.3p4: Rule 1. Classify the return type with the
26062609 // classification algorithm.
26072610 X86_64ABIInfo::Class Lo, Hi;
@@ -2734,16 +2737,6 @@ X86_64ABIInfo::classifyArgumentType(QualType Ty, unsigned freeIntRegs,
27342737 bool isNamedArg, bool IsRegCall) const {
27352738 Ty = useFirstFieldIfTransparentUnion (Ty);
27362739
2737- // represent int128 as i128
2738- if (const BuiltinType *BT = Ty->getAs <BuiltinType>()) {
2739- BuiltinType::Kind k = BT->getKind ();
2740- if (k == BuiltinType::Int128 || k == BuiltinType::UInt128) {
2741- neededInt = 2 ;
2742- neededSSE = 0 ;
2743- return ABIArgInfo::getDirect ();
2744- }
2745- }
2746-
27472740 X86_64ABIInfo::Class Lo, Hi;
27482741 classify (Ty, 0 , Lo, Hi, isNamedArg, IsRegCall);
27492742
0 commit comments