Skip to content
Open
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
11 changes: 2 additions & 9 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9650,7 +9650,7 @@ GenTree* Compiler::fgOptimizeHWIntrinsic(GenTreeHWIntrinsic* node)
}
else if (op1Oper == GT_NOT)
{
if (varTypeIsIntegral(simdBaseType))
if (!varTypeIsIntegral(simdBaseType))
{
break;
}
Expand Down Expand Up @@ -9678,14 +9678,7 @@ GenTree* Compiler::fgOptimizeHWIntrinsic(GenTreeHWIntrinsic* node)
node = gtNewSimdUnOpNode(GT_NEG, retType, op1, simdBaseType, simdSize)->AsHWIntrinsic();

#if defined(TARGET_XARCH)
if (varTypeIsFloating(simdBaseType))
{
node->AsHWIntrinsic()->Op(2)->SetMorphed(this);
}
else
{
node->AsHWIntrinsic()->Op(1)->SetMorphed(this);
}
node->Op(1)->SetMorphed(this);
#endif // TARGET_XARCH

return fgMorphHWIntrinsicRequired(node);
Expand Down
23 changes: 23 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_133522/Runtime_133522.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using Xunit;

public class Runtime_133522
{
[Fact]
public static void TestEntryPoint()
{
Assert.Equal(Vector128.Create(0xC03FFFFFu), ComplementAddOne(Vector128.Create(1.0f)).AsUInt32());
Assert.Equal(Vector128.Create(0xC007FFFFFFFFFFFFul), ComplementAddOne(Vector128.Create(1.0)).AsUInt64());
Assert.Equal(Vector128.Create(-1), ComplementAddOne(Vector128.Create(1)));
}

[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
private static Vector128<T> ComplementAddOne<T>(Vector128<T> value) where T : unmanaged
{
return ~value + Vector128<T>.One;
}
}
1 change: 1 addition & 0 deletions src/tests/JIT/Regression/Regression_ro_2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<Compile Include="JitBlue\Runtime_133022\Runtime_133022.cs" />
<Compile Include="JitBlue\Runtime_133101\Runtime_133101.cs" />
<Compile Include="JitBlue\Runtime_133207\Runtime_133207.cs" />
<Compile Include="JitBlue\Runtime_133522\Runtime_133522.cs" />
</ItemGroup>
<Import Project="$(TestSourceDir)MergedTestRunner.targets" />
</Project>
Loading