Skip to content
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

Ensure mini-amd64 correctly handles CMP_GT and CMP_GE for OP_XCOMPARE_FP #104206

Merged
merged 3 commits into from
Jul 3, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -4826,7 +4826,6 @@ private static void TestCreateSequence<T>(T start, T step)

[Theory]
[MemberData(nameof(VectorTestMemberData.ExpDouble), MemberType = typeof(VectorTestMemberData))]
[SkipOnMono("https://github.com/dotnet/runtime/issues/97176")]
public void ExpDoubleTest(double value, double expectedResult, double variance)
{
Vector128<double> actualResult = Vector128.Exp(Vector128.Create(value));
Expand All @@ -4835,7 +4834,6 @@ public void ExpDoubleTest(double value, double expectedResult, double variance)

[Theory]
[MemberData(nameof(VectorTestMemberData.ExpSingle), MemberType = typeof(VectorTestMemberData))]
[SkipOnMono("https://github.com/dotnet/runtime/issues/97176")]
public void ExpSingleTest(float value, float expectedResult, float variance)
{
Vector128<float> actualResult = Vector128.Exp(Vector128.Create(value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5841,7 +5841,6 @@ private static void TestCreateSequence<T>(T start, T step)

[Theory]
[MemberData(nameof(VectorTestMemberData.ExpDouble), MemberType = typeof(VectorTestMemberData))]
[SkipOnMono("https://github.com/dotnet/runtime/issues/97176")]
public void ExpDoubleTest(double value, double expectedResult, double variance)
{
Vector256<double> actualResult = Vector256.Exp(Vector256.Create(value));
Expand All @@ -5850,7 +5849,6 @@ public void ExpDoubleTest(double value, double expectedResult, double variance)

[Theory]
[MemberData(nameof(VectorTestMemberData.ExpSingle), MemberType = typeof(VectorTestMemberData))]
[SkipOnMono("https://github.com/dotnet/runtime/issues/97176")]
public void ExpSingleTest(float value, float expectedResult, float variance)
{
Vector256<float> actualResult = Vector256.Exp(Vector256.Create(value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5274,7 +5274,6 @@ private static void TestCreateSequence<T>(T start, T step)

[Theory]
[MemberData(nameof(VectorTestMemberData.ExpDouble), MemberType = typeof(VectorTestMemberData))]
[SkipOnMono("https://github.com/dotnet/runtime/issues/97176")]
public void ExpDoubleTest(double value, double expectedResult, double variance)
{
Vector512<double> actualResult = Vector512.Exp(Vector512.Create(value));
Expand All @@ -5283,7 +5282,6 @@ public void ExpDoubleTest(double value, double expectedResult, double variance)

[Theory]
[MemberData(nameof(VectorTestMemberData.ExpSingle), MemberType = typeof(VectorTestMemberData))]
[SkipOnMono("https://github.com/dotnet/runtime/issues/97176")]
public void ExpSingleTest(float value, float expectedResult, float variance)
{
Vector512<float> actualResult = Vector512.Exp(Vector512.Create(value));
Expand Down
22 changes: 20 additions & 2 deletions src/mono/mono/mini/mini-amd64.c
Original file line number Diff line number Diff line change
Expand Up @@ -4072,8 +4072,26 @@ mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb)
case CMP_NE: ins->inst_c0 = 4; break;
case CMP_LT: ins->inst_c0 = 1; break;
case CMP_LE: ins->inst_c0 = 2; break;
case CMP_GT: ins->inst_c0 = 6; break;
case CMP_GE: ins->inst_c0 = 5; break;
case CMP_GT: {
// CMPNLT (5) is not the same as CMPGT due to NaN
// as such, we want to emit CMPLT (1) with swapped
// operands instead, ensuring we get correct handling
int tmp = ins->sreg1;
ins->sreg1 = ins->sreg2;
ins->sreg2 = tmp;
ins->inst_c0 = 1;
break;
}
case CMP_GE: {
// CMPNLE (6) is not the same as CMPGE due to NaN
// as such, we want to emit CMPLE (2) with swapped
// operands instead, ensuring we get correct handling
int tmp = ins->sreg1;
ins->sreg1 = ins->sreg2;
ins->sreg2 = tmp;
ins->inst_c0 = 2;
break;
}
default:
g_assert_not_reached();
break;
Expand Down
Loading