diff --git a/src/coreclr/jit/codegenarm.cpp b/src/coreclr/jit/codegenarm.cpp index 81b8299238548..80d0e05ba1c12 100644 --- a/src/coreclr/jit/codegenarm.cpp +++ b/src/coreclr/jit/codegenarm.cpp @@ -1036,7 +1036,7 @@ void CodeGen::genCodeForStoreLclFld(GenTreeLclFld* tree) regNumber halfdoubleAsInt2 = internalRegisters.GetSingle(tree); emit->emitIns_R_R_R(INS_vmov_d2i, EA_8BYTE, halfdoubleAsInt1, halfdoubleAsInt2, dataReg); emit->emitIns_R_R_I(INS_str, EA_4BYTE, halfdoubleAsInt1, addr, 0); - emit->emitIns_R_R_I(INS_str, EA_4BYTE, halfdoubleAsInt1, addr, 4); + emit->emitIns_R_R_I(INS_str, EA_4BYTE, halfdoubleAsInt2, addr, 4); } } else diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_109269/Runtime_109269.cs b/src/tests/JIT/Regression/JitBlue/Runtime_109269/Runtime_109269.cs new file mode 100644 index 0000000000000..2a0120df88d2f --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_109269/Runtime_109269.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Xunit; + +public class Runtime_108969 +{ + [Fact] + public static int TestEntryPoint() => (int)Foo(100.0).D; + + [MethodImpl(MethodImplOptions.NoInlining)] + private static S Foo(double d) + { + S s = default; + s.D = d; + return s; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + struct S + { + public byte B; + public double D; + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_109269/Runtime_109269.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_109269/Runtime_109269.csproj new file mode 100644 index 0000000000000..bee837b6af2f7 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_109269/Runtime_109269.csproj @@ -0,0 +1,11 @@ + + + + true + True + + + + + +