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
2 changes: 1 addition & 1 deletion src/coreclr/jit/importercalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6693,7 +6693,7 @@ GenTree* Compiler::impRotateHelper(var_types baseType, genTreeOps rotateOper)
uint32_t cns1 = static_cast<uint32_t>(op1->AsIntConCommon()->IconValue());
uint32_t res =
(rotateOper == GT_ROL) ? BitOperations::RotateLeft(cns1, cns2) : BitOperations::RotateRight(cns1, cns2);
return gtNewIconNode(res, baseType);
return gtNewIconNode(static_cast<int32_t>(res), baseType);
}
}

Expand Down
30 changes: 30 additions & 0 deletions src/tests/JIT/Regression_ro_2/Runtime_135814.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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_135814
{
[Fact]
public static void TestEntryPoint()
{
Assert.True(TestGt(3));
Assert.False(TestLt(3));
Assert.True(TestRor(3));
Assert.Equal(-1, TestUInt());
}

[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
private static bool TestGt(int y) => y > int.RotateLeft(1, 31);

[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
private static bool TestLt(int y) => y < int.RotateLeft(1, 31);

[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
private static bool TestRor(int y) => y > int.RotateRight(1, 1);

[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
private static int TestUInt() => (int)BitOperations.RotateRight(0xFFFFFFFFu, 3);
Comment thread
EgorBo marked this conversation as resolved.
Resolved
}
Loading