From 5ef47c852ffd51aaeb52e34391fe4fed261c9f26 Mon Sep 17 00:00:00 2001 From: Xu Liangyu Date: Mon, 26 Feb 2024 11:32:02 +0800 Subject: [PATCH] [LoongArch64] Fix some errors of the struct argument parsing in LoongArch64PassStructInRegister.cs (#98744) --- .../JitInterface/LoongArch64PassStructInRegister.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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)