diff --git a/src/coreclr/tools/Common/JitInterface/LoongArch64PassStructInRegister.cs b/src/coreclr/tools/Common/JitInterface/LoongArch64PassStructInRegister.cs index 8592386dbb7cb..b0c193d095007 100644 --- a/src/coreclr/tools/Common/JitInterface/LoongArch64PassStructInRegister.cs +++ b/src/coreclr/tools/Common/JitInterface/LoongArch64PassStructInRegister.cs @@ -55,11 +55,7 @@ public static uint GetLoongArch64PassStructInRegisterFlags(TypeDesc typeDesc) int fieldIndex = 0; foreach (FieldDesc field in typeDesc.GetFields()) { - if (fieldIndex > 1) - { - return (uint)StructFloatFieldInfoFlags.STRUCT_NO_FLOAT_FIELD; - } - else if (field.IsStatic) + if (field.IsStatic) { continue; } @@ -162,6 +158,11 @@ public static uint GetLoongArch64PassStructInRegisterFlags(TypeDesc typeDesc) default: { + if ((numIntroducedFields == 2) && (field.FieldType.Category == TypeFlags.Class)) + { + return (uint)StructFloatFieldInfoFlags.STRUCT_NO_FLOAT_FIELD; + } + if (field.FieldType.GetElementSize().AsInt == 8) { if (numIntroducedFields > 1)