diff --git a/src/coreclr/jit/codegenarmarch.cpp b/src/coreclr/jit/codegenarmarch.cpp index 1f887786b191a..08eb2367a8fba 100644 --- a/src/coreclr/jit/codegenarmarch.cpp +++ b/src/coreclr/jit/codegenarmarch.cpp @@ -3410,7 +3410,7 @@ void CodeGen::genCall(GenTreeCall* call) for (unsigned i = 0; i < regCount; ++i) { var_types regType = pRetTypeDesc->GetReturnRegType(i); - returnReg = pRetTypeDesc->GetABIReturnReg(i); + returnReg = pRetTypeDesc->GetABIReturnReg(i, call->GetUnmanagedCallConv()); regNumber allocatedReg = call->GetRegNumByIdx(i); inst_Mov(regType, allocatedReg, returnReg, /* canSkip */ true); } @@ -4828,7 +4828,7 @@ void CodeGen::genSIMDSplitReturn(GenTree* src, ReturnTypeDesc* retTypeDesc) for (unsigned i = 0; i < regCount; ++i) { var_types type = retTypeDesc->GetReturnRegType(i); - regNumber reg = retTypeDesc->GetABIReturnReg(i); + regNumber reg = retTypeDesc->GetABIReturnReg(i, compiler->info.compCallConv); if (varTypeIsFloating(type)) { // If the register piece is to be passed in a floating point register diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp index f95775a6c1fb2..dde13812a2284 100644 --- a/src/coreclr/jit/codegencommon.cpp +++ b/src/coreclr/jit/codegencommon.cpp @@ -7770,7 +7770,8 @@ void CodeGen::genReturn(GenTree* treeNode) { if (varTypeIsGC(retTypeDesc.GetReturnRegType(i))) { - gcInfo.gcMarkRegPtrVal(retTypeDesc.GetABIReturnReg(i), retTypeDesc.GetReturnRegType(i)); + gcInfo.gcMarkRegPtrVal(retTypeDesc.GetABIReturnReg(i, compiler->info.compCallConv), + retTypeDesc.GetReturnRegType(i)); } } } @@ -7787,7 +7788,7 @@ void CodeGen::genReturn(GenTree* treeNode) { if (varTypeIsGC(retTypeDesc.GetReturnRegType(i))) { - gcInfo.gcMarkRegSetNpt(genRegMask(retTypeDesc.GetABIReturnReg(i))); + gcInfo.gcMarkRegSetNpt(genRegMask(retTypeDesc.GetABIReturnReg(i, compiler->info.compCallConv))); } } } @@ -7894,7 +7895,7 @@ void CodeGen::genStructReturn(GenTree* treeNode) // On LoongArch64, for a struct like "{ int, double }", "retTypeDesc" will be "{ TYP_INT, TYP_DOUBLE }", // i. e. not include the padding for the first field, and so the general loop below won't work. var_types type = retTypeDesc.GetReturnRegType(0); - regNumber toReg = retTypeDesc.GetABIReturnReg(0); + regNumber toReg = retTypeDesc.GetABIReturnReg(0, compiler->info.compCallConv); GetEmitter()->emitIns_R_S(ins_Load(type), emitTypeSize(type), toReg, lclNode->GetLclNum(), 0); if (regCount > 1) { @@ -7902,7 +7903,7 @@ void CodeGen::genStructReturn(GenTree* treeNode) int offset = genTypeSize(type); type = retTypeDesc.GetReturnRegType(1); offset = (int)((unsigned int)offset < genTypeSize(type) ? genTypeSize(type) : offset); - toReg = retTypeDesc.GetABIReturnReg(1); + toReg = retTypeDesc.GetABIReturnReg(1, compiler->info.compCallConv); GetEmitter()->emitIns_R_S(ins_Load(type), emitTypeSize(type), toReg, lclNode->GetLclNum(), offset); } #else // !TARGET_LOONGARCH64 && !TARGET_RISCV64 @@ -7910,7 +7911,7 @@ void CodeGen::genStructReturn(GenTree* treeNode) for (unsigned i = 0; i < regCount; ++i) { var_types type = retTypeDesc.GetReturnRegType(i); - regNumber toReg = retTypeDesc.GetABIReturnReg(i); + regNumber toReg = retTypeDesc.GetABIReturnReg(i, compiler->info.compCallConv); GetEmitter()->emitIns_R_S(ins_Load(type), emitTypeSize(type), toReg, lclNode->GetLclNum(), offset); offset += genTypeSize(type); } @@ -7921,7 +7922,7 @@ void CodeGen::genStructReturn(GenTree* treeNode) for (unsigned i = 0; i < regCount; ++i) { var_types type = retTypeDesc.GetReturnRegType(i); - regNumber toReg = retTypeDesc.GetABIReturnReg(i); + regNumber toReg = retTypeDesc.GetABIReturnReg(i, compiler->info.compCallConv); regNumber fromReg = op1->GetRegByIndex(i); if ((fromReg == REG_NA) && op1->OperIs(GT_COPY)) { @@ -8045,6 +8046,16 @@ void CodeGen::genMultiRegStoreToLocal(GenTreeLclVar* lclNode) assert(regCount == varDsc->lvFieldCnt); } +#ifdef SWIFT_SUPPORT + const uint32_t* offsets = nullptr; + if (op1->IsCall() && (op1->AsCall()->GetUnmanagedCallConv() == CorInfoCallConvExtension::Swift)) + { + const CORINFO_SWIFT_LOWERING* lowering = compiler->GetSwiftLowering(op1->AsCall()->gtRetClsHnd); + assert(!lowering->byReference && (regCount == lowering->numLoweredElements)); + offsets = lowering->offsets; + } +#endif + for (unsigned i = 0; i < regCount; ++i) { regNumber reg = genConsumeReg(op1, i); @@ -8087,6 +8098,12 @@ void CodeGen::genMultiRegStoreToLocal(GenTreeLclVar* lclNode) #if defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) // should consider the padding field within a struct. offset = (offset % genTypeSize(srcType)) ? AlignUp(offset, genTypeSize(srcType)) : offset; +#endif +#ifdef SWIFT_SUPPORT + if (offsets != nullptr) + { + offset = offsets[i]; + } #endif // Several fields could be passed in one register, copy using the register type. // It could rewrite memory outside of the fields but local on the stack are rounded to POINTER_SIZE so diff --git a/src/coreclr/jit/codegenloongarch64.cpp b/src/coreclr/jit/codegenloongarch64.cpp index fbb3c13ded02c..9d84acbcca3a1 100644 --- a/src/coreclr/jit/codegenloongarch64.cpp +++ b/src/coreclr/jit/codegenloongarch64.cpp @@ -6436,7 +6436,7 @@ void CodeGen::genCall(GenTreeCall* call) for (unsigned i = 0; i < regCount; ++i) { var_types regType = pRetTypeDesc->GetReturnRegType(i); - returnReg = pRetTypeDesc->GetABIReturnReg(i); + returnReg = pRetTypeDesc->GetABIReturnReg(i, call->GetUnmanagedCallConv()); regNumber allocatedReg = call->GetRegNumByIdx(i); inst_Mov(regType, allocatedReg, returnReg, /* canSkip */ true); } diff --git a/src/coreclr/jit/codegenriscv64.cpp b/src/coreclr/jit/codegenriscv64.cpp index 99c416faae25b..f3f0ae76d2f35 100644 --- a/src/coreclr/jit/codegenriscv64.cpp +++ b/src/coreclr/jit/codegenriscv64.cpp @@ -6509,7 +6509,7 @@ void CodeGen::genCall(GenTreeCall* call) for (unsigned i = 0; i < regCount; ++i) { var_types regType = pRetTypeDesc->GetReturnRegType(i); - returnReg = pRetTypeDesc->GetABIReturnReg(i); + returnReg = pRetTypeDesc->GetABIReturnReg(i, call->GetUnmanagedCallConv()); regNumber allocatedReg = call->GetRegNumByIdx(i); inst_Mov(regType, allocatedReg, returnReg, /* canSkip */ true); } diff --git a/src/coreclr/jit/codegenxarch.cpp b/src/coreclr/jit/codegenxarch.cpp index adc70840874ae..8384d2b337daf 100644 --- a/src/coreclr/jit/codegenxarch.cpp +++ b/src/coreclr/jit/codegenxarch.cpp @@ -121,7 +121,8 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg) for (unsigned i = 0; i < regCount; ++i) { - gcInfo.gcMarkRegPtrVal(retTypeDesc.GetABIReturnReg(i), retTypeDesc.GetReturnRegType(i)); + gcInfo.gcMarkRegPtrVal(retTypeDesc.GetABIReturnReg(i, compiler->info.compCallConv), + retTypeDesc.GetReturnRegType(i)); } } } @@ -1318,8 +1319,8 @@ void CodeGen::genSIMDSplitReturn(GenTree* src, ReturnTypeDesc* retTypeDesc) // This is a case of operand is in a single reg and needs to be // returned in multiple ABI return registers. regNumber opReg = src->GetRegNum(); - regNumber reg0 = retTypeDesc->GetABIReturnReg(0); - regNumber reg1 = retTypeDesc->GetABIReturnReg(1); + regNumber reg0 = retTypeDesc->GetABIReturnReg(0, compiler->info.compCallConv); + regNumber reg1 = retTypeDesc->GetABIReturnReg(1, compiler->info.compCallConv); assert((reg0 != REG_NA) && (reg1 != REG_NA) && (opReg != REG_NA)); @@ -2247,7 +2248,6 @@ void CodeGen::genMultiRegStoreToSIMDLocal(GenTreeLclVar* lclNode) // This case is always a call (AsCall() will assert if it is not). GenTreeCall* call = actualOp1->AsCall(); const ReturnTypeDesc* retTypeDesc = call->GetReturnTypeDesc(); - assert(retTypeDesc->GetReturnRegCount() == MAX_RET_REG_COUNT); assert(regCount == 2); regNumber targetReg = lclNode->GetRegNum(); @@ -6063,7 +6063,7 @@ void CodeGen::genCall(GenTreeCall* call) for (unsigned i = 0; i < regCount; ++i) { var_types regType = retTypeDesc->GetReturnRegType(i); - returnReg = retTypeDesc->GetABIReturnReg(i); + returnReg = retTypeDesc->GetABIReturnReg(i, call->GetUnmanagedCallConv()); regNumber allocatedReg = call->GetRegNumByIdx(i); inst_Mov(regType, allocatedReg, returnReg, /* canSkip */ true); } @@ -6074,7 +6074,7 @@ void CodeGen::genCall(GenTreeCall* call) // the native compiler doesn't guarantee it. if (call->IsUnmanaged() && (returnType == TYP_SIMD12)) { - returnReg = retTypeDesc->GetABIReturnReg(1); + returnReg = retTypeDesc->GetABIReturnReg(1, call->GetUnmanagedCallConv()); genSimd12UpperClear(returnReg); } #endif // FEATURE_SIMD diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 000f2f9ea952a..aaa353d918781 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -854,6 +854,42 @@ var_types Compiler::getReturnTypeForStruct(CORINFO_CLASS_HANDLE clsHnd, } assert(structSize > 0); +#ifdef SWIFT_SUPPORT + if (callConv == CorInfoCallConvExtension::Swift) + { + const CORINFO_SWIFT_LOWERING* lowering = GetSwiftLowering(clsHnd); + if (lowering->byReference) + { + howToReturnStruct = SPK_ByReference; + useType = TYP_UNKNOWN; + } + else if (lowering->numLoweredElements == 1) + { + useType = JITtype2varType(lowering->loweredElements[0]); + if (genTypeSize(useType) == structSize) + { + howToReturnStruct = SPK_PrimitiveType; + } + else + { + howToReturnStruct = SPK_EnclosingType; + } + } + else + { + howToReturnStruct = SPK_ByValue; + useType = TYP_STRUCT; + } + + if (wbReturnStruct != nullptr) + { + *wbReturnStruct = howToReturnStruct; + } + + return useType; + } +#endif + #ifdef UNIX_AMD64_ABI // An 8-byte struct may need to be returned in a floating point register // So we always consult the struct "Classifier" routine @@ -1950,6 +1986,10 @@ void Compiler::compInit(ArenaAllocator* pAlloc, fgSsaValid = false; fgVNPassesCompleted = 0; +#ifdef SWIFT_SUPPORT + m_swiftLoweringCache = nullptr; +#endif + // check that HelperCallProperties are initialized assert(s_helperCallProperties.IsPure(CORINFO_HELP_GETSHARED_GCSTATIC_BASE)); diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index dc0e3fd50d120..f4994cd754852 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -5504,6 +5504,12 @@ class Compiler return m_signatureToLookupInfoMap; } +#ifdef SWIFT_SUPPORT + typedef JitHashTable, CORINFO_SWIFT_LOWERING*> SwiftLoweringMap; + SwiftLoweringMap* m_swiftLoweringCache; + const CORINFO_SWIFT_LOWERING* GetSwiftLowering(CORINFO_CLASS_HANDLE clsHnd); +#endif + void optRecordLoopMemoryDependence(GenTree* tree, BasicBlock* block, ValueNum memoryVN); void optCopyLoopMemoryDependence(GenTree* fromTree, GenTree* toTree); diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 4897b411658e8..633687d2aa0d7 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -1817,6 +1817,15 @@ regNumber CallArgs::GetCustomRegister(Compiler* comp, CorInfoCallConvExtension c } } +#if defined(TARGET_AMD64) && defined(SWIFT_SUPPORT) + // TODO-Cleanup: Unify this with hasFixedRetBuffReg. That will + // likely be necessary for the reverse pinvoke support regardless. + if (cc == CorInfoCallConvExtension::Swift) + { + return REG_SWIFT_ARG_RET_BUFF; + } +#endif + break; case WellKnownArg::VirtualStubCell: @@ -26856,6 +26865,14 @@ void ReturnTypeDesc::InitializeStructReturnType(Compiler* comp, { assert(varTypeIsStruct(returnType)); +#ifdef SWIFT_SUPPORT + if (callConv == CorInfoCallConvExtension::Swift) + { + InitializeSwiftReturnRegs(comp, retClsHnd); + break; + } +#endif + #ifdef UNIX_AMD64_ABI SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR structDesc; @@ -26959,6 +26976,31 @@ void ReturnTypeDesc::InitializeStructReturnType(Compiler* comp, #endif } +#ifdef SWIFT_SUPPORT +//--------------------------------------------------------------------------------------- +// InitializeSwiftReturnRegs: +// Initialize the Return Type Descriptor for a method that returns with the +// Swift calling convention. +// +// Parameters: +// comp - Compiler instance +// clsHnd - Struct type being returned +// +void ReturnTypeDesc::InitializeSwiftReturnRegs(Compiler* comp, CORINFO_CLASS_HANDLE clsHnd) +{ + const CORINFO_SWIFT_LOWERING* lowering = comp->GetSwiftLowering(clsHnd); + assert(!lowering->byReference); + + static_assert_no_msg(MAX_SWIFT_LOWERED_ELEMENTS <= MAX_RET_REG_COUNT); + assert(lowering->numLoweredElements <= MAX_RET_REG_COUNT); + + for (size_t i = 0; i < lowering->numLoweredElements; i++) + { + m_regType[i] = JITtype2varType(lowering->loweredElements[i]); + } +} +#endif + //--------------------------------------------------------------------------------------- // InitializeLongReturnType: // Initialize the Return Type Descriptor for a method that returns a TYP_LONG @@ -27022,8 +27064,9 @@ void ReturnTypeDesc::InitializeReturnType(Compiler* comp, // GetABIReturnReg: Return i'th return register as per target ABI // // Arguments: -// idx - Index of the return register. -// The first return register has an index of 0 and so on. +// idx - Index of the return register. +// The first return register has an index of 0 and so on. +// callConv - Associated calling convention // // Return Value: // Returns i'th return register as per target ABI. @@ -27032,13 +27075,44 @@ void ReturnTypeDesc::InitializeReturnType(Compiler* comp, // x86 and ARM return long in multiple registers. // ARM and ARM64 return HFA struct in multiple registers. // -regNumber ReturnTypeDesc::GetABIReturnReg(unsigned idx) const +regNumber ReturnTypeDesc::GetABIReturnReg(unsigned idx, CorInfoCallConvExtension callConv) const { unsigned count = GetReturnRegCount(); assert(idx < count); regNumber resultReg = REG_NA; +#ifdef SWIFT_SUPPORT + if (callConv == CorInfoCallConvExtension::Swift) + { + static const regNumber swiftIntReturnRegs[] = {REG_SWIFT_INTRET_ORDER}; + static const regNumber swiftFloatReturnRegs[] = {REG_SWIFT_FLOATRET_ORDER}; + assert((idx < ArrLen(swiftIntReturnRegs)) && (idx < ArrLen(swiftFloatReturnRegs))); + unsigned intRegIdx = 0; + unsigned floatRegIdx = 0; + for (unsigned i = 0; i < idx; i++) + { + if (varTypeUsesIntReg(GetReturnRegType(i))) + { + intRegIdx++; + } + else + { + floatRegIdx++; + } + } + + if (varTypeUsesIntReg(GetReturnRegType(idx))) + { + return swiftIntReturnRegs[intRegIdx]; + } + else + { + return swiftFloatReturnRegs[floatRegIdx]; + } + } +#endif + #ifdef UNIX_AMD64_ABI var_types regType0 = GetReturnRegType(0); @@ -27186,7 +27260,7 @@ regNumber ReturnTypeDesc::GetABIReturnReg(unsigned idx) const // GetABIReturnRegs: get the mask of return registers as per target arch ABI. // // Arguments: -// None +// callConv - The calling convention // // Return Value: // reg mask of return registers in which the return type is returned. @@ -27196,14 +27270,14 @@ regNumber ReturnTypeDesc::GetABIReturnReg(unsigned idx) const // of return registers and wants to know the set of return registers. // // static -regMaskTP ReturnTypeDesc::GetABIReturnRegs() const +regMaskTP ReturnTypeDesc::GetABIReturnRegs(CorInfoCallConvExtension callConv) const { regMaskTP resultMask = RBM_NONE; unsigned count = GetReturnRegCount(); for (unsigned i = 0; i < count; ++i) { - resultMask |= genRegMask(GetABIReturnReg(i)); + resultMask |= genRegMask(GetABIReturnReg(i, callConv)); } return resultMask; diff --git a/src/coreclr/jit/gentree.h b/src/coreclr/jit/gentree.h index 3982943366aa5..dd6c00908b2ea 100644 --- a/src/coreclr/jit/gentree.h +++ b/src/coreclr/jit/gentree.h @@ -4202,6 +4202,8 @@ struct ReturnTypeDesc bool m_inited; #endif + void InitializeSwiftReturnRegs(Compiler* comp, CORINFO_CLASS_HANDLE retClsHnd); + public: ReturnTypeDesc() { @@ -4323,10 +4325,10 @@ struct ReturnTypeDesc } // Get i'th ABI return register - regNumber GetABIReturnReg(unsigned idx) const; + regNumber GetABIReturnReg(unsigned idx, CorInfoCallConvExtension callConv) const; // Get reg mask of ABI return registers - regMaskTP GetABIReturnRegs() const; + regMaskTP GetABIReturnRegs(CorInfoCallConvExtension callConv) const; }; class TailCallSiteInfo diff --git a/src/coreclr/jit/importercalls.cpp b/src/coreclr/jit/importercalls.cpp index 68eadeaabe4c1..f24750613054a 100644 --- a/src/coreclr/jit/importercalls.cpp +++ b/src/coreclr/jit/importercalls.cpp @@ -1765,12 +1765,7 @@ GenTree* Compiler::impFixupCallStructReturn(GenTreeCall* call, CORINFO_CLASS_HAN assert(returnType == TYP_STRUCT); assert((howToReturnStruct == SPK_ByValueAsHfa) || (howToReturnStruct == SPK_ByValue)); -#ifdef UNIX_AMD64_ABI - // must be a struct returned in two registers - assert(retRegCount == 2); -#else // not UNIX_AMD64_ABI assert(retRegCount >= 2); -#endif // not UNIX_AMD64_ABI if (!call->CanTailCall() && !call->IsInlineCandidate()) { @@ -1966,6 +1961,33 @@ void Compiler::impRetypeUnmanagedCallArgs(GenTreeCall* call) #ifdef SWIFT_SUPPORT +//------------------------------------------------------------------------ +// GetSwiftLowering: Get the CORINFO_SWIFT_LOWERING associated with a struct. +// +// Arguments: +// call - The class +// +// Return Value: +// Pointer to lowering +// +const CORINFO_SWIFT_LOWERING* Compiler::GetSwiftLowering(CORINFO_CLASS_HANDLE hClass) +{ + if (m_swiftLoweringCache == nullptr) + { + m_swiftLoweringCache = new (this, CMK_CallArgs) SwiftLoweringMap(getAllocator(CMK_CallArgs)); + } + + CORINFO_SWIFT_LOWERING* lowering; + if (!m_swiftLoweringCache->Lookup(hClass, &lowering)) + { + lowering = new (this, CMK_CallArgs) CORINFO_SWIFT_LOWERING; + info.compCompHnd->getSwiftLowering(hClass, lowering); + m_swiftLoweringCache->Set(hClass, lowering); + } + + return lowering; +} + //------------------------------------------------------------------------ // impPopArgsForSwiftCall: Pop arguments from IL stack to a Swift pinvoke node. // @@ -1988,9 +2010,6 @@ void Compiler::impPopArgsForSwiftCall(GenTreeCall* call, CORINFO_SIG_INFO* sig, // Check the signature of the Swift call for the special types CORINFO_ARG_LIST_HANDLE sigArg = sig->args; - CORINFO_SWIFT_LOWERING** lowerings = - sig->numArgs == 0 ? nullptr : (new (this, CMK_CallArgs) CORINFO_SWIFT_LOWERING*[sig->numArgs]{}); - for (unsigned short argIndex = 0; argIndex < sig->numArgs; sigArg = info.compCompHnd->getArgNext(sigArg), argIndex++) { @@ -2061,24 +2080,6 @@ void Compiler::impPopArgsForSwiftCall(GenTreeCall* call, CORINFO_SIG_INFO* sig, { // This is a struct type. Check if it needs to be lowered. // TODO-Bug: SIMD types are not handled correctly by this. - CORINFO_SWIFT_LOWERING* lowering = new (this, CMK_CallArgs) CORINFO_SWIFT_LOWERING; - lowerings[argIndex] = lowering; - info.compCompHnd->getSwiftLowering(argClass, lowering); - if (lowering->byReference) - { - JITDUMP(" Argument %d of type %s must be passed by reference\n", argIndex, - typGetObjLayout(argClass)->GetClassName()); - } - else - { - JITDUMP(" Argument %d of type %s must be passed as %d primitive(s)\n", argIndex, - typGetObjLayout(argClass)->GetClassName(), lowering->numLoweredElements); - for (size_t i = 0; i < lowering->numLoweredElements; i++) - { - JITDUMP(" [%zu] @ +%02u: %s\n", i, lowering->offsets[i], - varTypeName(JitType2PreciseVarType(lowering->loweredElements[i]))); - } - } } // We must spill this struct to a local to be able to expand it into primitives. @@ -2144,8 +2145,22 @@ void Compiler::impPopArgsForSwiftCall(GenTreeCall* call, CORINFO_SIG_INFO* sig, } else { - CORINFO_SWIFT_LOWERING* lowering = lowerings[argIndex]; - assert(lowering != nullptr); + const CORINFO_SWIFT_LOWERING* lowering = GetSwiftLowering(arg->GetSignatureClassHandle()); + if (lowering->byReference) + { + JITDUMP(" Argument %d of type %s must be passed by reference\n", argIndex, + typGetObjLayout(arg->GetSignatureClassHandle())->GetClassName()); + } + else + { + JITDUMP(" Argument %d of type %s must be passed as %d primitive(s)\n", argIndex, + typGetObjLayout(arg->GetSignatureClassHandle())->GetClassName(), lowering->numLoweredElements); + for (size_t i = 0; i < lowering->numLoweredElements; i++) + { + JITDUMP(" [%zu] @ +%02u: %s\n", i, lowering->offsets[i], + varTypeName(JitType2PreciseVarType(lowering->loweredElements[i]))); + } + } if (lowering->byReference) { @@ -2238,6 +2253,27 @@ void Compiler::impPopArgsForSwiftCall(GenTreeCall* call, CORINFO_SIG_INFO* sig, arg = insertAfter->GetNext(); } +#ifdef DEBUG + if (verbose && call->TypeIs(TYP_STRUCT) && (sig->retTypeClass != NO_CLASS_HANDLE)) + { + const CORINFO_SWIFT_LOWERING* lowering = GetSwiftLowering(sig->retTypeClass); + if (lowering->byReference) + { + printf(" Call returns %s by reference\n", typGetObjLayout(sig->retTypeClass)->GetClassName()); + } + else + { + printf(" Call returns %s as %d primitive(s) in registers\n", + typGetObjLayout(sig->retTypeClass)->GetClassName(), lowering->numLoweredElements); + for (size_t i = 0; i < lowering->numLoweredElements; i++) + { + printf(" [%zu] @ +%02u: %s\n", i, lowering->offsets[i], + varTypeName(JitType2PreciseVarType(lowering->loweredElements[i]))); + } + } + } +#endif + JITDUMP("Final result after Swift call lowering:\n"); DISPTREE(call); JITDUMP("\n"); diff --git a/src/coreclr/jit/lsraarmarch.cpp b/src/coreclr/jit/lsraarmarch.cpp index d83a9ef24493f..4738fcf33725e 100644 --- a/src/coreclr/jit/lsraarmarch.cpp +++ b/src/coreclr/jit/lsraarmarch.cpp @@ -226,7 +226,7 @@ int LinearScan::BuildCall(GenTreeCall* call) if (hasMultiRegRetVal) { assert(retTypeDesc != nullptr); - dstCandidates = retTypeDesc->GetABIReturnRegs(); + dstCandidates = retTypeDesc->GetABIReturnRegs(call->GetUnmanagedCallConv()); } else if (varTypeUsesFloatArgReg(registerType)) { diff --git a/src/coreclr/jit/lsrabuild.cpp b/src/coreclr/jit/lsrabuild.cpp index 179c445bcefa0..8fd31c072ffed 100644 --- a/src/coreclr/jit/lsrabuild.cpp +++ b/src/coreclr/jit/lsrabuild.cpp @@ -3058,7 +3058,8 @@ void LinearScan::BuildDefs(GenTree* tree, int dstCount, regMaskTP dstCandidates) // For all other cases of multi-reg definitions, the registers must be in sequential order. if (retTypeDesc != nullptr) { - thisDstCandidates = genRegMask(tree->AsCall()->GetReturnTypeDesc()->GetABIReturnReg(i)); + thisDstCandidates = genRegMask( + tree->AsCall()->GetReturnTypeDesc()->GetABIReturnReg(i, tree->AsCall()->GetUnmanagedCallConv())); assert((dstCandidates & thisDstCandidates) != RBM_NONE); } else @@ -4003,7 +4004,8 @@ int LinearScan::BuildReturn(GenTree* tree) if (srcType != dstType) { hasMismatchedRegTypes = true; - regMaskTP dstRegMask = genRegMask(retTypeDesc.GetABIReturnReg(i)); + regMaskTP dstRegMask = + genRegMask(retTypeDesc.GetABIReturnReg(i, compiler->info.compCallConv)); if (varTypeUsesIntReg(dstType)) { @@ -4030,7 +4032,7 @@ int LinearScan::BuildReturn(GenTree* tree) if (!hasMismatchedRegTypes || (regType(op1->AsLclVar()->GetFieldTypeByIndex(compiler, i)) == regType(retTypeDesc.GetReturnRegType(i)))) { - BuildUse(op1, genRegMask(retTypeDesc.GetABIReturnReg(i)), i); + BuildUse(op1, genRegMask(retTypeDesc.GetABIReturnReg(i, compiler->info.compCallConv)), i); } else { diff --git a/src/coreclr/jit/lsraloongarch64.cpp b/src/coreclr/jit/lsraloongarch64.cpp index 51b1871b40bdc..1ceb61e536255 100644 --- a/src/coreclr/jit/lsraloongarch64.cpp +++ b/src/coreclr/jit/lsraloongarch64.cpp @@ -748,7 +748,7 @@ int LinearScan::BuildCall(GenTreeCall* call) if (hasMultiRegRetVal) { assert(retTypeDesc != nullptr); - dstCandidates = retTypeDesc->GetABIReturnRegs(); + dstCandidates = retTypeDesc->GetABIReturnRegs(call->GetUnmanagedCallConv()); } else if (varTypeUsesFloatArgReg(registerType)) { diff --git a/src/coreclr/jit/lsrariscv64.cpp b/src/coreclr/jit/lsrariscv64.cpp index 0a38d27574a13..6af21c06ab208 100644 --- a/src/coreclr/jit/lsrariscv64.cpp +++ b/src/coreclr/jit/lsrariscv64.cpp @@ -911,7 +911,7 @@ int LinearScan::BuildCall(GenTreeCall* call) if (hasMultiRegRetVal) { assert(retTypeDesc != nullptr); - dstCandidates = retTypeDesc->GetABIReturnRegs(); + dstCandidates = retTypeDesc->GetABIReturnRegs(call->GetUnmanagedCallConv()); } else if (varTypeUsesFloatArgReg(registerType)) { diff --git a/src/coreclr/jit/lsraxarch.cpp b/src/coreclr/jit/lsraxarch.cpp index 9853a91118f37..1e7935ee5a215 100644 --- a/src/coreclr/jit/lsraxarch.cpp +++ b/src/coreclr/jit/lsraxarch.cpp @@ -649,8 +649,7 @@ int LinearScan::BuildNode(GenTree* tree) } // end switch (tree->OperGet()) // We need to be sure that we've set srcCount and dstCount appropriately. - // Not that for XARCH, the maximum number of registers defined is 2. - assert((dstCount < 2) || ((dstCount == 2) && tree->IsMultiRegNode())); + assert((dstCount < 2) || tree->IsMultiRegNode()); assert(isLocalDefUse == (tree->IsValue() && tree->IsUnusedValue())); assert(!tree->IsValue() || (dstCount != 0)); assert(dstCount == tree->GetRegisterDstCount(compiler)); @@ -1185,7 +1184,7 @@ int LinearScan::BuildCall(GenTreeCall* call) if (hasMultiRegRetVal) { assert(retTypeDesc != nullptr); - dstCandidates = retTypeDesc->GetABIReturnRegs(); + dstCandidates = retTypeDesc->GetABIReturnRegs(call->GetUnmanagedCallConv()); assert((int)genCountBits(dstCandidates) == dstCount); } else if (varTypeUsesFloatReg(registerType)) diff --git a/src/coreclr/jit/targetamd64.h b/src/coreclr/jit/targetamd64.h index 31fce4410c7ce..4a7033732e7a1 100644 --- a/src/coreclr/jit/targetamd64.h +++ b/src/coreclr/jit/targetamd64.h @@ -41,9 +41,9 @@ #define MAX_PASS_MULTIREG_BYTES 32 // Maximum size of a struct that could be passed in more than one register (Max is two SIMD16s) #define MAX_RET_MULTIREG_BYTES 32 // Maximum size of a struct that could be returned in more than one register (Max is two SIMD16s) #define MAX_ARG_REG_COUNT 2 // Maximum registers used to pass a single argument in multiple registers. - #define MAX_RET_REG_COUNT 2 // Maximum registers used to return a value. + #define MAX_RET_REG_COUNT 4 // Maximum registers used to return a value. - #define MAX_MULTIREG_COUNT 2 // Maximum number of registers defined by a single instruction (including calls). + #define MAX_MULTIREG_COUNT 4 // Maximum number of registers defined by a single instruction (including calls). // This is also the maximum number of registers for a MultiReg node. #else // !UNIX_AMD64_ABI #define WINDOWS_AMD64_ABI // Uses the Windows ABI for AMD64 @@ -563,9 +563,15 @@ #define RBM_STACK_PROBE_HELPER_TRASH RBM_RAX #endif // !UNIX_AMD64_ABI +#ifdef UNIX_AMD64_ABI #define SWIFT_SUPPORT #define REG_SWIFT_ERROR REG_R12 #define RBM_SWIFT_ERROR RBM_R12 #define REG_SWIFT_SELF REG_R13 + #define REG_SWIFT_INTRET_ORDER REG_RAX,REG_RDX,REG_RCX,REG_R8 + #define REG_SWIFT_FLOATRET_ORDER REG_XMM0,REG_XMM1,REG_XMM2,REG_XMM3 + #define REG_SWIFT_ARG_RET_BUFF REG_RAX +#endif + // clang-format on diff --git a/src/coreclr/jit/targetarm64.h b/src/coreclr/jit/targetarm64.h index 7d76fc41d3300..4a99ca2a79f98 100644 --- a/src/coreclr/jit/targetarm64.h +++ b/src/coreclr/jit/targetarm64.h @@ -382,5 +382,7 @@ #define REG_SWIFT_ERROR REG_R21 #define RBM_SWIFT_ERROR RBM_R21 #define REG_SWIFT_SELF REG_R20 + #define REG_SWIFT_INTRET_ORDER REG_R0,REG_R1,REG_R2,REG_R3 + #define REG_SWIFT_FLOATRET_ORDER REG_V0,REG_V1,REG_V2,REG_V3 // clang-format on diff --git a/src/coreclr/vm/amd64/unixasmhelpers.S b/src/coreclr/vm/amd64/unixasmhelpers.S index bac204d815234..77fe1384dcd9e 100644 --- a/src/coreclr/vm/amd64/unixasmhelpers.S +++ b/src/coreclr/vm/amd64/unixasmhelpers.S @@ -71,14 +71,16 @@ NESTED_ENTRY NDirectImportThunk, _TEXT, NoHandler // // Save integer parameter registers. // Make sure to preserve r11 as well as it is used to pass the stack argument size from JIT + // Make sure to preserve rax as well as it is used for the return buffer for Swift calls // PUSH_ARGUMENT_REGISTERS push_register r11 + push_register rax // - // Allocate space for XMM parameter registers + // Allocate space for XMM parameter registers and alignment // - alloc_stack 0x80 + alloc_stack 0x88 SAVE_FLOAT_ARGUMENT_REGISTERS 0 @@ -89,21 +91,24 @@ NESTED_ENTRY NDirectImportThunk, _TEXT, NoHandler // mov rdi, METHODDESC_REGISTER call C_FUNC(NDirectImportWorker) + mov r10, rax RESTORE_FLOAT_ARGUMENT_REGISTERS 0 // - // epilogue, rax contains the native target address + // epilogue, r10 contains the native target address // - free_stack 0x80 + free_stack 0x88 // - // Restore integer parameter registers and r11 + // Restore integer parameter registers, r11 and rax // + pop_register rax pop_register r11 POP_ARGUMENT_REGISTERS - TAILJMP_RAX + jmp r10 + NESTED_END NDirectImportThunk, _TEXT //------------------------------------------------ diff --git a/src/tests/Interop/CMakeLists.txt b/src/tests/Interop/CMakeLists.txt index 0529bbcea8e7a..248f1cad12eb6 100644 --- a/src/tests/Interop/CMakeLists.txt +++ b/src/tests/Interop/CMakeLists.txt @@ -106,4 +106,5 @@ if(CLR_CMAKE_TARGET_APPLE) add_subdirectory(Swift/SwiftSelfContext) add_subdirectory(Swift/SwiftInvalidCallConv) add_subdirectory(Swift/SwiftAbiStress) + add_subdirectory(Swift/SwiftRetAbiStress) endif() diff --git a/src/tests/Interop/Swift/SwiftRetAbiStress/CMakeLists.txt b/src/tests/Interop/Swift/SwiftRetAbiStress/CMakeLists.txt new file mode 100644 index 0000000000000..9f0e2a3423b2a --- /dev/null +++ b/src/tests/Interop/Swift/SwiftRetAbiStress/CMakeLists.txt @@ -0,0 +1,21 @@ +project(SwiftRetAbiStress) +include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") + +set(SOURCE SwiftRetAbiStress) + +if (NOT SWIFT_COMPILER_TARGET AND CLR_CMAKE_TARGET_OSX) + set(SWIFT_PLATFORM "macosx") + set(SWIFT_PLATFORM_SUFFIX "") + set(SWIFT_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET}) + set(SWIFT_COMPILER_TARGET "${CMAKE_OSX_ARCHITECTURES}-apple-${SWIFT_PLATFORM}${SWIFT_DEPLOYMENT_TARGET}${SWIFT_PLATFORM_SUFFIX}") +endif() + +add_custom_target(${SOURCE} ALL + COMMAND xcrun swiftc -target ${SWIFT_COMPILER_TARGET} -emit-library ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}.swift -o ${CMAKE_CURRENT_BINARY_DIR}/lib${SOURCE}.dylib + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}.swift + COMMENT "Generating ${SOURCE} library" +) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${SOURCE}.dylib + DESTINATION bin +) diff --git a/src/tests/Interop/Swift/SwiftRetAbiStress/SwiftRetAbiStress.cs b/src/tests/Interop/Swift/SwiftRetAbiStress/SwiftRetAbiStress.cs new file mode 100644 index 0000000000000..bbe4b8858d39c --- /dev/null +++ b/src/tests/Interop/Swift/SwiftRetAbiStress/SwiftRetAbiStress.cs @@ -0,0 +1,3916 @@ +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.Swift; +using Xunit; + +public class SwiftRetAbiStress +{ + private const string SwiftLib = "libSwiftRetAbiStress.dylib"; + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S0 + { + public short F0; + public int F1; + public ulong F2; + + public S0(short f0, int f1, ulong f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB5Func0AA2S0VyF")] + private static extern S0 SwiftRetFunc0(); + + [Fact] + public static void TestSwiftRetFunc0() + { + Console.Write("Running SwiftRetFunc0: "); + S0 val = SwiftRetFunc0(); + Assert.Equal((short)-17813, val.F0); + Assert.Equal((int)318006528, val.F1); + Assert.Equal((ulong)1195162122024233590, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 20)] + struct S1 + { + public short F0; + public float F1; + public long F2; + public uint F3; + + public S1(short f0, float f1, long f2, uint f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB5Func1AA2S1VyF")] + private static extern S1 SwiftRetFunc1(); + + [Fact] + public static void TestSwiftRetFunc1() + { + Console.Write("Running SwiftRetFunc1: "); + S1 val = SwiftRetFunc1(); + Assert.Equal((short)-29793, val.F0); + Assert.Equal((float)7351779, val.F1); + Assert.Equal((long)133491708229548754, val.F2); + Assert.Equal((uint)665726990, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S2_S0 + { + public ulong F0; + + public S2_S0(ulong f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 20)] + struct S2 + { + public S2_S0 F0; + public byte F1; + public ushort F2; + public float F3; + public int F4; + + public S2(S2_S0 f0, byte f1, ushort f2, float f3, int f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB5Func2AA2S2VyF")] + private static extern S2 SwiftRetFunc2(); + + [Fact] + public static void TestSwiftRetFunc2() + { + Console.Write("Running SwiftRetFunc2: "); + S2 val = SwiftRetFunc2(); + Assert.Equal((ulong)2153637757371267722, val.F0.F0); + Assert.Equal((byte)150, val.F1); + Assert.Equal((ushort)48920, val.F2); + Assert.Equal((float)3564327, val.F3); + Assert.Equal((int)1310569731, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 40)] + struct S3 + { + public long F0; + public double F1; + public sbyte F2; + public int F3; + public ushort F4; + public byte F5; + public double F6; + + public S3(long f0, double f1, sbyte f2, int f3, ushort f4, byte f5, double f6) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + F6 = f6; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB5Func3AA2S3VyF")] + private static extern S3 SwiftRetFunc3(); + + [Fact] + public static void TestSwiftRetFunc3() + { + Console.Write("Running SwiftRetFunc3: "); + S3 val = SwiftRetFunc3(); + Assert.Equal((long)5610153900386943274, val.F0); + Assert.Equal((double)2431035148834736, val.F1); + Assert.Equal((sbyte)111, val.F2); + Assert.Equal((int)772269424, val.F3); + Assert.Equal((ushort)19240, val.F4); + Assert.Equal((byte)146, val.F5); + Assert.Equal((double)821805530740405, val.F6); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S4 + { + public sbyte F0; + public uint F1; + public ulong F2; + public long F3; + + public S4(sbyte f0, uint f1, ulong f2, long f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB5Func4AA2S4VyF")] + private static extern S4 SwiftRetFunc4(); + + [Fact] + public static void TestSwiftRetFunc4() + { + Console.Write("Running SwiftRetFunc4: "); + S4 val = SwiftRetFunc4(); + Assert.Equal((sbyte)125, val.F0); + Assert.Equal((uint)377073381, val.F1); + Assert.Equal((ulong)964784376430620335, val.F2); + Assert.Equal((long)5588038704850976624, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S5_S0 + { + public uint F0; + public double F1; + + public S5_S0(uint f0, double f1) + { + F0 = f0; + F1 = f1; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 49)] + struct S5 + { + public ulong F0; + public sbyte F1; + public nuint F2; + public S5_S0 F3; + public nint F4; + public byte F5; + + public S5(ulong f0, sbyte f1, nuint f2, S5_S0 f3, nint f4, byte f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB5Func5AA2S5VyF")] + private static extern S5 SwiftRetFunc5(); + + [Fact] + public static void TestSwiftRetFunc5() + { + Console.Write("Running SwiftRetFunc5: "); + S5 val = SwiftRetFunc5(); + Assert.Equal((ulong)5315019731968023493, val.F0); + Assert.Equal((sbyte)114, val.F1); + Assert.Equal((nuint)unchecked((nuint)1154655179105889397), val.F2); + Assert.Equal((uint)1468030771, val.F3.F0); + Assert.Equal((double)3066473182924818, val.F3.F1); + Assert.Equal((nint)unchecked((nint)6252650621827449809), val.F4); + Assert.Equal((byte)129, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 18)] + struct S6 + { + public int F0; + public short F1; + public long F2; + public ushort F3; + + public S6(int f0, short f1, long f2, ushort f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB5Func6AA2S6VyF")] + private static extern S6 SwiftRetFunc6(); + + [Fact] + public static void TestSwiftRetFunc6() + { + Console.Write("Running SwiftRetFunc6: "); + S6 val = SwiftRetFunc6(); + Assert.Equal((int)743741783, val.F0); + Assert.Equal((short)-6821, val.F1); + Assert.Equal((long)5908745692727636656, val.F2); + Assert.Equal((ushort)64295, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S7_S0 + { + public nint F0; + + public S7_S0(nint f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S7 + { + public S7_S0 F0; + + public S7(S7_S0 f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB5Func7AA2S7VyF")] + private static extern S7 SwiftRetFunc7(); + + [Fact] + public static void TestSwiftRetFunc7() + { + Console.Write("Running SwiftRetFunc7: "); + S7 val = SwiftRetFunc7(); + Assert.Equal((nint)unchecked((nint)7625368278886567558), val.F0.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S8 + { + public nint F0; + + public S8(nint f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB5Func8AA2S8VyF")] + private static extern S8 SwiftRetFunc8(); + + [Fact] + public static void TestSwiftRetFunc8() + { + Console.Write("Running SwiftRetFunc8: "); + S8 val = SwiftRetFunc8(); + Assert.Equal((nint)unchecked((nint)775279004683334365), val.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S9_S0 + { + public short F0; + public int F1; + + public S9_S0(short f0, int f1) + { + F0 = f0; + F1 = f1; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 26)] + struct S9 + { + public uint F0; + public nint F1; + public S9_S0 F2; + public ushort F3; + + public S9(uint f0, nint f1, S9_S0 f2, ushort f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB5Func9AA2S9VyF")] + private static extern S9 SwiftRetFunc9(); + + [Fact] + public static void TestSwiftRetFunc9() + { + Console.Write("Running SwiftRetFunc9: "); + S9 val = SwiftRetFunc9(); + Assert.Equal((uint)1223030410, val.F0); + Assert.Equal((nint)unchecked((nint)4720638462358523954), val.F1); + Assert.Equal((short)30631, val.F2.F0); + Assert.Equal((int)1033774469, val.F2.F1); + Assert.Equal((ushort)64474, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S10 + { + public float F0; + public float F1; + + public S10(float f0, float f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func10AA3S10VyF")] + private static extern S10 SwiftRetFunc10(); + + [Fact] + public static void TestSwiftRetFunc10() + { + Console.Write("Running SwiftRetFunc10: "); + S10 val = SwiftRetFunc10(); + Assert.Equal((float)3276917, val.F0); + Assert.Equal((float)6694615, val.F1); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 21)] + struct S11 + { + public double F0; + public nint F1; + public uint F2; + public sbyte F3; + + public S11(double f0, nint f1, uint f2, sbyte f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func11AA3S11VyF")] + private static extern S11 SwiftRetFunc11(); + + [Fact] + public static void TestSwiftRetFunc11() + { + Console.Write("Running SwiftRetFunc11: "); + S11 val = SwiftRetFunc11(); + Assert.Equal((double)938206348036312, val.F0); + Assert.Equal((nint)unchecked((nint)6559514243876905696), val.F1); + Assert.Equal((uint)1357772248, val.F2); + Assert.Equal((sbyte)59, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S12 + { + public double F0; + + public S12(double f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func12AA3S12VyF")] + private static extern S12 SwiftRetFunc12(); + + [Fact] + public static void TestSwiftRetFunc12() + { + Console.Write("Running SwiftRetFunc12: "); + S12 val = SwiftRetFunc12(); + Assert.Equal((double)1580503485222363, val.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S13 + { + public uint F0; + + public S13(uint f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func13AA3S13VyF")] + private static extern S13 SwiftRetFunc13(); + + [Fact] + public static void TestSwiftRetFunc13() + { + Console.Write("Running SwiftRetFunc13: "); + S13 val = SwiftRetFunc13(); + Assert.Equal((uint)1381551558, val.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 1)] + struct S14_S0_S0 + { + public sbyte F0; + + public S14_S0_S0(sbyte f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 1)] + struct S14_S0 + { + public S14_S0_S0 F0; + + public S14_S0(S14_S0_S0 f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 26)] + struct S14 + { + public int F0; + public ushort F1; + public sbyte F2; + public float F3; + public ulong F4; + public S14_S0 F5; + public sbyte F6; + + public S14(int f0, ushort f1, sbyte f2, float f3, ulong f4, S14_S0 f5, sbyte f6) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + F6 = f6; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func14AA3S14VyF")] + private static extern S14 SwiftRetFunc14(); + + [Fact] + public static void TestSwiftRetFunc14() + { + Console.Write("Running SwiftRetFunc14: "); + S14 val = SwiftRetFunc14(); + Assert.Equal((int)1765691191, val.F0); + Assert.Equal((ushort)56629, val.F1); + Assert.Equal((sbyte)25, val.F2); + Assert.Equal((float)2944946, val.F3); + Assert.Equal((ulong)951929105049584033, val.F4); + Assert.Equal((sbyte)-30, val.F5.F0.F0); + Assert.Equal((sbyte)66, val.F6); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 12)] + struct S15_S0 + { + public nuint F0; + public float F1; + + public S15_S0(nuint f0, float f1) + { + F0 = f0; + F1 = f1; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 28)] + struct S15 + { + public nint F0; + public S15_S0 F1; + public ushort F2; + public int F3; + + public S15(nint f0, S15_S0 f1, ushort f2, int f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func15AA3S15VyF")] + private static extern S15 SwiftRetFunc15(); + + [Fact] + public static void TestSwiftRetFunc15() + { + Console.Write("Running SwiftRetFunc15: "); + S15 val = SwiftRetFunc15(); + Assert.Equal((nint)unchecked((nint)2090703541638269172), val.F0); + Assert.Equal((nuint)unchecked((nuint)6408314016925514463), val.F1.F0); + Assert.Equal((float)6534515, val.F1.F1); + Assert.Equal((ushort)30438, val.F2); + Assert.Equal((int)1745811802, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 33)] + struct S16 + { + public uint F0; + public ulong F1; + public byte F2; + public int F3; + public nuint F4; + public sbyte F5; + + public S16(uint f0, ulong f1, byte f2, int f3, nuint f4, sbyte f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func16AA3S16VyF")] + private static extern S16 SwiftRetFunc16(); + + [Fact] + public static void TestSwiftRetFunc16() + { + Console.Write("Running SwiftRetFunc16: "); + S16 val = SwiftRetFunc16(); + Assert.Equal((uint)585220635, val.F0); + Assert.Equal((ulong)4034210936973794153, val.F1); + Assert.Equal((byte)48, val.F2); + Assert.Equal((int)1155081155, val.F3); + Assert.Equal((nuint)unchecked((nuint)806384837403045657), val.F4); + Assert.Equal((sbyte)54, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 3)] + struct S17 + { + public byte F0; + public sbyte F1; + public byte F2; + + public S17(byte f0, sbyte f1, byte f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func17AA3S17VyF")] + private static extern S17 SwiftRetFunc17(); + + [Fact] + public static void TestSwiftRetFunc17() + { + Console.Write("Running SwiftRetFunc17: "); + S17 val = SwiftRetFunc17(); + Assert.Equal((byte)23, val.F0); + Assert.Equal((sbyte)112, val.F1); + Assert.Equal((byte)15, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S18_S0 + { + public uint F0; + public float F1; + + public S18_S0(uint f0, float f1) + { + F0 = f0; + F1 = f1; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S18 + { + public S18_S0 F0; + public nint F1; + public int F2; + public ushort F3; + public short F4; + + public S18(S18_S0 f0, nint f1, int f2, ushort f3, short f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func18AA3S18VyF")] + private static extern S18 SwiftRetFunc18(); + + [Fact] + public static void TestSwiftRetFunc18() + { + Console.Write("Running SwiftRetFunc18: "); + S18 val = SwiftRetFunc18(); + Assert.Equal((uint)1964425016, val.F0.F0); + Assert.Equal((float)2767295, val.F0.F1); + Assert.Equal((nint)unchecked((nint)6016563774923595868), val.F1); + Assert.Equal((int)1648562735, val.F2); + Assert.Equal((ushort)378, val.F3); + Assert.Equal((short)-20536, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 20)] + struct S19 + { + public byte F0; + public ushort F1; + public float F2; + public ulong F3; + public int F4; + + public S19(byte f0, ushort f1, float f2, ulong f3, int f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func19AA3S19VyF")] + private static extern S19 SwiftRetFunc19(); + + [Fact] + public static void TestSwiftRetFunc19() + { + Console.Write("Running SwiftRetFunc19: "); + S19 val = SwiftRetFunc19(); + Assert.Equal((byte)188, val.F0); + Assert.Equal((ushort)47167, val.F1); + Assert.Equal((float)6781297, val.F2); + Assert.Equal((ulong)8140268502944465472, val.F3); + Assert.Equal((int)708690468, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S20_S0 + { + public uint F0; + public float F1; + + public S20_S0(uint f0, float f1) + { + F0 = f0; + F1 = f1; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 9)] + struct S20 + { + public S20_S0 F0; + public byte F1; + + public S20(S20_S0 f0, byte f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func20AA3S20VyF")] + private static extern S20 SwiftRetFunc20(); + + [Fact] + public static void TestSwiftRetFunc20() + { + Console.Write("Running SwiftRetFunc20: "); + S20 val = SwiftRetFunc20(); + Assert.Equal((uint)2019361333, val.F0.F0); + Assert.Equal((float)938975, val.F0.F1); + Assert.Equal((byte)192, val.F1); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 2)] + struct S21_S0_S0 + { + public ushort F0; + + public S21_S0_S0(ushort f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 2)] + struct S21_S0 + { + public S21_S0_S0 F0; + + public S21_S0(S21_S0_S0 f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 42)] + struct S21 + { + public double F0; + public double F1; + public nuint F2; + public nint F3; + public ulong F4; + public S21_S0 F5; + + public S21(double f0, double f1, nuint f2, nint f3, ulong f4, S21_S0 f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func21AA3S21VyF")] + private static extern S21 SwiftRetFunc21(); + + [Fact] + public static void TestSwiftRetFunc21() + { + Console.Write("Running SwiftRetFunc21: "); + S21 val = SwiftRetFunc21(); + Assert.Equal((double)1693878073402490, val.F0); + Assert.Equal((double)3392111340517811, val.F1); + Assert.Equal((nuint)unchecked((nuint)3584917502172813732), val.F2); + Assert.Equal((nint)unchecked((nint)665495086154608745), val.F3); + Assert.Equal((ulong)2918107814961929578, val.F4); + Assert.Equal((ushort)4634, val.F5.F0.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S22 + { + public uint F0; + + public S22(uint f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func22AA3S22VyF")] + private static extern S22 SwiftRetFunc22(); + + [Fact] + public static void TestSwiftRetFunc22() + { + Console.Write("Running SwiftRetFunc22: "); + S22 val = SwiftRetFunc22(); + Assert.Equal((uint)640156952, val.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 41)] + struct S23 + { + public byte F0; + public short F1; + public ulong F2; + public nuint F3; + public nuint F4; + public ulong F5; + public byte F6; + + public S23(byte f0, short f1, ulong f2, nuint f3, nuint f4, ulong f5, byte f6) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + F6 = f6; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func23AA3S23VyF")] + private static extern S23 SwiftRetFunc23(); + + [Fact] + public static void TestSwiftRetFunc23() + { + Console.Write("Running SwiftRetFunc23: "); + S23 val = SwiftRetFunc23(); + Assert.Equal((byte)122, val.F0); + Assert.Equal((short)28995, val.F1); + Assert.Equal((ulong)25673626033589541, val.F2); + Assert.Equal((nuint)unchecked((nuint)828363978755325884), val.F3); + Assert.Equal((nuint)unchecked((nuint)3065573182429720699), val.F4); + Assert.Equal((ulong)1484484917001276079, val.F5); + Assert.Equal((byte)209, val.F6); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S24 + { + public ulong F0; + public ulong F1; + + public S24(ulong f0, ulong f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func24AA3S24VyF")] + private static extern S24 SwiftRetFunc24(); + + [Fact] + public static void TestSwiftRetFunc24() + { + Console.Write("Running SwiftRetFunc24: "); + S24 val = SwiftRetFunc24(); + Assert.Equal((ulong)2621245238416080387, val.F0); + Assert.Equal((ulong)6541787564638363256, val.F1); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S25_S0 + { + public nint F0; + + public S25_S0(nint f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 20)] + struct S25 + { + public sbyte F0; + public sbyte F1; + public byte F2; + public S25_S0 F3; + public uint F4; + + public S25(sbyte f0, sbyte f1, byte f2, S25_S0 f3, uint f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func25AA3S25VyF")] + private static extern S25 SwiftRetFunc25(); + + [Fact] + public static void TestSwiftRetFunc25() + { + Console.Write("Running SwiftRetFunc25: "); + S25 val = SwiftRetFunc25(); + Assert.Equal((sbyte)30, val.F0); + Assert.Equal((sbyte)-8, val.F1); + Assert.Equal((byte)168, val.F2); + Assert.Equal((nint)unchecked((nint)7601538494489501573), val.F3.F0); + Assert.Equal((uint)814523741, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S26 + { + public float F0; + + public S26(float f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func26AA3S26VyF")] + private static extern S26 SwiftRetFunc26(); + + [Fact] + public static void TestSwiftRetFunc26() + { + Console.Write("Running SwiftRetFunc26: "); + S26 val = SwiftRetFunc26(); + Assert.Equal((float)3681545, val.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 48)] + struct S27 + { + public long F0; + public double F1; + public sbyte F2; + public nint F3; + public short F4; + public long F5; + + public S27(long f0, double f1, sbyte f2, nint f3, short f4, long f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func27AA3S27VyF")] + private static extern S27 SwiftRetFunc27(); + + [Fact] + public static void TestSwiftRetFunc27() + { + Console.Write("Running SwiftRetFunc27: "); + S27 val = SwiftRetFunc27(); + Assert.Equal((long)4847421047018330189, val.F0); + Assert.Equal((double)3655171692392280, val.F1); + Assert.Equal((sbyte)46, val.F2); + Assert.Equal((nint)unchecked((nint)4476120319602257660), val.F3); + Assert.Equal((short)-6106, val.F4); + Assert.Equal((long)5756567968111212829, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S28_S0 + { + public double F0; + + public S28_S0(double f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S28 + { + public float F0; + public short F1; + public S28_S0 F2; + public double F3; + public ulong F4; + + public S28(float f0, short f1, S28_S0 f2, double f3, ulong f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func28AA3S28VyF")] + private static extern S28 SwiftRetFunc28(); + + [Fact] + public static void TestSwiftRetFunc28() + { + Console.Write("Running SwiftRetFunc28: "); + S28 val = SwiftRetFunc28(); + Assert.Equal((float)3491512, val.F0); + Assert.Equal((short)5249, val.F1); + Assert.Equal((double)1107064327388314, val.F2.F0); + Assert.Equal((double)2170381648425673, val.F3); + Assert.Equal((ulong)5138313315157580943, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 34)] + struct S29 + { + public ushort F0; + public uint F1; + public short F2; + public int F3; + public int F4; + public ulong F5; + public short F6; + + public S29(ushort f0, uint f1, short f2, int f3, int f4, ulong f5, short f6) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + F6 = f6; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func29AA3S29VyF")] + private static extern S29 SwiftRetFunc29(); + + [Fact] + public static void TestSwiftRetFunc29() + { + Console.Write("Running SwiftRetFunc29: "); + S29 val = SwiftRetFunc29(); + Assert.Equal((ushort)39000, val.F0); + Assert.Equal((uint)408611655, val.F1); + Assert.Equal((short)18090, val.F2); + Assert.Equal((int)351857085, val.F3); + Assert.Equal((int)1103441843, val.F4); + Assert.Equal((ulong)5162040247631126074, val.F5); + Assert.Equal((short)-27930, val.F6); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S30_S0 + { + public sbyte F0; + public sbyte F1; + public int F2; + + public S30_S0(sbyte f0, sbyte f1, int f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S30_S1 + { + public float F0; + + public S30_S1(float f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S30 + { + public float F0; + public S30_S0 F1; + public S30_S1 F2; + public long F3; + + public S30(float f0, S30_S0 f1, S30_S1 f2, long f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func30AA3S30VyF")] + private static extern S30 SwiftRetFunc30(); + + [Fact] + public static void TestSwiftRetFunc30() + { + Console.Write("Running SwiftRetFunc30: "); + S30 val = SwiftRetFunc30(); + Assert.Equal((float)6492602, val.F0); + Assert.Equal((sbyte)76, val.F1.F0); + Assert.Equal((sbyte)-26, val.F1.F1); + Assert.Equal((int)1777644423, val.F1.F2); + Assert.Equal((float)6558571, val.F2.F0); + Assert.Equal((long)5879147675377398012, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 21)] + struct S31 + { + public long F0; + public ulong F1; + public ushort F2; + public ushort F3; + public sbyte F4; + + public S31(long f0, ulong f1, ushort f2, ushort f3, sbyte f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func31AA3S31VyF")] + private static extern S31 SwiftRetFunc31(); + + [Fact] + public static void TestSwiftRetFunc31() + { + Console.Write("Running SwiftRetFunc31: "); + S31 val = SwiftRetFunc31(); + Assert.Equal((long)4699402628739628277, val.F0); + Assert.Equal((ulong)7062790893852687562, val.F1); + Assert.Equal((ushort)28087, val.F2); + Assert.Equal((ushort)11088, val.F3); + Assert.Equal((sbyte)69, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S32 + { + public int F0; + public ulong F1; + public ulong F2; + public uint F3; + public short F4; + public ushort F5; + + public S32(int f0, ulong f1, ulong f2, uint f3, short f4, ushort f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func32AA3S32VyF")] + private static extern S32 SwiftRetFunc32(); + + [Fact] + public static void TestSwiftRetFunc32() + { + Console.Write("Running SwiftRetFunc32: "); + S32 val = SwiftRetFunc32(); + Assert.Equal((int)688805466, val.F0); + Assert.Equal((ulong)8860655326984381661, val.F1); + Assert.Equal((ulong)6943423675662271404, val.F2); + Assert.Equal((uint)196368476, val.F3); + Assert.Equal((short)14229, val.F4); + Assert.Equal((ushort)34635, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 40)] + struct S33 + { + public ushort F0; + public uint F1; + public int F2; + public ushort F3; + public float F4; + public ulong F5; + public nint F6; + + public S33(ushort f0, uint f1, int f2, ushort f3, float f4, ulong f5, nint f6) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + F6 = f6; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func33AA3S33VyF")] + private static extern S33 SwiftRetFunc33(); + + [Fact] + public static void TestSwiftRetFunc33() + { + Console.Write("Running SwiftRetFunc33: "); + S33 val = SwiftRetFunc33(); + Assert.Equal((ushort)9297, val.F0); + Assert.Equal((uint)7963252, val.F1); + Assert.Equal((int)556244690, val.F2); + Assert.Equal((ushort)19447, val.F3); + Assert.Equal((float)6930550, val.F4); + Assert.Equal((ulong)126294981263481729, val.F5); + Assert.Equal((nint)unchecked((nint)2540579257616511618), val.F6); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S34 + { + public long F0; + public uint F1; + public ulong F2; + + public S34(long f0, uint f1, ulong f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func34AA3S34VyF")] + private static extern S34 SwiftRetFunc34(); + + [Fact] + public static void TestSwiftRetFunc34() + { + Console.Write("Running SwiftRetFunc34: "); + S34 val = SwiftRetFunc34(); + Assert.Equal((long)5845561428743737556, val.F0); + Assert.Equal((uint)1358941228, val.F1); + Assert.Equal((ulong)3701080255861218446, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 34)] + struct S35 + { + public float F0; + public float F1; + public long F2; + public byte F3; + public double F4; + public ushort F5; + + public S35(float f0, float f1, long f2, byte f3, double f4, ushort f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func35AA3S35VyF")] + private static extern S35 SwiftRetFunc35(); + + [Fact] + public static void TestSwiftRetFunc35() + { + Console.Write("Running SwiftRetFunc35: "); + S35 val = SwiftRetFunc35(); + Assert.Equal((float)5982956, val.F0); + Assert.Equal((float)3675164, val.F1); + Assert.Equal((long)229451138397478297, val.F2); + Assert.Equal((byte)163, val.F3); + Assert.Equal((double)2925293762193390, val.F4); + Assert.Equal((ushort)5018, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S36 + { + public int F0; + public long F1; + public ulong F2; + + public S36(int f0, long f1, ulong f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func36AA3S36VyF")] + private static extern S36 SwiftRetFunc36(); + + [Fact] + public static void TestSwiftRetFunc36() + { + Console.Write("Running SwiftRetFunc36: "); + S36 val = SwiftRetFunc36(); + Assert.Equal((int)1915776502, val.F0); + Assert.Equal((long)2197655909333830531, val.F1); + Assert.Equal((ulong)6072941592567177049, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S37 + { + public byte F0; + public double F1; + + public S37(byte f0, double f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func37AA3S37VyF")] + private static extern S37 SwiftRetFunc37(); + + [Fact] + public static void TestSwiftRetFunc37() + { + Console.Write("Running SwiftRetFunc37: "); + S37 val = SwiftRetFunc37(); + Assert.Equal((byte)18, val.F0); + Assert.Equal((double)4063164371882658, val.F1); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S38 + { + public nuint F0; + public long F1; + public byte F2; + public nuint F3; + + public S38(nuint f0, long f1, byte f2, nuint f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func38AA3S38VyF")] + private static extern S38 SwiftRetFunc38(); + + [Fact] + public static void TestSwiftRetFunc38() + { + Console.Write("Running SwiftRetFunc38: "); + S38 val = SwiftRetFunc38(); + Assert.Equal((nuint)unchecked((nuint)7389960750529773276), val.F0); + Assert.Equal((long)2725802169582362061, val.F1); + Assert.Equal((byte)2, val.F2); + Assert.Equal((nuint)unchecked((nuint)3659261019360356514), val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 20)] + struct S39 + { + public int F0; + public int F1; + public nint F2; + public short F3; + public ushort F4; + + public S39(int f0, int f1, nint f2, short f3, ushort f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func39AA3S39VyF")] + private static extern S39 SwiftRetFunc39(); + + [Fact] + public static void TestSwiftRetFunc39() + { + Console.Write("Running SwiftRetFunc39: "); + S39 val = SwiftRetFunc39(); + Assert.Equal((int)50995691, val.F0); + Assert.Equal((int)1623216479, val.F1); + Assert.Equal((nint)unchecked((nint)2906650346451599789), val.F2); + Assert.Equal((short)28648, val.F3); + Assert.Equal((ushort)8278, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S40_S0 + { + public float F0; + public byte F1; + public sbyte F2; + public nuint F3; + public double F4; + + public S40_S0(float f0, byte f1, sbyte f2, nuint f3, double f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 28)] + struct S40 + { + public S40_S0 F0; + public short F1; + public short F2; + + public S40(S40_S0 f0, short f1, short f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func40AA3S40VyF")] + private static extern S40 SwiftRetFunc40(); + + [Fact] + public static void TestSwiftRetFunc40() + { + Console.Write("Running SwiftRetFunc40: "); + S40 val = SwiftRetFunc40(); + Assert.Equal((float)7087264, val.F0.F0); + Assert.Equal((byte)37, val.F0.F1); + Assert.Equal((sbyte)-5, val.F0.F2); + Assert.Equal((nuint)unchecked((nuint)479915249821490487), val.F0.F3); + Assert.Equal((double)144033730096589, val.F0.F4); + Assert.Equal((short)28654, val.F1); + Assert.Equal((short)16398, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S41 + { + public nuint F0; + public nuint F1; + + public S41(nuint f0, nuint f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func41AA3S41VyF")] + private static extern S41 SwiftRetFunc41(); + + [Fact] + public static void TestSwiftRetFunc41() + { + Console.Write("Running SwiftRetFunc41: "); + S41 val = SwiftRetFunc41(); + Assert.Equal((nuint)unchecked((nuint)7923718819069382599), val.F0); + Assert.Equal((nuint)unchecked((nuint)1539666179674725957), val.F1); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S42_S0 + { + public int F0; + + public S42_S0(int f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S42 + { + public uint F0; + public long F1; + public S42_S0 F2; + public nuint F3; + + public S42(uint f0, long f1, S42_S0 f2, nuint f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func42AA3S42VyF")] + private static extern S42 SwiftRetFunc42(); + + [Fact] + public static void TestSwiftRetFunc42() + { + Console.Write("Running SwiftRetFunc42: "); + S42 val = SwiftRetFunc42(); + Assert.Equal((uint)1046060439, val.F0); + Assert.Equal((long)8249831314190867613, val.F1); + Assert.Equal((int)1097582349, val.F2.F0); + Assert.Equal((nuint)unchecked((nuint)2864677262092469436), val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S43_S0_S0 + { + public float F0; + + public S43_S0_S0(float f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S43_S0 + { + public S43_S0_S0 F0; + + public S43_S0(S43_S0_S0 f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 5)] + struct S43 + { + public S43_S0 F0; + public sbyte F1; + + public S43(S43_S0 f0, sbyte f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func43AA3S43VyF")] + private static extern S43 SwiftRetFunc43(); + + [Fact] + public static void TestSwiftRetFunc43() + { + Console.Write("Running SwiftRetFunc43: "); + S43 val = SwiftRetFunc43(); + Assert.Equal((float)1586338, val.F0.F0.F0); + Assert.Equal((sbyte)104, val.F1); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 20)] + struct S44 + { + public byte F0; + public int F1; + public nint F2; + public uint F3; + + public S44(byte f0, int f1, nint f2, uint f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func44AA3S44VyF")] + private static extern S44 SwiftRetFunc44(); + + [Fact] + public static void TestSwiftRetFunc44() + { + Console.Write("Running SwiftRetFunc44: "); + S44 val = SwiftRetFunc44(); + Assert.Equal((byte)94, val.F0); + Assert.Equal((int)1109076022, val.F1); + Assert.Equal((nint)unchecked((nint)3135595850598607828), val.F2); + Assert.Equal((uint)760084013, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S45_S0 + { + public long F0; + + public S45_S0(long f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S45 + { + public short F0; + public ulong F1; + public nint F2; + public S45_S0 F3; + + public S45(short f0, ulong f1, nint f2, S45_S0 f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func45AA3S45VyF")] + private static extern S45 SwiftRetFunc45(); + + [Fact] + public static void TestSwiftRetFunc45() + { + Console.Write("Running SwiftRetFunc45: "); + S45 val = SwiftRetFunc45(); + Assert.Equal((short)3071, val.F0); + Assert.Equal((ulong)5908138438609341766, val.F1); + Assert.Equal((nint)unchecked((nint)5870206722419946629), val.F2); + Assert.Equal((long)8128455876189744801, val.F3.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S46 + { + public short F0; + public sbyte F1; + public sbyte F2; + public uint F3; + public byte F4; + public int F5; + + public S46(short f0, sbyte f1, sbyte f2, uint f3, byte f4, int f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func46AA3S46VyF")] + private static extern S46 SwiftRetFunc46(); + + [Fact] + public static void TestSwiftRetFunc46() + { + Console.Write("Running SwiftRetFunc46: "); + S46 val = SwiftRetFunc46(); + Assert.Equal((short)14794, val.F0); + Assert.Equal((sbyte)60, val.F1); + Assert.Equal((sbyte)-77, val.F2); + Assert.Equal((uint)653898879, val.F3); + Assert.Equal((byte)224, val.F4); + Assert.Equal((int)266602433, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 1)] + struct S47_S0 + { + public sbyte F0; + + public S47_S0(sbyte f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 9)] + struct S47 + { + public double F0; + public S47_S0 F1; + + public S47(double f0, S47_S0 f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func47AA3S47VyF")] + private static extern S47 SwiftRetFunc47(); + + [Fact] + public static void TestSwiftRetFunc47() + { + Console.Write("Running SwiftRetFunc47: "); + S47 val = SwiftRetFunc47(); + Assert.Equal((double)3195976594911793, val.F0); + Assert.Equal((sbyte)-91, val.F1.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S48 + { + public nint F0; + + public S48(nint f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func48AA3S48VyF")] + private static extern S48 SwiftRetFunc48(); + + [Fact] + public static void TestSwiftRetFunc48() + { + Console.Write("Running SwiftRetFunc48: "); + S48 val = SwiftRetFunc48(); + Assert.Equal((nint)unchecked((nint)778504172538154682), val.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S49_S0_S0 + { + public ulong F0; + + public S49_S0_S0(ulong f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S49_S0 + { + public S49_S0_S0 F0; + + public S49_S0(S49_S0_S0 f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 40)] + struct S49 + { + public ulong F0; + public S49_S0 F1; + public sbyte F2; + public double F3; + public uint F4; + public uint F5; + + public S49(ulong f0, S49_S0 f1, sbyte f2, double f3, uint f4, uint f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func49AA3S49VyF")] + private static extern S49 SwiftRetFunc49(); + + [Fact] + public static void TestSwiftRetFunc49() + { + Console.Write("Running SwiftRetFunc49: "); + S49 val = SwiftRetFunc49(); + Assert.Equal((ulong)4235011519458710874, val.F0); + Assert.Equal((ulong)3120420438742285733, val.F1.F0.F0); + Assert.Equal((sbyte)-8, val.F2); + Assert.Equal((double)1077419570643725, val.F3); + Assert.Equal((uint)1985303212, val.F4); + Assert.Equal((uint)264580506, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S50 + { + public int F0; + + public S50(int f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func50AA3S50VyF")] + private static extern S50 SwiftRetFunc50(); + + [Fact] + public static void TestSwiftRetFunc50() + { + Console.Write("Running SwiftRetFunc50: "); + S50 val = SwiftRetFunc50(); + Assert.Equal((int)1043912405, val.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S51_S0_S0_S0 + { + public float F0; + + public S51_S0_S0_S0(float f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 6)] + struct S51_S0_S0 + { + public S51_S0_S0_S0 F0; + public short F1; + + public S51_S0_S0(S51_S0_S0_S0 f0, short f1) + { + F0 = f0; + F1 = f1; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S51_S0 + { + public double F0; + public S51_S0_S0 F1; + public byte F2; + public long F3; + + public S51_S0(double f0, S51_S0_S0 f1, byte f2, long f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S51 + { + public S51_S0 F0; + public double F1; + + public S51(S51_S0 f0, double f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func51AA3S51VyF")] + private static extern S51 SwiftRetFunc51(); + + [Fact] + public static void TestSwiftRetFunc51() + { + Console.Write("Running SwiftRetFunc51: "); + S51 val = SwiftRetFunc51(); + Assert.Equal((double)3266680719186600, val.F0.F0); + Assert.Equal((float)428247, val.F0.F1.F0.F0); + Assert.Equal((short)-24968, val.F0.F1.F1); + Assert.Equal((byte)76, val.F0.F2); + Assert.Equal((long)183022772513065490, val.F0.F3); + Assert.Equal((double)2661928101793033, val.F1); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 41)] + struct S52 + { + public uint F0; + public long F1; + public uint F2; + public ulong F3; + public nint F4; + public sbyte F5; + + public S52(uint f0, long f1, uint f2, ulong f3, nint f4, sbyte f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func52AA3S52VyF")] + private static extern S52 SwiftRetFunc52(); + + [Fact] + public static void TestSwiftRetFunc52() + { + Console.Write("Running SwiftRetFunc52: "); + S52 val = SwiftRetFunc52(); + Assert.Equal((uint)1812191671, val.F0); + Assert.Equal((long)6594574760089190928, val.F1); + Assert.Equal((uint)831147243, val.F2); + Assert.Equal((ulong)3301835731003365248, val.F3); + Assert.Equal((nint)unchecked((nint)5382332538247340743), val.F4); + Assert.Equal((sbyte)-77, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S53_S0 + { + public sbyte F0; + public nuint F1; + + public S53_S0(sbyte f0, nuint f1) + { + F0 = f0; + F1 = f1; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 37)] + struct S53 + { + public S53_S0 F0; + public int F1; + public long F2; + public float F3; + public sbyte F4; + + public S53(S53_S0 f0, int f1, long f2, float f3, sbyte f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func53AA3S53VyF")] + private static extern S53 SwiftRetFunc53(); + + [Fact] + public static void TestSwiftRetFunc53() + { + Console.Write("Running SwiftRetFunc53: "); + S53 val = SwiftRetFunc53(); + Assert.Equal((sbyte)-123, val.F0.F0); + Assert.Equal((nuint)unchecked((nuint)3494916243607193741), val.F0.F1); + Assert.Equal((int)1406699798, val.F1); + Assert.Equal((long)4018943158751734338, val.F2); + Assert.Equal((float)1084415, val.F3); + Assert.Equal((sbyte)-8, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S54_S0 + { + public double F0; + + public S54_S0(double f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S54 + { + public nint F0; + public nint F1; + public S54_S0 F2; + public long F3; + + public S54(nint f0, nint f1, S54_S0 f2, long f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func54AA3S54VyF")] + private static extern S54 SwiftRetFunc54(); + + [Fact] + public static void TestSwiftRetFunc54() + { + Console.Write("Running SwiftRetFunc54: "); + S54 val = SwiftRetFunc54(); + Assert.Equal((nint)unchecked((nint)8623517456704997133), val.F0); + Assert.Equal((nint)unchecked((nint)1521939500434086364), val.F1); + Assert.Equal((double)3472783299414218, val.F2.F0); + Assert.Equal((long)4761507229870258916, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 22)] + struct S55 + { + public short F0; + public uint F1; + public long F2; + public uint F3; + public sbyte F4; + public byte F5; + + public S55(short f0, uint f1, long f2, uint f3, sbyte f4, byte f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func55AA3S55VyF")] + private static extern S55 SwiftRetFunc55(); + + [Fact] + public static void TestSwiftRetFunc55() + { + Console.Write("Running SwiftRetFunc55: "); + S55 val = SwiftRetFunc55(); + Assert.Equal((short)-28051, val.F0); + Assert.Equal((uint)1759912152, val.F1); + Assert.Equal((long)2038322238348454200, val.F2); + Assert.Equal((uint)601094102, val.F3); + Assert.Equal((sbyte)5, val.F4); + Assert.Equal((byte)75, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 20)] + struct S56 + { + public ulong F0; + public float F1; + public sbyte F2; + public int F3; + + public S56(ulong f0, float f1, sbyte f2, int f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func56AA3S56VyF")] + private static extern S56 SwiftRetFunc56(); + + [Fact] + public static void TestSwiftRetFunc56() + { + Console.Write("Running SwiftRetFunc56: "); + S56 val = SwiftRetFunc56(); + Assert.Equal((ulong)6313168909786453069, val.F0); + Assert.Equal((float)6254558, val.F1); + Assert.Equal((sbyte)115, val.F2); + Assert.Equal((int)847834891, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S57 + { + public nuint F0; + public short F1; + public sbyte F2; + public int F3; + + public S57(nuint f0, short f1, sbyte f2, int f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func57AA3S57VyF")] + private static extern S57 SwiftRetFunc57(); + + [Fact] + public static void TestSwiftRetFunc57() + { + Console.Write("Running SwiftRetFunc57: "); + S57 val = SwiftRetFunc57(); + Assert.Equal((nuint)unchecked((nuint)546304219852233452), val.F0); + Assert.Equal((short)-27416, val.F1); + Assert.Equal((sbyte)47, val.F2); + Assert.Equal((int)1094575684, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S58 + { + public ulong F0; + public ulong F1; + + public S58(ulong f0, ulong f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func58AA3S58VyF")] + private static extern S58 SwiftRetFunc58(); + + [Fact] + public static void TestSwiftRetFunc58() + { + Console.Write("Running SwiftRetFunc58: "); + S58 val = SwiftRetFunc58(); + Assert.Equal((ulong)4612004722568513699, val.F0); + Assert.Equal((ulong)2222525519606580195, val.F1); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 41)] + struct S59 + { + public sbyte F0; + public nuint F1; + public nint F2; + public sbyte F3; + public long F4; + public byte F5; + + public S59(sbyte f0, nuint f1, nint f2, sbyte f3, long f4, byte f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func59AA3S59VyF")] + private static extern S59 SwiftRetFunc59(); + + [Fact] + public static void TestSwiftRetFunc59() + { + Console.Write("Running SwiftRetFunc59: "); + S59 val = SwiftRetFunc59(); + Assert.Equal((sbyte)-92, val.F0); + Assert.Equal((nuint)unchecked((nuint)7281011081566942937), val.F1); + Assert.Equal((nint)unchecked((nint)8203439771560005792), val.F2); + Assert.Equal((sbyte)103, val.F3); + Assert.Equal((long)1003386607251132236, val.F4); + Assert.Equal((byte)6, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S60 + { + public ulong F0; + public nint F1; + + public S60(ulong f0, nint f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func60AA3S60VyF")] + private static extern S60 SwiftRetFunc60(); + + [Fact] + public static void TestSwiftRetFunc60() + { + Console.Write("Running SwiftRetFunc60: "); + S60 val = SwiftRetFunc60(); + Assert.Equal((ulong)6922353269487057763, val.F0); + Assert.Equal((nint)unchecked((nint)103032455997325768), val.F1); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 20)] + struct S61_S0 + { + public long F0; + public long F1; + public float F2; + + public S61_S0(long f0, long f1, float f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 36)] + struct S61 + { + public ulong F0; + public S61_S0 F1; + public short F2; + public int F3; + + public S61(ulong f0, S61_S0 f1, short f2, int f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func61AA3S61VyF")] + private static extern S61 SwiftRetFunc61(); + + [Fact] + public static void TestSwiftRetFunc61() + { + Console.Write("Running SwiftRetFunc61: "); + S61 val = SwiftRetFunc61(); + Assert.Equal((ulong)3465845922566501572, val.F0); + Assert.Equal((long)8266662359091888314, val.F1.F0); + Assert.Equal((long)7511705648638703076, val.F1.F1); + Assert.Equal((float)535470, val.F1.F2); + Assert.Equal((short)-5945, val.F2); + Assert.Equal((int)523043523, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S62_S0_S0 + { + public nint F0; + + public S62_S0_S0(nint f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S62_S0 + { + public ushort F0; + public short F1; + public ushort F2; + public S62_S0_S0 F3; + + public S62_S0(ushort f0, short f1, ushort f2, S62_S0_S0 f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 26)] + struct S62 + { + public S62_S0 F0; + public nint F1; + public ushort F2; + + public S62(S62_S0 f0, nint f1, ushort f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func62AA3S62VyF")] + private static extern S62 SwiftRetFunc62(); + + [Fact] + public static void TestSwiftRetFunc62() + { + Console.Write("Running SwiftRetFunc62: "); + S62 val = SwiftRetFunc62(); + Assert.Equal((ushort)50789, val.F0.F0); + Assert.Equal((short)30245, val.F0.F1); + Assert.Equal((ushort)35063, val.F0.F2); + Assert.Equal((nint)unchecked((nint)3102684963408623932), val.F0.F3.F0); + Assert.Equal((nint)unchecked((nint)792877586576090769), val.F1); + Assert.Equal((ushort)24697, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S63 + { + public double F0; + public nint F1; + public double F2; + public sbyte F3; + public float F4; + + public S63(double f0, nint f1, double f2, sbyte f3, float f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func63AA3S63VyF")] + private static extern S63 SwiftRetFunc63(); + + [Fact] + public static void TestSwiftRetFunc63() + { + Console.Write("Running SwiftRetFunc63: "); + S63 val = SwiftRetFunc63(); + Assert.Equal((double)4097323000009314, val.F0); + Assert.Equal((nint)unchecked((nint)4162427097168837193), val.F1); + Assert.Equal((double)140736061437152, val.F2); + Assert.Equal((sbyte)-59, val.F3); + Assert.Equal((float)7331757, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S64_S0 + { + public ulong F0; + + public S64_S0(ulong f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S64 + { + public S64_S0 F0; + public ulong F1; + public long F2; + public nint F3; + + public S64(S64_S0 f0, ulong f1, long f2, nint f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func64AA3S64VyF")] + private static extern S64 SwiftRetFunc64(); + + [Fact] + public static void TestSwiftRetFunc64() + { + Console.Write("Running SwiftRetFunc64: "); + S64 val = SwiftRetFunc64(); + Assert.Equal((ulong)2624461610177878495, val.F0.F0); + Assert.Equal((ulong)5222178027019975511, val.F1); + Assert.Equal((long)9006949357929457355, val.F2); + Assert.Equal((nint)unchecked((nint)7966680593035770540), val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 40)] + struct S65 + { + public nint F0; + public double F1; + public ushort F2; + public short F3; + public byte F4; + public int F5; + public ulong F6; + + public S65(nint f0, double f1, ushort f2, short f3, byte f4, int f5, ulong f6) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + F6 = f6; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func65AA3S65VyF")] + private static extern S65 SwiftRetFunc65(); + + [Fact] + public static void TestSwiftRetFunc65() + { + Console.Write("Running SwiftRetFunc65: "); + S65 val = SwiftRetFunc65(); + Assert.Equal((nint)unchecked((nint)6080968957098434687), val.F0); + Assert.Equal((double)3067343828504927, val.F1); + Assert.Equal((ushort)56887, val.F2); + Assert.Equal((short)804, val.F3); + Assert.Equal((byte)235, val.F4); + Assert.Equal((int)121742660, val.F5); + Assert.Equal((ulong)9218677163034827308, val.F6); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 40)] + struct S66 + { + public sbyte F0; + public ulong F1; + public uint F2; + public ulong F3; + public ulong F4; + + public S66(sbyte f0, ulong f1, uint f2, ulong f3, ulong f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func66AA3S66VyF")] + private static extern S66 SwiftRetFunc66(); + + [Fact] + public static void TestSwiftRetFunc66() + { + Console.Write("Running SwiftRetFunc66: "); + S66 val = SwiftRetFunc66(); + Assert.Equal((sbyte)-16, val.F0); + Assert.Equal((ulong)7967447403042597794, val.F1); + Assert.Equal((uint)2029697750, val.F2); + Assert.Equal((ulong)4180031087394830849, val.F3); + Assert.Equal((ulong)5847795120921557969, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S67_S0 + { + public ulong F0; + + public S67_S0(ulong f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 33)] + struct S67 + { + public S67_S0 F0; + public byte F1; + public ushort F2; + public ulong F3; + public ulong F4; + public sbyte F5; + + public S67(S67_S0 f0, byte f1, ushort f2, ulong f3, ulong f4, sbyte f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func67AA3S67VyF")] + private static extern S67 SwiftRetFunc67(); + + [Fact] + public static void TestSwiftRetFunc67() + { + Console.Write("Running SwiftRetFunc67: "); + S67 val = SwiftRetFunc67(); + Assert.Equal((ulong)4844204675254434929, val.F0.F0); + Assert.Equal((byte)135, val.F1); + Assert.Equal((ushort)13969, val.F2); + Assert.Equal((ulong)4897129719050177731, val.F3); + Assert.Equal((ulong)7233638107485862921, val.F4); + Assert.Equal((sbyte)-11, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S68_S0 + { + public double F0; + + public S68_S0(double f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 37)] + struct S68 + { + public int F0; + public ulong F1; + public uint F2; + public S68_S0 F3; + public int F4; + public sbyte F5; + + public S68(int f0, ulong f1, uint f2, S68_S0 f3, int f4, sbyte f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func68AA3S68VyF")] + private static extern S68 SwiftRetFunc68(); + + [Fact] + public static void TestSwiftRetFunc68() + { + Console.Write("Running SwiftRetFunc68: "); + S68 val = SwiftRetFunc68(); + Assert.Equal((int)1708606840, val.F0); + Assert.Equal((ulong)1768121573985581212, val.F1); + Assert.Equal((uint)1033319213, val.F2); + Assert.Equal((double)2741322436867931, val.F3.F0); + Assert.Equal((int)955320338, val.F4); + Assert.Equal((sbyte)12, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S69 + { + public uint F0; + + public S69(uint f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func69AA3S69VyF")] + private static extern S69 SwiftRetFunc69(); + + [Fact] + public static void TestSwiftRetFunc69() + { + Console.Write("Running SwiftRetFunc69: "); + S69 val = SwiftRetFunc69(); + Assert.Equal((uint)2092746473, val.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S70 + { + public byte F0; + public float F1; + + public S70(byte f0, float f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func70AA3S70VyF")] + private static extern S70 SwiftRetFunc70(); + + [Fact] + public static void TestSwiftRetFunc70() + { + Console.Write("Running SwiftRetFunc70: "); + S70 val = SwiftRetFunc70(); + Assert.Equal((byte)76, val.F0); + Assert.Equal((float)4138467, val.F1); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S71_S0 + { + public sbyte F0; + public ulong F1; + public long F2; + + public S71_S0(sbyte f0, ulong f1, long f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 26)] + struct S71 + { + public S71_S0 F0; + public byte F1; + public byte F2; + + public S71(S71_S0 f0, byte f1, byte f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func71AA3S71VyF")] + private static extern S71 SwiftRetFunc71(); + + [Fact] + public static void TestSwiftRetFunc71() + { + Console.Write("Running SwiftRetFunc71: "); + S71 val = SwiftRetFunc71(); + Assert.Equal((sbyte)-98, val.F0.F0); + Assert.Equal((ulong)8603744544763953916, val.F0.F1); + Assert.Equal((long)8460721064583106347, val.F0.F2); + Assert.Equal((byte)10, val.F1); + Assert.Equal((byte)88, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S72 + { + public uint F0; + + public S72(uint f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func72AA3S72VyF")] + private static extern S72 SwiftRetFunc72(); + + [Fact] + public static void TestSwiftRetFunc72() + { + Console.Write("Running SwiftRetFunc72: "); + S72 val = SwiftRetFunc72(); + Assert.Equal((uint)2021509367, val.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 48)] + struct S73 + { + public nint F0; + public short F1; + public ulong F2; + public float F3; + public int F4; + public nuint F5; + public nuint F6; + + public S73(nint f0, short f1, ulong f2, float f3, int f4, nuint f5, nuint f6) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + F6 = f6; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func73AA3S73VyF")] + private static extern S73 SwiftRetFunc73(); + + [Fact] + public static void TestSwiftRetFunc73() + { + Console.Write("Running SwiftRetFunc73: "); + S73 val = SwiftRetFunc73(); + Assert.Equal((nint)unchecked((nint)6222563427944465437), val.F0); + Assert.Equal((short)28721, val.F1); + Assert.Equal((ulong)1313300783845289148, val.F2); + Assert.Equal((float)6761, val.F3); + Assert.Equal((int)2074171265, val.F4); + Assert.Equal((nuint)unchecked((nuint)6232209228889209160), val.F5); + Assert.Equal((nuint)unchecked((nuint)1423931135184844265), val.F6); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 19)] + struct S74 + { + public short F0; + public float F1; + public double F2; + public ushort F3; + public sbyte F4; + + public S74(short f0, float f1, double f2, ushort f3, sbyte f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func74AA3S74VyF")] + private static extern S74 SwiftRetFunc74(); + + [Fact] + public static void TestSwiftRetFunc74() + { + Console.Write("Running SwiftRetFunc74: "); + S74 val = SwiftRetFunc74(); + Assert.Equal((short)27115, val.F0); + Assert.Equal((float)1416098, val.F1); + Assert.Equal((double)4468576755457331, val.F2); + Assert.Equal((ushort)58864, val.F3); + Assert.Equal((sbyte)81, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 1)] + struct S75_S0_S0 + { + public sbyte F0; + + public S75_S0_S0(sbyte f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 2)] + struct S75_S0 + { + public S75_S0_S0 F0; + public byte F1; + + public S75_S0(S75_S0_S0 f0, byte f1) + { + F0 = f0; + F1 = f1; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 11)] + struct S75 + { + public ulong F0; + public S75_S0 F1; + public byte F2; + + public S75(ulong f0, S75_S0 f1, byte f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func75AA3S75VyF")] + private static extern S75 SwiftRetFunc75(); + + [Fact] + public static void TestSwiftRetFunc75() + { + Console.Write("Running SwiftRetFunc75: "); + S75 val = SwiftRetFunc75(); + Assert.Equal((ulong)8532911974860912350, val.F0); + Assert.Equal((sbyte)-60, val.F1.F0.F0); + Assert.Equal((byte)66, val.F1.F1); + Assert.Equal((byte)200, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 2)] + struct S76_S0_S0 + { + public short F0; + + public S76_S0_S0(short f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S76_S0 + { + public sbyte F0; + public ulong F1; + public S76_S0_S0 F2; + public double F3; + + public S76_S0(sbyte f0, ulong f1, S76_S0_S0 f2, double f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 48)] + struct S76 + { + public byte F0; + public S76_S0 F1; + public double F2; + + public S76(byte f0, S76_S0 f1, double f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func76AA3S76VyF")] + private static extern S76 SwiftRetFunc76(); + + [Fact] + public static void TestSwiftRetFunc76() + { + Console.Write("Running SwiftRetFunc76: "); + S76 val = SwiftRetFunc76(); + Assert.Equal((byte)69, val.F0); + Assert.Equal((sbyte)-29, val.F1.F0); + Assert.Equal((ulong)4872234474620951743, val.F1.F1); + Assert.Equal((short)11036, val.F1.F2.F0); + Assert.Equal((double)585486652063917, val.F1.F3); + Assert.Equal((double)2265391710186639, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 18)] + struct S77 + { + public int F0; + public int F1; + public int F2; + public uint F3; + public short F4; + + public S77(int f0, int f1, int f2, uint f3, short f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func77AA3S77VyF")] + private static extern S77 SwiftRetFunc77(); + + [Fact] + public static void TestSwiftRetFunc77() + { + Console.Write("Running SwiftRetFunc77: "); + S77 val = SwiftRetFunc77(); + Assert.Equal((int)4495211, val.F0); + Assert.Equal((int)1364377405, val.F1); + Assert.Equal((int)773989694, val.F2); + Assert.Equal((uint)1121696315, val.F3); + Assert.Equal((short)7589, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S78 + { + public uint F0; + public nuint F1; + + public S78(uint f0, nuint f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func78AA3S78VyF")] + private static extern S78 SwiftRetFunc78(); + + [Fact] + public static void TestSwiftRetFunc78() + { + Console.Write("Running SwiftRetFunc78: "); + S78 val = SwiftRetFunc78(); + Assert.Equal((uint)1767839225, val.F0); + Assert.Equal((nuint)unchecked((nuint)7917317019379224114), val.F1); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S79_S0 + { + public double F0; + public uint F1; + public int F2; + + public S79_S0(double f0, uint f1, int f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S79 + { + public S79_S0 F0; + public byte F1; + public double F2; + + public S79(S79_S0 f0, byte f1, double f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func79AA3S79VyF")] + private static extern S79 SwiftRetFunc79(); + + [Fact] + public static void TestSwiftRetFunc79() + { + Console.Write("Running SwiftRetFunc79: "); + S79 val = SwiftRetFunc79(); + Assert.Equal((double)495074072703635, val.F0.F0); + Assert.Equal((uint)417605286, val.F0.F1); + Assert.Equal((int)171326442, val.F0.F2); + Assert.Equal((byte)203, val.F1); + Assert.Equal((double)2976663235490421, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 7)] + struct S80 + { + public int F0; + public short F1; + public sbyte F2; + + public S80(int f0, short f1, sbyte f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func80AA3S80VyF")] + private static extern S80 SwiftRetFunc80(); + + [Fact] + public static void TestSwiftRetFunc80() + { + Console.Write("Running SwiftRetFunc80: "); + S80 val = SwiftRetFunc80(); + Assert.Equal((int)999559959, val.F0); + Assert.Equal((short)19977, val.F1); + Assert.Equal((sbyte)-4, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S81_S0 + { + public nuint F0; + + public S81_S0(nuint f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 40)] + struct S81 + { + public int F0; + public S81_S0 F1; + public float F2; + public long F3; + public uint F4; + public byte F5; + public short F6; + + public S81(int f0, S81_S0 f1, float f2, long f3, uint f4, byte f5, short f6) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + F6 = f6; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func81AA3S81VyF")] + private static extern S81 SwiftRetFunc81(); + + [Fact] + public static void TestSwiftRetFunc81() + { + Console.Write("Running SwiftRetFunc81: "); + S81 val = SwiftRetFunc81(); + Assert.Equal((int)452603110, val.F0); + Assert.Equal((nuint)unchecked((nuint)6240652733420985265), val.F1.F0); + Assert.Equal((float)6469988, val.F2); + Assert.Equal((long)5775316279348621124, val.F3); + Assert.Equal((uint)1398033592, val.F4); + Assert.Equal((byte)105, val.F5); + Assert.Equal((short)21937, val.F6); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S82 + { + public nint F0; + + public S82(nint f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func82AA3S82VyF")] + private static extern S82 SwiftRetFunc82(); + + [Fact] + public static void TestSwiftRetFunc82() + { + Console.Write("Running SwiftRetFunc82: "); + S82 val = SwiftRetFunc82(); + Assert.Equal((nint)unchecked((nint)6454754584537364459), val.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S83 + { + public ulong F0; + public uint F1; + public float F2; + public byte F3; + public float F4; + + public S83(ulong f0, uint f1, float f2, byte f3, float f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func83AA3S83VyF")] + private static extern S83 SwiftRetFunc83(); + + [Fact] + public static void TestSwiftRetFunc83() + { + Console.Write("Running SwiftRetFunc83: "); + S83 val = SwiftRetFunc83(); + Assert.Equal((ulong)2998238441521688907, val.F0); + Assert.Equal((uint)9623946, val.F1); + Assert.Equal((float)2577885, val.F2); + Assert.Equal((byte)156, val.F3); + Assert.Equal((float)6678807, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 2)] + struct S84_S0 + { + public short F0; + + public S84_S0(short f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 2)] + struct S84 + { + public S84_S0 F0; + + public S84(S84_S0 f0) + { + F0 = f0; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func84AA3S84VyF")] + private static extern S84 SwiftRetFunc84(); + + [Fact] + public static void TestSwiftRetFunc84() + { + Console.Write("Running SwiftRetFunc84: "); + S84 val = SwiftRetFunc84(); + Assert.Equal((short)16213, val.F0.F0); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 3)] + struct S85_S0 + { + public short F0; + public sbyte F1; + + public S85_S0(short f0, sbyte f1) + { + F0 = f0; + F1 = f1; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S85 + { + public long F0; + public byte F1; + public S85_S0 F2; + public float F3; + public nint F4; + + public S85(long f0, byte f1, S85_S0 f2, float f3, nint f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func85AA3S85VyF")] + private static extern S85 SwiftRetFunc85(); + + [Fact] + public static void TestSwiftRetFunc85() + { + Console.Write("Running SwiftRetFunc85: "); + S85 val = SwiftRetFunc85(); + Assert.Equal((long)8858924985061791416, val.F0); + Assert.Equal((byte)200, val.F1); + Assert.Equal((short)4504, val.F2.F0); + Assert.Equal((sbyte)60, val.F2.F1); + Assert.Equal((float)5572917, val.F3); + Assert.Equal((nint)unchecked((nint)6546369836182556538), val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 12)] + struct S86 + { + public ushort F0; + public float F1; + public uint F2; + + public S86(ushort f0, float f1, uint f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func86AA3S86VyF")] + private static extern S86 SwiftRetFunc86(); + + [Fact] + public static void TestSwiftRetFunc86() + { + Console.Write("Running SwiftRetFunc86: "); + S86 val = SwiftRetFunc86(); + Assert.Equal((ushort)22762, val.F0); + Assert.Equal((float)4672435, val.F1); + Assert.Equal((uint)719927700, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S87 + { + public int F0; + public nuint F1; + public ulong F2; + + public S87(int f0, nuint f1, ulong f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func87AA3S87VyF")] + private static extern S87 SwiftRetFunc87(); + + [Fact] + public static void TestSwiftRetFunc87() + { + Console.Write("Running SwiftRetFunc87: "); + S87 val = SwiftRetFunc87(); + Assert.Equal((int)361750184, val.F0); + Assert.Equal((nuint)unchecked((nuint)4206825694012787823), val.F1); + Assert.Equal((ulong)2885153391732919282, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 12)] + struct S88 + { + public uint F0; + public short F1; + public uint F2; + + public S88(uint f0, short f1, uint f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func88AA3S88VyF")] + private static extern S88 SwiftRetFunc88(); + + [Fact] + public static void TestSwiftRetFunc88() + { + Console.Write("Running SwiftRetFunc88: "); + S88 val = SwiftRetFunc88(); + Assert.Equal((uint)2125094198, val.F0); + Assert.Equal((short)-10705, val.F1); + Assert.Equal((uint)182007583, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S89 + { + public byte F0; + public uint F1; + public int F2; + public sbyte F3; + public long F4; + + public S89(byte f0, uint f1, int f2, sbyte f3, long f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func89AA3S89VyF")] + private static extern S89 SwiftRetFunc89(); + + [Fact] + public static void TestSwiftRetFunc89() + { + Console.Write("Running SwiftRetFunc89: "); + S89 val = SwiftRetFunc89(); + Assert.Equal((byte)175, val.F0); + Assert.Equal((uint)1062985476, val.F1); + Assert.Equal((int)1019006263, val.F2); + Assert.Equal((sbyte)-22, val.F3); + Assert.Equal((long)6888877252788498422, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 40)] + struct S90 + { + public byte F0; + public int F1; + public short F2; + public nint F3; + public uint F4; + public uint F5; + public long F6; + + public S90(byte f0, int f1, short f2, nint f3, uint f4, uint f5, long f6) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + F6 = f6; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func90AA3S90VyF")] + private static extern S90 SwiftRetFunc90(); + + [Fact] + public static void TestSwiftRetFunc90() + { + Console.Write("Running SwiftRetFunc90: "); + S90 val = SwiftRetFunc90(); + Assert.Equal((byte)221, val.F0); + Assert.Equal((int)225825436, val.F1); + Assert.Equal((short)-26231, val.F2); + Assert.Equal((nint)unchecked((nint)5122880520199505508), val.F3); + Assert.Equal((uint)907657092, val.F4); + Assert.Equal((uint)707089277, val.F5); + Assert.Equal((long)6091814344013414920, val.F6); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 28)] + struct S91 + { + public double F0; + public sbyte F1; + public sbyte F2; + public uint F3; + public nint F4; + public sbyte F5; + public short F6; + + public S91(double f0, sbyte f1, sbyte f2, uint f3, nint f4, sbyte f5, short f6) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + F6 = f6; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func91AA3S91VyF")] + private static extern S91 SwiftRetFunc91(); + + [Fact] + public static void TestSwiftRetFunc91() + { + Console.Write("Running SwiftRetFunc91: "); + S91 val = SwiftRetFunc91(); + Assert.Equal((double)3265110225161261, val.F0); + Assert.Equal((sbyte)62, val.F1); + Assert.Equal((sbyte)-38, val.F2); + Assert.Equal((uint)946023589, val.F3); + Assert.Equal((nint)unchecked((nint)4109819715069879890), val.F4); + Assert.Equal((sbyte)-73, val.F5); + Assert.Equal((short)20363, val.F6); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S92_S0 + { + public float F0; + public long F1; + + public S92_S0(float f0, long f1) + { + F0 = f0; + F1 = f1; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 44)] + struct S92 + { + public long F0; + public nuint F1; + public S92_S0 F2; + public int F3; + public float F4; + public float F5; + + public S92(long f0, nuint f1, S92_S0 f2, int f3, float f4, float f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func92AA3S92VyF")] + private static extern S92 SwiftRetFunc92(); + + [Fact] + public static void TestSwiftRetFunc92() + { + Console.Write("Running SwiftRetFunc92: "); + S92 val = SwiftRetFunc92(); + Assert.Equal((long)3230438394207610137, val.F0); + Assert.Equal((nuint)unchecked((nuint)3003396252681176136), val.F1); + Assert.Equal((float)6494422, val.F2.F0); + Assert.Equal((long)2971773224350614312, val.F2.F1); + Assert.Equal((int)2063694141, val.F3); + Assert.Equal((float)3117041, val.F4); + Assert.Equal((float)1003760, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 32)] + struct S93 + { + public nint F0; + public byte F1; + public uint F2; + public uint F3; + public ulong F4; + + public S93(nint f0, byte f1, uint f2, uint f3, ulong f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func93AA3S93VyF")] + private static extern S93 SwiftRetFunc93(); + + [Fact] + public static void TestSwiftRetFunc93() + { + Console.Write("Running SwiftRetFunc93: "); + S93 val = SwiftRetFunc93(); + Assert.Equal((nint)unchecked((nint)5170226481546239050), val.F0); + Assert.Equal((byte)11, val.F1); + Assert.Equal((uint)1120259582, val.F2); + Assert.Equal((uint)1947849905, val.F3); + Assert.Equal((ulong)3690113387392112192, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 40)] + struct S94 + { + public ushort F0; + public double F1; + public short F2; + public double F3; + public ulong F4; + + public S94(ushort f0, double f1, short f2, double f3, ulong f4) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func94AA3S94VyF")] + private static extern S94 SwiftRetFunc94(); + + [Fact] + public static void TestSwiftRetFunc94() + { + Console.Write("Running SwiftRetFunc94: "); + S94 val = SwiftRetFunc94(); + Assert.Equal((ushort)57111, val.F0); + Assert.Equal((double)1718940123307098, val.F1); + Assert.Equal((short)-16145, val.F2); + Assert.Equal((double)1099321301986326, val.F3); + Assert.Equal((ulong)2972912419231960385, val.F4); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S95_S0 + { + public double F0; + + public S95_S0(double f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 24)] + struct S95 + { + public short F0; + public S95_S0 F1; + public ulong F2; + + public S95(short f0, S95_S0 f1, ulong f2) + { + F0 = f0; + F1 = f1; + F2 = f2; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func95AA3S95VyF")] + private static extern S95 SwiftRetFunc95(); + + [Fact] + public static void TestSwiftRetFunc95() + { + Console.Write("Running SwiftRetFunc95: "); + S95 val = SwiftRetFunc95(); + Assert.Equal((short)12620, val.F0); + Assert.Equal((double)3232445258308074, val.F1.F0); + Assert.Equal((ulong)97365157264460373, val.F2); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 48)] + struct S96 + { + public sbyte F0; + public double F1; + public ulong F2; + public ulong F3; + public int F4; + public long F5; + + public S96(sbyte f0, double f1, ulong f2, ulong f3, int f4, long f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func96AA3S96VyF")] + private static extern S96 SwiftRetFunc96(); + + [Fact] + public static void TestSwiftRetFunc96() + { + Console.Write("Running SwiftRetFunc96: "); + S96 val = SwiftRetFunc96(); + Assert.Equal((sbyte)3, val.F0); + Assert.Equal((double)242355060906873, val.F1); + Assert.Equal((ulong)3087879465791321798, val.F2); + Assert.Equal((ulong)7363229136420263380, val.F3); + Assert.Equal((int)46853328, val.F4); + Assert.Equal((long)4148307028758236491, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 16)] + struct S97 + { + public ushort F0; + public int F1; + public ushort F2; + public uint F3; + + public S97(ushort f0, int f1, ushort f2, uint f3) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func97AA3S97VyF")] + private static extern S97 SwiftRetFunc97(); + + [Fact] + public static void TestSwiftRetFunc97() + { + Console.Write("Running SwiftRetFunc97: "); + S97 val = SwiftRetFunc97(); + Assert.Equal((ushort)10651, val.F0); + Assert.Equal((int)2068379463, val.F1); + Assert.Equal((ushort)57307, val.F2); + Assert.Equal((uint)329271020, val.F3); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 48)] + struct S98 + { + public double F0; + public int F1; + public long F2; + public nint F3; + public float F4; + public double F5; + + public S98(double f0, int f1, long f2, nint f3, float f4, double f5) + { + F0 = f0; + F1 = f1; + F2 = f2; + F3 = f3; + F4 = f4; + F5 = f5; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func98AA3S98VyF")] + private static extern S98 SwiftRetFunc98(); + + [Fact] + public static void TestSwiftRetFunc98() + { + Console.Write("Running SwiftRetFunc98: "); + S98 val = SwiftRetFunc98(); + Assert.Equal((double)2250389231883613, val.F0); + Assert.Equal((int)1755058358, val.F1); + Assert.Equal((long)6686142382639170849, val.F2); + Assert.Equal((nint)unchecked((nint)6456632014163315773), val.F3); + Assert.Equal((float)2818253, val.F4); + Assert.Equal((double)1085859434505817, val.F5); + Console.WriteLine("OK"); + } + + [StructLayout(LayoutKind.Sequential, Size = 4)] + struct S99_S0 + { + public int F0; + + public S99_S0(int f0) + { + F0 = f0; + } + } + + [StructLayout(LayoutKind.Sequential, Size = 8)] + struct S99 + { + public S99_S0 F0; + public float F1; + + public S99(S99_S0 f0, float f1) + { + F0 = f0; + F1 = f1; + } + } + + [UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvSwift) })] + [DllImport(SwiftLib, EntryPoint = "$s17SwiftRetAbiStress05swiftB6Func99AA3S99VyF")] + private static extern S99 SwiftRetFunc99(); + + [Fact] + public static void TestSwiftRetFunc99() + { + Console.Write("Running SwiftRetFunc99: "); + S99 val = SwiftRetFunc99(); + Assert.Equal((int)1117297545, val.F0.F0); + Assert.Equal((float)1539294, val.F1); + Console.WriteLine("OK"); + } + +} diff --git a/src/tests/Interop/Swift/SwiftRetAbiStress/SwiftRetAbiStress.csproj b/src/tests/Interop/Swift/SwiftRetAbiStress/SwiftRetAbiStress.csproj new file mode 100644 index 0000000000000..a57cd84cf8842 --- /dev/null +++ b/src/tests/Interop/Swift/SwiftRetAbiStress/SwiftRetAbiStress.csproj @@ -0,0 +1,16 @@ + + + + true + true + + true + + + + + + + + + diff --git a/src/tests/Interop/Swift/SwiftRetAbiStress/SwiftRetAbiStress.swift b/src/tests/Interop/Swift/SwiftRetAbiStress/SwiftRetAbiStress.swift new file mode 100644 index 0000000000000..2373b51068756 --- /dev/null +++ b/src/tests/Interop/Swift/SwiftRetAbiStress/SwiftRetAbiStress.swift @@ -0,0 +1,1611 @@ +import Foundation + +@frozen +public struct S0 +{ + public let f0 : Int16; + public let f1 : Int32; + public let f2 : UInt64; +} + +public func swiftRetFunc0() -> S0 { + return S0(f0: -17813, f1: 318006528, f2: 1195162122024233590) +} + +@frozen +public struct S1 +{ + public let f0 : Int16; + public let f1 : Float; + public let f2 : Int64; + public let f3 : UInt32; +} + +public func swiftRetFunc1() -> S1 { + return S1(f0: -29793, f1: 7351779, f2: 133491708229548754, f3: 665726990) +} + +@frozen +public struct S2_S0 +{ + public let f0 : UInt64; +} + +@frozen +public struct S2 +{ + public let f0 : S2_S0; + public let f1 : UInt8; + public let f2 : UInt16; + public let f3 : Float; + public let f4 : Int32; +} + +public func swiftRetFunc2() -> S2 { + return S2(f0: S2_S0(f0: 2153637757371267722), f1: 150, f2: 48920, f3: 3564327, f4: 1310569731) +} + +@frozen +public struct S3 +{ + public let f0 : Int64; + public let f1 : Double; + public let f2 : Int8; + public let f3 : Int32; + public let f4 : UInt16; + public let f5 : UInt8; + public let f6 : Double; +} + +public func swiftRetFunc3() -> S3 { + return S3(f0: 5610153900386943274, f1: 2431035148834736, f2: 111, f3: 772269424, f4: 19240, f5: 146, f6: 821805530740405) +} + +@frozen +public struct S4 +{ + public let f0 : Int8; + public let f1 : UInt32; + public let f2 : UInt64; + public let f3 : Int64; +} + +public func swiftRetFunc4() -> S4 { + return S4(f0: 125, f1: 377073381, f2: 964784376430620335, f3: 5588038704850976624) +} + +@frozen +public struct S5_S0 +{ + public let f0 : UInt32; + public let f1 : Double; +} + +@frozen +public struct S5 +{ + public let f0 : UInt64; + public let f1 : Int8; + public let f2 : UInt; + public let f3 : S5_S0; + public let f4 : Int; + public let f5 : UInt8; +} + +public func swiftRetFunc5() -> S5 { + return S5(f0: 5315019731968023493, f1: 114, f2: 1154655179105889397, f3: S5_S0(f0: 1468030771, f1: 3066473182924818), f4: 6252650621827449809, f5: 129) +} + +@frozen +public struct S6 +{ + public let f0 : Int32; + public let f1 : Int16; + public let f2 : Int64; + public let f3 : UInt16; +} + +public func swiftRetFunc6() -> S6 { + return S6(f0: 743741783, f1: -6821, f2: 5908745692727636656, f3: 64295) +} + +@frozen +public struct S7_S0 +{ + public let f0 : Int; +} + +@frozen +public struct S7 +{ + public let f0 : S7_S0; +} + +public func swiftRetFunc7() -> S7 { + return S7(f0: S7_S0(f0: 7625368278886567558)) +} + +@frozen +public struct S8 +{ + public let f0 : Int; +} + +public func swiftRetFunc8() -> S8 { + return S8(f0: 775279004683334365) +} + +@frozen +public struct S9_S0 +{ + public let f0 : Int16; + public let f1 : Int32; +} + +@frozen +public struct S9 +{ + public let f0 : UInt32; + public let f1 : Int; + public let f2 : S9_S0; + public let f3 : UInt16; +} + +public func swiftRetFunc9() -> S9 { + return S9(f0: 1223030410, f1: 4720638462358523954, f2: S9_S0(f0: 30631, f1: 1033774469), f3: 64474) +} + +@frozen +public struct S10 +{ + public let f0 : Float; + public let f1 : Float; +} + +public func swiftRetFunc10() -> S10 { + return S10(f0: 3276917, f1: 6694615) +} + +@frozen +public struct S11 +{ + public let f0 : Double; + public let f1 : Int; + public let f2 : UInt32; + public let f3 : Int8; +} + +public func swiftRetFunc11() -> S11 { + return S11(f0: 938206348036312, f1: 6559514243876905696, f2: 1357772248, f3: 59) +} + +@frozen +public struct S12 +{ + public let f0 : Double; +} + +public func swiftRetFunc12() -> S12 { + return S12(f0: 1580503485222363) +} + +@frozen +public struct S13 +{ + public let f0 : UInt32; +} + +public func swiftRetFunc13() -> S13 { + return S13(f0: 1381551558) +} + +@frozen +public struct S14_S0_S0 +{ + public let f0 : Int8; +} + +@frozen +public struct S14_S0 +{ + public let f0 : S14_S0_S0; +} + +@frozen +public struct S14 +{ + public let f0 : Int32; + public let f1 : UInt16; + public let f2 : Int8; + public let f3 : Float; + public let f4 : UInt64; + public let f5 : S14_S0; + public let f6 : Int8; +} + +public func swiftRetFunc14() -> S14 { + return S14(f0: 1765691191, f1: 56629, f2: 25, f3: 2944946, f4: 951929105049584033, f5: S14_S0(f0: S14_S0_S0(f0: -30)), f6: 66) +} + +@frozen +public struct S15_S0 +{ + public let f0 : UInt; + public let f1 : Float; +} + +@frozen +public struct S15 +{ + public let f0 : Int; + public let f1 : S15_S0; + public let f2 : UInt16; + public let f3 : Int32; +} + +public func swiftRetFunc15() -> S15 { + return S15(f0: 2090703541638269172, f1: S15_S0(f0: 6408314016925514463, f1: 6534515), f2: 30438, f3: 1745811802) +} + +@frozen +public struct S16 +{ + public let f0 : UInt32; + public let f1 : UInt64; + public let f2 : UInt8; + public let f3 : Int32; + public let f4 : UInt; + public let f5 : Int8; +} + +public func swiftRetFunc16() -> S16 { + return S16(f0: 585220635, f1: 4034210936973794153, f2: 48, f3: 1155081155, f4: 806384837403045657, f5: 54) +} + +@frozen +public struct S17 +{ + public let f0 : UInt8; + public let f1 : Int8; + public let f2 : UInt8; +} + +public func swiftRetFunc17() -> S17 { + return S17(f0: 23, f1: 112, f2: 15) +} + +@frozen +public struct S18_S0 +{ + public let f0 : UInt32; + public let f1 : Float; +} + +@frozen +public struct S18 +{ + public let f0 : S18_S0; + public let f1 : Int; + public let f2 : Int32; + public let f3 : UInt16; + public let f4 : Int16; +} + +public func swiftRetFunc18() -> S18 { + return S18(f0: S18_S0(f0: 1964425016, f1: 2767295), f1: 6016563774923595868, f2: 1648562735, f3: 378, f4: -20536) +} + +@frozen +public struct S19 +{ + public let f0 : UInt8; + public let f1 : UInt16; + public let f2 : Float; + public let f3 : UInt64; + public let f4 : Int32; +} + +public func swiftRetFunc19() -> S19 { + return S19(f0: 188, f1: 47167, f2: 6781297, f3: 8140268502944465472, f4: 708690468) +} + +@frozen +public struct S20_S0 +{ + public let f0 : UInt32; + public let f1 : Float; +} + +@frozen +public struct S20 +{ + public let f0 : S20_S0; + public let f1 : UInt8; +} + +public func swiftRetFunc20() -> S20 { + return S20(f0: S20_S0(f0: 2019361333, f1: 938975), f1: 192) +} + +@frozen +public struct S21_S0_S0 +{ + public let f0 : UInt16; +} + +@frozen +public struct S21_S0 +{ + public let f0 : S21_S0_S0; +} + +@frozen +public struct S21 +{ + public let f0 : Double; + public let f1 : Double; + public let f2 : UInt; + public let f3 : Int; + public let f4 : UInt64; + public let f5 : S21_S0; +} + +public func swiftRetFunc21() -> S21 { + return S21(f0: 1693878073402490, f1: 3392111340517811, f2: 3584917502172813732, f3: 665495086154608745, f4: 2918107814961929578, f5: S21_S0(f0: S21_S0_S0(f0: 4634))) +} + +@frozen +public struct S22 +{ + public let f0 : UInt32; +} + +public func swiftRetFunc22() -> S22 { + return S22(f0: 640156952) +} + +@frozen +public struct S23 +{ + public let f0 : UInt8; + public let f1 : Int16; + public let f2 : UInt64; + public let f3 : UInt; + public let f4 : UInt; + public let f5 : UInt64; + public let f6 : UInt8; +} + +public func swiftRetFunc23() -> S23 { + return S23(f0: 122, f1: 28995, f2: 25673626033589541, f3: 828363978755325884, f4: 3065573182429720699, f5: 1484484917001276079, f6: 209) +} + +@frozen +public struct S24 +{ + public let f0 : UInt64; + public let f1 : UInt64; +} + +public func swiftRetFunc24() -> S24 { + return S24(f0: 2621245238416080387, f1: 6541787564638363256) +} + +@frozen +public struct S25_S0 +{ + public let f0 : Int; +} + +@frozen +public struct S25 +{ + public let f0 : Int8; + public let f1 : Int8; + public let f2 : UInt8; + public let f3 : S25_S0; + public let f4 : UInt32; +} + +public func swiftRetFunc25() -> S25 { + return S25(f0: 30, f1: -8, f2: 168, f3: S25_S0(f0: 7601538494489501573), f4: 814523741) +} + +@frozen +public struct S26 +{ + public let f0 : Float; +} + +public func swiftRetFunc26() -> S26 { + return S26(f0: 3681545) +} + +@frozen +public struct S27 +{ + public let f0 : Int64; + public let f1 : Double; + public let f2 : Int8; + public let f3 : Int; + public let f4 : Int16; + public let f5 : Int64; +} + +public func swiftRetFunc27() -> S27 { + return S27(f0: 4847421047018330189, f1: 3655171692392280, f2: 46, f3: 4476120319602257660, f4: -6106, f5: 5756567968111212829) +} + +@frozen +public struct S28_S0 +{ + public let f0 : Double; +} + +@frozen +public struct S28 +{ + public let f0 : Float; + public let f1 : Int16; + public let f2 : S28_S0; + public let f3 : Double; + public let f4 : UInt64; +} + +public func swiftRetFunc28() -> S28 { + return S28(f0: 3491512, f1: 5249, f2: S28_S0(f0: 1107064327388314), f3: 2170381648425673, f4: 5138313315157580943) +} + +@frozen +public struct S29 +{ + public let f0 : UInt16; + public let f1 : UInt32; + public let f2 : Int16; + public let f3 : Int32; + public let f4 : Int32; + public let f5 : UInt64; + public let f6 : Int16; +} + +public func swiftRetFunc29() -> S29 { + return S29(f0: 39000, f1: 408611655, f2: 18090, f3: 351857085, f4: 1103441843, f5: 5162040247631126074, f6: -27930) +} + +@frozen +public struct S30_S0 +{ + public let f0 : Int8; + public let f1 : Int8; + public let f2 : Int32; +} + +@frozen +public struct S30_S1 +{ + public let f0 : Float; +} + +@frozen +public struct S30 +{ + public let f0 : Float; + public let f1 : S30_S0; + public let f2 : S30_S1; + public let f3 : Int64; +} + +public func swiftRetFunc30() -> S30 { + return S30(f0: 6492602, f1: S30_S0(f0: 76, f1: -26, f2: 1777644423), f2: S30_S1(f0: 6558571), f3: 5879147675377398012) +} + +@frozen +public struct S31 +{ + public let f0 : Int64; + public let f1 : UInt64; + public let f2 : UInt16; + public let f3 : UInt16; + public let f4 : Int8; +} + +public func swiftRetFunc31() -> S31 { + return S31(f0: 4699402628739628277, f1: 7062790893852687562, f2: 28087, f3: 11088, f4: 69) +} + +@frozen +public struct S32 +{ + public let f0 : Int32; + public let f1 : UInt64; + public let f2 : UInt64; + public let f3 : UInt32; + public let f4 : Int16; + public let f5 : UInt16; +} + +public func swiftRetFunc32() -> S32 { + return S32(f0: 688805466, f1: 8860655326984381661, f2: 6943423675662271404, f3: 196368476, f4: 14229, f5: 34635) +} + +@frozen +public struct S33 +{ + public let f0 : UInt16; + public let f1 : UInt32; + public let f2 : Int32; + public let f3 : UInt16; + public let f4 : Float; + public let f5 : UInt64; + public let f6 : Int; +} + +public func swiftRetFunc33() -> S33 { + return S33(f0: 9297, f1: 7963252, f2: 556244690, f3: 19447, f4: 6930550, f5: 126294981263481729, f6: 2540579257616511618) +} + +@frozen +public struct S34 +{ + public let f0 : Int64; + public let f1 : UInt32; + public let f2 : UInt64; +} + +public func swiftRetFunc34() -> S34 { + return S34(f0: 5845561428743737556, f1: 1358941228, f2: 3701080255861218446) +} + +@frozen +public struct S35 +{ + public let f0 : Float; + public let f1 : Float; + public let f2 : Int64; + public let f3 : UInt8; + public let f4 : Double; + public let f5 : UInt16; +} + +public func swiftRetFunc35() -> S35 { + return S35(f0: 5982956, f1: 3675164, f2: 229451138397478297, f3: 163, f4: 2925293762193390, f5: 5018) +} + +@frozen +public struct S36 +{ + public let f0 : Int32; + public let f1 : Int64; + public let f2 : UInt64; +} + +public func swiftRetFunc36() -> S36 { + return S36(f0: 1915776502, f1: 2197655909333830531, f2: 6072941592567177049) +} + +@frozen +public struct S37 +{ + public let f0 : UInt8; + public let f1 : Double; +} + +public func swiftRetFunc37() -> S37 { + return S37(f0: 18, f1: 4063164371882658) +} + +@frozen +public struct S38 +{ + public let f0 : UInt; + public let f1 : Int64; + public let f2 : UInt8; + public let f3 : UInt; +} + +public func swiftRetFunc38() -> S38 { + return S38(f0: 7389960750529773276, f1: 2725802169582362061, f2: 2, f3: 3659261019360356514) +} + +@frozen +public struct S39 +{ + public let f0 : Int32; + public let f1 : Int32; + public let f2 : Int; + public let f3 : Int16; + public let f4 : UInt16; +} + +public func swiftRetFunc39() -> S39 { + return S39(f0: 50995691, f1: 1623216479, f2: 2906650346451599789, f3: 28648, f4: 8278) +} + +@frozen +public struct S40_S0 +{ + public let f0 : Float; + public let f1 : UInt8; + public let f2 : Int8; + public let f3 : UInt; + public let f4 : Double; +} + +@frozen +public struct S40 +{ + public let f0 : S40_S0; + public let f1 : Int16; + public let f2 : Int16; +} + +public func swiftRetFunc40() -> S40 { + return S40(f0: S40_S0(f0: 7087264, f1: 37, f2: -5, f3: 479915249821490487, f4: 144033730096589), f1: 28654, f2: 16398) +} + +@frozen +public struct S41 +{ + public let f0 : UInt; + public let f1 : UInt; +} + +public func swiftRetFunc41() -> S41 { + return S41(f0: 7923718819069382599, f1: 1539666179674725957) +} + +@frozen +public struct S42_S0 +{ + public let f0 : Int32; +} + +@frozen +public struct S42 +{ + public let f0 : UInt32; + public let f1 : Int64; + public let f2 : S42_S0; + public let f3 : UInt; +} + +public func swiftRetFunc42() -> S42 { + return S42(f0: 1046060439, f1: 8249831314190867613, f2: S42_S0(f0: 1097582349), f3: 2864677262092469436) +} + +@frozen +public struct S43_S0_S0 +{ + public let f0 : Float; +} + +@frozen +public struct S43_S0 +{ + public let f0 : S43_S0_S0; +} + +@frozen +public struct S43 +{ + public let f0 : S43_S0; + public let f1 : Int8; +} + +public func swiftRetFunc43() -> S43 { + return S43(f0: S43_S0(f0: S43_S0_S0(f0: 1586338)), f1: 104) +} + +@frozen +public struct S44 +{ + public let f0 : UInt8; + public let f1 : Int32; + public let f2 : Int; + public let f3 : UInt32; +} + +public func swiftRetFunc44() -> S44 { + return S44(f0: 94, f1: 1109076022, f2: 3135595850598607828, f3: 760084013) +} + +@frozen +public struct S45_S0 +{ + public let f0 : Int64; +} + +@frozen +public struct S45 +{ + public let f0 : Int16; + public let f1 : UInt64; + public let f2 : Int; + public let f3 : S45_S0; +} + +public func swiftRetFunc45() -> S45 { + return S45(f0: 3071, f1: 5908138438609341766, f2: 5870206722419946629, f3: S45_S0(f0: 8128455876189744801)) +} + +@frozen +public struct S46 +{ + public let f0 : Int16; + public let f1 : Int8; + public let f2 : Int8; + public let f3 : UInt32; + public let f4 : UInt8; + public let f5 : Int32; +} + +public func swiftRetFunc46() -> S46 { + return S46(f0: 14794, f1: 60, f2: -77, f3: 653898879, f4: 224, f5: 266602433) +} + +@frozen +public struct S47_S0 +{ + public let f0 : Int8; +} + +@frozen +public struct S47 +{ + public let f0 : Double; + public let f1 : S47_S0; +} + +public func swiftRetFunc47() -> S47 { + return S47(f0: 3195976594911793, f1: S47_S0(f0: -91)) +} + +@frozen +public struct S48 +{ + public let f0 : Int; +} + +public func swiftRetFunc48() -> S48 { + return S48(f0: 778504172538154682) +} + +@frozen +public struct S49_S0_S0 +{ + public let f0 : UInt64; +} + +@frozen +public struct S49_S0 +{ + public let f0 : S49_S0_S0; +} + +@frozen +public struct S49 +{ + public let f0 : UInt64; + public let f1 : S49_S0; + public let f2 : Int8; + public let f3 : Double; + public let f4 : UInt32; + public let f5 : UInt32; +} + +public func swiftRetFunc49() -> S49 { + return S49(f0: 4235011519458710874, f1: S49_S0(f0: S49_S0_S0(f0: 3120420438742285733)), f2: -8, f3: 1077419570643725, f4: 1985303212, f5: 264580506) +} + +@frozen +public struct S50 +{ + public let f0 : Int32; +} + +public func swiftRetFunc50() -> S50 { + return S50(f0: 1043912405) +} + +@frozen +public struct S51_S0_S0_S0 +{ + public let f0 : Float; +} + +@frozen +public struct S51_S0_S0 +{ + public let f0 : S51_S0_S0_S0; + public let f1 : Int16; +} + +@frozen +public struct S51_S0 +{ + public let f0 : Double; + public let f1 : S51_S0_S0; + public let f2 : UInt8; + public let f3 : Int64; +} + +@frozen +public struct S51 +{ + public let f0 : S51_S0; + public let f1 : Double; +} + +public func swiftRetFunc51() -> S51 { + return S51(f0: S51_S0(f0: 3266680719186600, f1: S51_S0_S0(f0: S51_S0_S0_S0(f0: 428247), f1: -24968), f2: 76, f3: 183022772513065490), f1: 2661928101793033) +} + +@frozen +public struct S52 +{ + public let f0 : UInt32; + public let f1 : Int64; + public let f2 : UInt32; + public let f3 : UInt64; + public let f4 : Int; + public let f5 : Int8; +} + +public func swiftRetFunc52() -> S52 { + return S52(f0: 1812191671, f1: 6594574760089190928, f2: 831147243, f3: 3301835731003365248, f4: 5382332538247340743, f5: -77) +} + +@frozen +public struct S53_S0 +{ + public let f0 : Int8; + public let f1 : UInt; +} + +@frozen +public struct S53 +{ + public let f0 : S53_S0; + public let f1 : Int32; + public let f2 : Int64; + public let f3 : Float; + public let f4 : Int8; +} + +public func swiftRetFunc53() -> S53 { + return S53(f0: S53_S0(f0: -123, f1: 3494916243607193741), f1: 1406699798, f2: 4018943158751734338, f3: 1084415, f4: -8) +} + +@frozen +public struct S54_S0 +{ + public let f0 : Double; +} + +@frozen +public struct S54 +{ + public let f0 : Int; + public let f1 : Int; + public let f2 : S54_S0; + public let f3 : Int64; +} + +public func swiftRetFunc54() -> S54 { + return S54(f0: 8623517456704997133, f1: 1521939500434086364, f2: S54_S0(f0: 3472783299414218), f3: 4761507229870258916) +} + +@frozen +public struct S55 +{ + public let f0 : Int16; + public let f1 : UInt32; + public let f2 : Int64; + public let f3 : UInt32; + public let f4 : Int8; + public let f5 : UInt8; +} + +public func swiftRetFunc55() -> S55 { + return S55(f0: -28051, f1: 1759912152, f2: 2038322238348454200, f3: 601094102, f4: 5, f5: 75) +} + +@frozen +public struct S56 +{ + public let f0 : UInt64; + public let f1 : Float; + public let f2 : Int8; + public let f3 : Int32; +} + +public func swiftRetFunc56() -> S56 { + return S56(f0: 6313168909786453069, f1: 6254558, f2: 115, f3: 847834891) +} + +@frozen +public struct S57 +{ + public let f0 : UInt; + public let f1 : Int16; + public let f2 : Int8; + public let f3 : Int32; +} + +public func swiftRetFunc57() -> S57 { + return S57(f0: 546304219852233452, f1: -27416, f2: 47, f3: 1094575684) +} + +@frozen +public struct S58 +{ + public let f0 : UInt64; + public let f1 : UInt64; +} + +public func swiftRetFunc58() -> S58 { + return S58(f0: 4612004722568513699, f1: 2222525519606580195) +} + +@frozen +public struct S59 +{ + public let f0 : Int8; + public let f1 : UInt; + public let f2 : Int; + public let f3 : Int8; + public let f4 : Int64; + public let f5 : UInt8; +} + +public func swiftRetFunc59() -> S59 { + return S59(f0: -92, f1: 7281011081566942937, f2: 8203439771560005792, f3: 103, f4: 1003386607251132236, f5: 6) +} + +@frozen +public struct S60 +{ + public let f0 : UInt64; + public let f1 : Int; +} + +public func swiftRetFunc60() -> S60 { + return S60(f0: 6922353269487057763, f1: 103032455997325768) +} + +@frozen +public struct S61_S0 +{ + public let f0 : Int64; + public let f1 : Int64; + public let f2 : Float; +} + +@frozen +public struct S61 +{ + public let f0 : UInt64; + public let f1 : S61_S0; + public let f2 : Int16; + public let f3 : Int32; +} + +public func swiftRetFunc61() -> S61 { + return S61(f0: 3465845922566501572, f1: S61_S0(f0: 8266662359091888314, f1: 7511705648638703076, f2: 535470), f2: -5945, f3: 523043523) +} + +@frozen +public struct S62_S0_S0 +{ + public let f0 : Int; +} + +@frozen +public struct S62_S0 +{ + public let f0 : UInt16; + public let f1 : Int16; + public let f2 : UInt16; + public let f3 : S62_S0_S0; +} + +@frozen +public struct S62 +{ + public let f0 : S62_S0; + public let f1 : Int; + public let f2 : UInt16; +} + +public func swiftRetFunc62() -> S62 { + return S62(f0: S62_S0(f0: 50789, f1: 30245, f2: 35063, f3: S62_S0_S0(f0: 3102684963408623932)), f1: 792877586576090769, f2: 24697) +} + +@frozen +public struct S63 +{ + public let f0 : Double; + public let f1 : Int; + public let f2 : Double; + public let f3 : Int8; + public let f4 : Float; +} + +public func swiftRetFunc63() -> S63 { + return S63(f0: 4097323000009314, f1: 4162427097168837193, f2: 140736061437152, f3: -59, f4: 7331757) +} + +@frozen +public struct S64_S0 +{ + public let f0 : UInt64; +} + +@frozen +public struct S64 +{ + public let f0 : S64_S0; + public let f1 : UInt64; + public let f2 : Int64; + public let f3 : Int; +} + +public func swiftRetFunc64() -> S64 { + return S64(f0: S64_S0(f0: 2624461610177878495), f1: 5222178027019975511, f2: 9006949357929457355, f3: 7966680593035770540) +} + +@frozen +public struct S65 +{ + public let f0 : Int; + public let f1 : Double; + public let f2 : UInt16; + public let f3 : Int16; + public let f4 : UInt8; + public let f5 : Int32; + public let f6 : UInt64; +} + +public func swiftRetFunc65() -> S65 { + return S65(f0: 6080968957098434687, f1: 3067343828504927, f2: 56887, f3: 804, f4: 235, f5: 121742660, f6: 9218677163034827308) +} + +@frozen +public struct S66 +{ + public let f0 : Int8; + public let f1 : UInt64; + public let f2 : UInt32; + public let f3 : UInt64; + public let f4 : UInt64; +} + +public func swiftRetFunc66() -> S66 { + return S66(f0: -16, f1: 7967447403042597794, f2: 2029697750, f3: 4180031087394830849, f4: 5847795120921557969) +} + +@frozen +public struct S67_S0 +{ + public let f0 : UInt64; +} + +@frozen +public struct S67 +{ + public let f0 : S67_S0; + public let f1 : UInt8; + public let f2 : UInt16; + public let f3 : UInt64; + public let f4 : UInt64; + public let f5 : Int8; +} + +public func swiftRetFunc67() -> S67 { + return S67(f0: S67_S0(f0: 4844204675254434929), f1: 135, f2: 13969, f3: 4897129719050177731, f4: 7233638107485862921, f5: -11) +} + +@frozen +public struct S68_S0 +{ + public let f0 : Double; +} + +@frozen +public struct S68 +{ + public let f0 : Int32; + public let f1 : UInt64; + public let f2 : UInt32; + public let f3 : S68_S0; + public let f4 : Int32; + public let f5 : Int8; +} + +public func swiftRetFunc68() -> S68 { + return S68(f0: 1708606840, f1: 1768121573985581212, f2: 1033319213, f3: S68_S0(f0: 2741322436867931), f4: 955320338, f5: 12) +} + +@frozen +public struct S69 +{ + public let f0 : UInt32; +} + +public func swiftRetFunc69() -> S69 { + return S69(f0: 2092746473) +} + +@frozen +public struct S70 +{ + public let f0 : UInt8; + public let f1 : Float; +} + +public func swiftRetFunc70() -> S70 { + return S70(f0: 76, f1: 4138467) +} + +@frozen +public struct S71_S0 +{ + public let f0 : Int8; + public let f1 : UInt64; + public let f2 : Int64; +} + +@frozen +public struct S71 +{ + public let f0 : S71_S0; + public let f1 : UInt8; + public let f2 : UInt8; +} + +public func swiftRetFunc71() -> S71 { + return S71(f0: S71_S0(f0: -98, f1: 8603744544763953916, f2: 8460721064583106347), f1: 10, f2: 88) +} + +@frozen +public struct S72 +{ + public let f0 : UInt32; +} + +public func swiftRetFunc72() -> S72 { + return S72(f0: 2021509367) +} + +@frozen +public struct S73 +{ + public let f0 : Int; + public let f1 : Int16; + public let f2 : UInt64; + public let f3 : Float; + public let f4 : Int32; + public let f5 : UInt; + public let f6 : UInt; +} + +public func swiftRetFunc73() -> S73 { + return S73(f0: 6222563427944465437, f1: 28721, f2: 1313300783845289148, f3: 6761, f4: 2074171265, f5: 6232209228889209160, f6: 1423931135184844265) +} + +@frozen +public struct S74 +{ + public let f0 : Int16; + public let f1 : Float; + public let f2 : Double; + public let f3 : UInt16; + public let f4 : Int8; +} + +public func swiftRetFunc74() -> S74 { + return S74(f0: 27115, f1: 1416098, f2: 4468576755457331, f3: 58864, f4: 81) +} + +@frozen +public struct S75_S0_S0 +{ + public let f0 : Int8; +} + +@frozen +public struct S75_S0 +{ + public let f0 : S75_S0_S0; + public let f1 : UInt8; +} + +@frozen +public struct S75 +{ + public let f0 : UInt64; + public let f1 : S75_S0; + public let f2 : UInt8; +} + +public func swiftRetFunc75() -> S75 { + return S75(f0: 8532911974860912350, f1: S75_S0(f0: S75_S0_S0(f0: -60), f1: 66), f2: 200) +} + +@frozen +public struct S76_S0_S0 +{ + public let f0 : Int16; +} + +@frozen +public struct S76_S0 +{ + public let f0 : Int8; + public let f1 : UInt64; + public let f2 : S76_S0_S0; + public let f3 : Double; +} + +@frozen +public struct S76 +{ + public let f0 : UInt8; + public let f1 : S76_S0; + public let f2 : Double; +} + +public func swiftRetFunc76() -> S76 { + return S76(f0: 69, f1: S76_S0(f0: -29, f1: 4872234474620951743, f2: S76_S0_S0(f0: 11036), f3: 585486652063917), f2: 2265391710186639) +} + +@frozen +public struct S77 +{ + public let f0 : Int32; + public let f1 : Int32; + public let f2 : Int32; + public let f3 : UInt32; + public let f4 : Int16; +} + +public func swiftRetFunc77() -> S77 { + return S77(f0: 4495211, f1: 1364377405, f2: 773989694, f3: 1121696315, f4: 7589) +} + +@frozen +public struct S78 +{ + public let f0 : UInt32; + public let f1 : UInt; +} + +public func swiftRetFunc78() -> S78 { + return S78(f0: 1767839225, f1: 7917317019379224114) +} + +@frozen +public struct S79_S0 +{ + public let f0 : Double; + public let f1 : UInt32; + public let f2 : Int32; +} + +@frozen +public struct S79 +{ + public let f0 : S79_S0; + public let f1 : UInt8; + public let f2 : Double; +} + +public func swiftRetFunc79() -> S79 { + return S79(f0: S79_S0(f0: 495074072703635, f1: 417605286, f2: 171326442), f1: 203, f2: 2976663235490421) +} + +@frozen +public struct S80 +{ + public let f0 : Int32; + public let f1 : Int16; + public let f2 : Int8; +} + +public func swiftRetFunc80() -> S80 { + return S80(f0: 999559959, f1: 19977, f2: -4) +} + +@frozen +public struct S81_S0 +{ + public let f0 : UInt; +} + +@frozen +public struct S81 +{ + public let f0 : Int32; + public let f1 : S81_S0; + public let f2 : Float; + public let f3 : Int64; + public let f4 : UInt32; + public let f5 : UInt8; + public let f6 : Int16; +} + +public func swiftRetFunc81() -> S81 { + return S81(f0: 452603110, f1: S81_S0(f0: 6240652733420985265), f2: 6469988, f3: 5775316279348621124, f4: 1398033592, f5: 105, f6: 21937) +} + +@frozen +public struct S82 +{ + public let f0 : Int; +} + +public func swiftRetFunc82() -> S82 { + return S82(f0: 6454754584537364459) +} + +@frozen +public struct S83 +{ + public let f0 : UInt64; + public let f1 : UInt32; + public let f2 : Float; + public let f3 : UInt8; + public let f4 : Float; +} + +public func swiftRetFunc83() -> S83 { + return S83(f0: 2998238441521688907, f1: 9623946, f2: 2577885, f3: 156, f4: 6678807) +} + +@frozen +public struct S84_S0 +{ + public let f0 : Int16; +} + +@frozen +public struct S84 +{ + public let f0 : S84_S0; +} + +public func swiftRetFunc84() -> S84 { + return S84(f0: S84_S0(f0: 16213)) +} + +@frozen +public struct S85_S0 +{ + public let f0 : Int16; + public let f1 : Int8; +} + +@frozen +public struct S85 +{ + public let f0 : Int64; + public let f1 : UInt8; + public let f2 : S85_S0; + public let f3 : Float; + public let f4 : Int; +} + +public func swiftRetFunc85() -> S85 { + return S85(f0: 8858924985061791416, f1: 200, f2: S85_S0(f0: 4504, f1: 60), f3: 5572917, f4: 6546369836182556538) +} + +@frozen +public struct S86 +{ + public let f0 : UInt16; + public let f1 : Float; + public let f2 : UInt32; +} + +public func swiftRetFunc86() -> S86 { + return S86(f0: 22762, f1: 4672435, f2: 719927700) +} + +@frozen +public struct S87 +{ + public let f0 : Int32; + public let f1 : UInt; + public let f2 : UInt64; +} + +public func swiftRetFunc87() -> S87 { + return S87(f0: 361750184, f1: 4206825694012787823, f2: 2885153391732919282) +} + +@frozen +public struct S88 +{ + public let f0 : UInt32; + public let f1 : Int16; + public let f2 : UInt32; +} + +public func swiftRetFunc88() -> S88 { + return S88(f0: 2125094198, f1: -10705, f2: 182007583) +} + +@frozen +public struct S89 +{ + public let f0 : UInt8; + public let f1 : UInt32; + public let f2 : Int32; + public let f3 : Int8; + public let f4 : Int64; +} + +public func swiftRetFunc89() -> S89 { + return S89(f0: 175, f1: 1062985476, f2: 1019006263, f3: -22, f4: 6888877252788498422) +} + +@frozen +public struct S90 +{ + public let f0 : UInt8; + public let f1 : Int32; + public let f2 : Int16; + public let f3 : Int; + public let f4 : UInt32; + public let f5 : UInt32; + public let f6 : Int64; +} + +public func swiftRetFunc90() -> S90 { + return S90(f0: 221, f1: 225825436, f2: -26231, f3: 5122880520199505508, f4: 907657092, f5: 707089277, f6: 6091814344013414920) +} + +@frozen +public struct S91 +{ + public let f0 : Double; + public let f1 : Int8; + public let f2 : Int8; + public let f3 : UInt32; + public let f4 : Int; + public let f5 : Int8; + public let f6 : Int16; +} + +public func swiftRetFunc91() -> S91 { + return S91(f0: 3265110225161261, f1: 62, f2: -38, f3: 946023589, f4: 4109819715069879890, f5: -73, f6: 20363) +} + +@frozen +public struct S92_S0 +{ + public let f0 : Float; + public let f1 : Int64; +} + +@frozen +public struct S92 +{ + public let f0 : Int64; + public let f1 : UInt; + public let f2 : S92_S0; + public let f3 : Int32; + public let f4 : Float; + public let f5 : Float; +} + +public func swiftRetFunc92() -> S92 { + return S92(f0: 3230438394207610137, f1: 3003396252681176136, f2: S92_S0(f0: 6494422, f1: 2971773224350614312), f3: 2063694141, f4: 3117041, f5: 1003760) +} + +@frozen +public struct S93 +{ + public let f0 : Int; + public let f1 : UInt8; + public let f2 : UInt32; + public let f3 : UInt32; + public let f4 : UInt64; +} + +public func swiftRetFunc93() -> S93 { + return S93(f0: 5170226481546239050, f1: 11, f2: 1120259582, f3: 1947849905, f4: 3690113387392112192) +} + +@frozen +public struct S94 +{ + public let f0 : UInt16; + public let f1 : Double; + public let f2 : Int16; + public let f3 : Double; + public let f4 : UInt64; +} + +public func swiftRetFunc94() -> S94 { + return S94(f0: 57111, f1: 1718940123307098, f2: -16145, f3: 1099321301986326, f4: 2972912419231960385) +} + +@frozen +public struct S95_S0 +{ + public let f0 : Double; +} + +@frozen +public struct S95 +{ + public let f0 : Int16; + public let f1 : S95_S0; + public let f2 : UInt64; +} + +public func swiftRetFunc95() -> S95 { + return S95(f0: 12620, f1: S95_S0(f0: 3232445258308074), f2: 97365157264460373) +} + +@frozen +public struct S96 +{ + public let f0 : Int8; + public let f1 : Double; + public let f2 : UInt64; + public let f3 : UInt64; + public let f4 : Int32; + public let f5 : Int64; +} + +public func swiftRetFunc96() -> S96 { + return S96(f0: 3, f1: 242355060906873, f2: 3087879465791321798, f3: 7363229136420263380, f4: 46853328, f5: 4148307028758236491) +} + +@frozen +public struct S97 +{ + public let f0 : UInt16; + public let f1 : Int32; + public let f2 : UInt16; + public let f3 : UInt32; +} + +public func swiftRetFunc97() -> S97 { + return S97(f0: 10651, f1: 2068379463, f2: 57307, f3: 329271020) +} + +@frozen +public struct S98 +{ + public let f0 : Double; + public let f1 : Int32; + public let f2 : Int64; + public let f3 : Int; + public let f4 : Float; + public let f5 : Double; +} + +public func swiftRetFunc98() -> S98 { + return S98(f0: 2250389231883613, f1: 1755058358, f2: 6686142382639170849, f3: 6456632014163315773, f4: 2818253, f5: 1085859434505817) +} + +@frozen +public struct S99_S0 +{ + public let f0 : Int32; +} + +@frozen +public struct S99 +{ + public let f0 : S99_S0; + public let f1 : Float; +} + +public func swiftRetFunc99() -> S99 { + return S99(f0: S99_S0(f0: 1117297545), f1: 1539294) +} + diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 0e050b5fe3840..01b2f9aab129d 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -1876,6 +1876,9 @@ https://github.com/dotnet/runtime/issues/93631: Swift frozen struct support is not implemented on Mono yet + + https://github.com/dotnet/runtime/issues/93631: Swift frozen struct support is not implemented on Mono yet +