-
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.
[release/8.0-staging] JIT: Home float parameters before integer param…
…eters (#98749) * JIT: Home float parameters before integer parameters Parameters that are going into float registers can come from integer registers in the presence of struct promotion. We need to home those before integer parameters or the source register could have been overridden by the integer parameter homing logic. Ideally it seems like the homing logic should be unified to handle all parameters simultaneously, but this seems like a simple enough fix. I do not think we have ABIs where we have the opposite kind constraint (integer parameters coming from float registers). Fix #96306 * Add test * Disable float -> int reg enregistration for some rare cases --------- Co-authored-by: Jakob Botsch Nielsen <[email protected]>
- Loading branch information
1 parent
1e166b8
commit ebb4a50
Showing
4 changed files
with
69 additions
and
1 deletion.
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
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
37 changes: 37 additions & 0 deletions
37
src/tests/JIT/Regression/JitBlue/Runtime_96306/Runtime_96306.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,37 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Numerics; | ||
using System.Runtime.CompilerServices; | ||
using Xunit; | ||
|
||
public class Runtime_96306 | ||
{ | ||
[Fact] | ||
public static int TestEntryPoint() | ||
{ | ||
return Foo(new Point2D { V = new Vector2(101, -1) }, 100); | ||
} | ||
|
||
// 'a' is passed in rcx but homed into xmm1 after promotion. | ||
// 'scale' is passed in xmm1 but spilled because of the call to Bar. | ||
// We must take care that we spill 'scale' before we home 'a'. | ||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static int Foo(Point2D a, float scale) | ||
{ | ||
Bar(); | ||
return ReturnValue(scale); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static int ReturnValue(float value) => (int)value; | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static void Bar() { } | ||
|
||
private struct Point2D | ||
{ | ||
public Vector2 V; | ||
} | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
src/tests/JIT/Regression/JitBlue/Runtime_96306/Runtime_96306.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,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Optimize>True</Optimize> | ||
<DebugType>None</DebugType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |