-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Fix two latent HWIntrinsic miscompiles in gentree.cpp #130832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tannergooding
merged 7 commits into
dotnet:main
from
tannergooding:gentree-correctness-fixes
Jul 21, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bac1caa
Fix GetOperForHWIntrinsicId testing isScalar pointer instead of value
tannergooding 24b5cea
Fix stray block clobbering needsFixup in gtNewSimdMinMaxNode
tannergooding b30845a
Add regression test for GetOperForHWIntrinsicId isScalar fix
tannergooding ac4ba64
Add regression test for gtNewSimdMinMaxNode needsFixup fix
tannergooding 2ad2d7e
Compare signed-zero results bitwise in Runtime_130831
tannergooding 45c9dfe
Reference new JitBlue tests from Regression_ro_2.csproj
tannergooding 683376a
Skip Runtime_130831 on Mono for signed-zero Min divergence
tannergooding File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
27 changes: 27 additions & 0 deletions
27
src/tests/JIT/Regression/JitBlue/Runtime_130830/Runtime_130830.cs
This file contains hidden or 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,27 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Runtime_130830; | ||
|
|
||
| using System.Runtime.CompilerServices; | ||
| using System.Runtime.Intrinsics; | ||
| using Xunit; | ||
|
|
||
| public static class Runtime_130830 | ||
| { | ||
| [Fact] | ||
| public static void TestEntryPoint() | ||
| { | ||
| Vector128<int> result = Test(Vector128.Create(10), Vector128.Create(100)); | ||
| Assert.Equal(Vector128.Create(90, 91, 92, 93), result); | ||
| } | ||
|
tannergooding marked this conversation as resolved.
|
||
|
|
||
| // The low lane of the constant is zero but the constant is not all-zero, so the | ||
| // subtract must not be treated as a negate; otherwise the constant is dropped and | ||
| // the result collapses to <90, 90, 90, 90>. | ||
| [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)] | ||
| private static Vector128<int> Test(Vector128<int> v1, Vector128<int> v2) | ||
| { | ||
| return (Vector128.Create(0, 1, 2, 3) - v1) + v2; | ||
| } | ||
| } | ||
36 changes: 36 additions & 0 deletions
36
src/tests/JIT/Regression/JitBlue/Runtime_130831/Runtime_130831.cs
This file contains hidden or 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,36 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Runtime_130831; | ||
|
|
||
| using System; | ||
| using System.Runtime.CompilerServices; | ||
| using Xunit; | ||
|
|
||
| public static class Runtime_130831 | ||
| { | ||
| // Compare the exact bit pattern: Double/Single.Equals treat -0.0 and +0.0 as equal, | ||
| // so a plain Assert.Equal would not observe a wrong-signed-zero result. | ||
| [Fact] | ||
| [SkipOnMono("https://github.com/dotnet/runtime/issues/131130", TestPlatforms.Any)] | ||
| public static void TestEntryPoint() | ||
| { | ||
| Assert.Equal(BitConverter.DoubleToInt64Bits(-0.0), BitConverter.DoubleToInt64Bits(MinNegZeroConst(+0.0))); | ||
| Assert.Equal(BitConverter.DoubleToInt64Bits(-0.0), BitConverter.DoubleToInt64Bits(MinNumberZeroConst(-0.0))); | ||
|
|
||
| Assert.Equal(BitConverter.SingleToInt32Bits(-0.0f), BitConverter.SingleToInt32Bits(MinNegZeroConst(+0.0f))); | ||
| Assert.Equal(BitConverter.SingleToInt32Bits(-0.0f), BitConverter.SingleToInt32Bits(MinNumberZeroConst(-0.0f))); | ||
| } | ||
|
tannergooding marked this conversation as resolved.
|
||
|
|
||
| [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)] | ||
| private static double MinNegZeroConst(double value) => double.Min(value, -0.0); | ||
|
|
||
| [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)] | ||
| private static double MinNumberZeroConst(double value) => double.MinNumber(value, +0.0); | ||
|
|
||
| [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)] | ||
| private static float MinNegZeroConst(float value) => float.Min(value, -0.0f); | ||
|
|
||
| [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)] | ||
| private static float MinNumberZeroConst(float value) => float.MinNumber(value, +0.0f); | ||
| } | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.