-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JIT] ARM64 - Temporary fix for ldp/stp optimizations - with test fix (…
…#90700) * Added regression test 85765 * Mark M4 as NoInlining * Check current and last ins format to determine whether to proceed with the optimized ldr/str pair * Additional test * Feedback * Fix test * Fixing test again...
- Loading branch information
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/tests/JIT/Regression/JitBlue/Runtime_85765/Runtime_85765.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// 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 Xunit; | ||
|
||
public class Runtime_85765 | ||
{ | ||
public struct S0 | ||
{ | ||
public S0(bool f1): this() | ||
{ | ||
} | ||
} | ||
|
||
public struct S1 | ||
{ | ||
public byte F0; | ||
public bool F1; | ||
public bool F2; | ||
} | ||
|
||
[Fact] | ||
public static void Test() | ||
{ | ||
S1 vr2 = M4(); | ||
vr2.F2 |= vr2.F1; | ||
Assert.False(Consume(vr2.F2)); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
public static S1 M4() | ||
{ | ||
S1 var1 = default(S1); | ||
var vr0 = new S0(false); | ||
return var1; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static bool Consume(bool value) | ||
{ | ||
return value; | ||
} | ||
|
||
// ------ | ||
|
||
[Fact] | ||
public unsafe static void Test2() | ||
{ | ||
byte* bytes = stackalloc byte[1024]; | ||
bytes[0x1A] = 1; | ||
bytes[0x1B] = 2; | ||
int sum = Foo(bytes); | ||
Assert.True(sum == 515); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
public unsafe static int Foo(byte* b) | ||
{ | ||
return Unsafe.ReadUnaligned<int>(ref b[0x1A]) + Unsafe.ReadUnaligned<int>(ref b[0x1B]); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/tests/JIT/Regression/JitBlue/Runtime_85765/Runtime_85765.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Optimize>True</Optimize> | ||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |