-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[ARM-softfp/Linux] Get precise type for struct #6182
Conversation
/cc @dotnet/jit-contrib @briansull @janvorli @jyoungyun |
I don't think that this should require a new JIT/EE interface method. I think that for the |
I am also doing some work in this area. |
When HFA are disabled then all structs types are passed using the integer register set. Please take a look at PR #6198 |
@briansull IMHO it causes type-mismatched gentree. In my example in #6051, it fails with an assertion error. Here is jitdump just before crash.
However for arm(hardfp), HFA handles this case so there is no problem. |
@briansull I tested your work(#6198) but I get the same error. Actually I need something like https://github.com/dotnet/coreclr/pull/6198/files#diff-de7f32a5c493a88f0958dcea62ad2f67R524, but FEATURE_HFA is 0 for softfp so I'm thinking about implementing this PR again after #6198 is merged. According to @CarolEidt's guide this time. |
You may have to implement something new here. |
Compiler::getPrimitiveTypeForStruct may return TYP_FLOAT but is off on softfp. So we need to check that in another way rather than `IsHfa()`. Otherwise struct types with single float32 will make inconsistency in gentree. Which ends up with assert failure "Bad IL: Illegal assignment of float into integer!". Check is done in Compiler::getPrimitiveTypeForStruct, by isSingleFloat32Struct. Fix #6051
I have updated the code and its commit message. This resolves 12 subtests of Please take a look again. @briansull @CarolEidt |
I'm not sure why this is necessary but since this is for ARM_SOFTFP only, I'm OK with it. LGTM |
Looks good. |
In case of TYP_DOUBLE, it is bigger than pointer size so it is handled with RetBuf(It will be shown in gentree as In summary, the assert failure happens only for struct types which has only single float element. After this patch, gentree changes like below.
to:
|
[ARM-softfp/Linux] Get precise type for struct Commit migrated from dotnet/coreclr@1a685cb
Compiler::argOrReturnTypeForStruct returns TYP_INT for any size-4 value type struct.
On ARM(hardfp), it is processed by HFA, however HFA is off on softfp.
So we need to check if the actual return type is TYPE_INT or TYPE_FLOAT.
Otherwise struct types with single float32 get into problems.
Check is done in Compiler::argOrReturnTypeForStruct, by IsSingleFloat32Struct.
The implementation is almost same
IsHfa
andGetHfaType
because the logic is very similar.Fix #6051