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
3 changes: 2 additions & 1 deletion src/coreclr/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4536,7 +4536,8 @@ void CodeGen::genCodeForCompare(GenTreeOp* tree)
regNumber op1Reg = op1->GetRegNum();

if (compiler->opts.OptimizationEnabled() && (ins == INS_cmp) && (targetReg != REG_NA) &&
tree->OperIs(GT_LT) && intConst->IsIntegralConst(0) && ((cmpSize == EA_4BYTE) || (cmpSize == EA_8BYTE)))
tree->OperIs(GT_LT) && !tree->IsUnsigned() && intConst->IsIntegralConst(0) &&
((cmpSize == EA_4BYTE) || (cmpSize == EA_8BYTE)))
{
emit->emitIns_R_R_I(INS_lsr, cmpSize, targetReg, op1Reg, (int)cmpSize * 8 - 1);
genProduceReg(tree);
Expand Down
28 changes: 28 additions & 0 deletions src/tests/JIT/opt/Regressions/Regression7.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Licensed to the .NET Foundation under one or more agreements.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we usually put such regressions to JitBlue folder (historical reasons) and name them like Github_XXX

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair. Next time, I'll put them there. Just got so used to putting them in here.

// The .NET Foundation licenses this file to you under the MIT license.

// Generated by Fuzzlyn v1.5 on 2023-03-19 17:44:38
// Run on Arm64 Linux
// Seed: 516098027771570682
public class C0
{
public uint F1;
public C0(uint f1)
{
F1 = f1;
}
}

public class Program
{
// This test was testing an ARM64 regression when optimizing 'x < 0' when it didn't take into account an unsigned operation.
public static int Main()
{
var vr1 = new C0(4294967295U);
bool vr3 = !(vr1.F1 > -1);
if (!vr3)
return 100;
else
return 0;
}
}
12 changes: 12 additions & 0 deletions src/tests/JIT/opt/Regressions/Regression7.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>