Skip to content

Commit

Permalink
Fix C side of HFA test
Browse files Browse the repository at this point in the history
  • Loading branch information
kg committed Oct 24, 2024
1 parent ac3d9c0 commit bc94472
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/tests/JIT/Directed/StructABI/StructABI.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,30 +221,34 @@ struct Nested9
struct InlineArray4 Field2;
};

#pragma pack(push, 1)
struct Issue80393_F2
{
double value;
};

struct Issue80393_S_Doubles
{
double f1;
double f3;
};

// We need to apply 1-byte packing to these structs to get the exact alignment we want, but we
// don't want to apply packing to the union or 2-doubles struct because it will change the natural
// alignment of the union and as a result alter which registers it's assigned to by clang, which
// won't match what CoreCLR does.
#pragma pack(push, 1)
struct Issue80393_F2
{
double value;
};

struct Issue80393_F2_Offset {
// 3 padding bytes to approximate C# FieldOffset of 3.
// This padding prevents the outer union from being treated as an HVA/HFA by clang for either arm32 or arm64.
char padding[3];
struct Issue80393_F2 F2;
};
#pragma pack(pop)

union Issue80393_S {
struct Issue80393_S_Doubles f1_f3;
struct Issue80393_F2_Offset f2;
};
#pragma pack(pop)

// NOTE: If investigating this in isolation, make sure you set -mfloat-abi=hard -mfpu=neon when building for arm32
DLLEXPORT union Issue80393_S Issue80393_HFA(union Issue80393_S value)
Expand Down

0 comments on commit bc94472

Please sign in to comment.