Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 1 addition & 4 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25982,9 +25982,6 @@ GenTree* Compiler::gtNewSimdMinMaxNode(var_types type,
needsFixup = cnsNode->IsFloatNegativeZero();
}
else
{
needsFixup = cnsNode->IsVectorZero();
}
{
needsFixup = cnsNode->IsVectorNegativeZero(simdBaseType);
}
Expand Down Expand Up @@ -31103,7 +31100,7 @@ genTreeOps GenTreeHWIntrinsic::GetOperForHWIntrinsicId(bool* isScalar, bool getE
{
oper = GT_NEG;
}
else if (isScalar && op1->IsCnsVec() && op1->AsVecCon()->IsScalarZero(simdBaseType))
else if (*isScalar && op1->IsCnsVec() && op1->AsVecCon()->IsScalarZero(simdBaseType))
Comment thread
tannergooding marked this conversation as resolved.
{
oper = GT_NEG;
}
Expand Down
27 changes: 27 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_130830/Runtime_130830.cs
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);
}
Comment thread
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 src/tests/JIT/Regression/JitBlue/Runtime_130831/Runtime_130831.cs
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)));
}
Comment thread
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);
}
2 changes: 2 additions & 0 deletions src/tests/JIT/Regression/Regression_ro_2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
<Compile Include="JitBlue\Runtime_130248\Runtime_130248.cs" />
<Compile Include="JitBlue\Runtime_130286\Runtime_130286.cs" />
<Compile Include="JitBlue\Runtime_130425\Runtime_130425.cs" />
<Compile Include="JitBlue\Runtime_130830\Runtime_130830.cs" />
<Compile Include="JitBlue\Runtime_130831\Runtime_130831.cs" />
<Compile Include="JitBlue\Runtime_10337\Runtime_10337.cs" />
<Compile Include="JitBlue\Runtime_125160\Runtime_125160.cs" />
</ItemGroup>
Expand Down
Loading