Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/coreclr/jit/codegenarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,16 @@ void CodeGen::genCodeForStoreLclVar(GenTreeLclVar* tree)
else // store into register (i.e move into register)
{
// Assign into targetReg when dataReg (from op1) is not the same register
inst_Mov(targetType, targetReg, dataReg, /* canSkip */ true);
if (!data->isUsedFromReg())
{
inst_Mov(targetType, targetReg, dataReg, /* canSkip */ true);
}
else
{
// We use 'emitActualTypeSize' as the instructions require 4BYTE.
inst_Mov_Extend(targetType, /* srcInReg */ true, targetReg, dataReg, /* canSkip */ true,
emitActualTypeSize(targetType));
}
}

genUpdateLifeStore(tree, targetReg, varDsc);
Expand Down
11 changes: 10 additions & 1 deletion src/coreclr/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2964,7 +2964,16 @@ void CodeGen::genCodeForStoreLclVar(GenTreeLclVar* lclNode)
else // store into register (i.e move into register)
{
// Assign into targetReg when dataReg (from op1) is not the same register
inst_Mov(targetType, targetReg, dataReg, /* canSkip */ true);
if (!data->isUsedFromReg())
{
inst_Mov(targetType, targetReg, dataReg, /* canSkip */ true);
}
else
{
// We use 'emitActualTypeSize' as the instructions require 8BYTE or 4BYTE.
inst_Mov_Extend(targetType, /* srcInReg */ true, targetReg, dataReg, /* canSkip */ true,
emitActualTypeSize(targetType));
}
}
genUpdateLifeStore(lclNode, targetReg, varDsc);
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/emitarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4185,7 +4185,7 @@ void emitter::emitIns_Mov(

case INS_sxtw:
{
assert(size == EA_8BYTE);
assert((size == EA_8BYTE) || (size == EA_4BYTE));
FALLTHROUGH;
}

Expand Down
39 changes: 39 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_84693/Runtime_84693.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// 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.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Xunit;

public class Test
{
public class Program
{
public static short s_2;

[MethodImpl(MethodImplOptions.NoInlining)]
public static void Consume(int x) {}

[MethodImpl(MethodImplOptions.NoInlining)]
public static int M8(byte arg0)
{
s_2 = 1;
arg0 = (byte)(-s_2);
var vr1 = arg0 & arg0;
Consume(vr1);
return vr1;
}
}

[Fact]
public static int TestEntryPoint() {
var result = Test.Program.M8(1);
if (result != 255)
{
return 0;
}
return 100;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>