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 Min/Max APIs are handled for float in VN #87872

Merged
merged 2 commits into from
Jun 22, 2023
Merged
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
48 changes: 48 additions & 0 deletions src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8454,6 +8454,30 @@ ValueNum ValueNumStore::EvalMathFuncBinary(var_types typ, NamedIntrinsic gtMathF
break;
}

case NI_System_Math_MaxMagnitude:
{
assert(typ == TypeOfVN(arg1VN));
float arg1Val = GetConstantSingle(arg1VN);
res = FloatingPointUtils::maximumMagnitude(arg0Val, arg1Val);
break;
}

case NI_System_Math_MaxMagnitudeNumber:
{
assert(typ == TypeOfVN(arg1VN));
float arg1Val = GetConstantSingle(arg1VN);
res = FloatingPointUtils::maximumMagnitudeNumber(arg0Val, arg1Val);
break;
}

case NI_System_Math_MaxNumber:
{
assert(typ == TypeOfVN(arg1VN));
float arg1Val = GetConstantSingle(arg1VN);
res = FloatingPointUtils::maximumNumber(arg0Val, arg1Val);
break;
}

case NI_System_Math_Min:
{
assert(typ == TypeOfVN(arg1VN));
Expand All @@ -8462,6 +8486,30 @@ ValueNum ValueNumStore::EvalMathFuncBinary(var_types typ, NamedIntrinsic gtMathF
break;
}

case NI_System_Math_MinMagnitude:
{
assert(typ == TypeOfVN(arg1VN));
float arg1Val = GetConstantSingle(arg1VN);
res = FloatingPointUtils::minimumMagnitude(arg0Val, arg1Val);
break;
}

case NI_System_Math_MinMagnitudeNumber:
{
assert(typ == TypeOfVN(arg1VN));
float arg1Val = GetConstantSingle(arg1VN);
res = FloatingPointUtils::minimumMagnitudeNumber(arg0Val, arg1Val);
break;
}

case NI_System_Math_MinNumber:
{
assert(typ == TypeOfVN(arg1VN));
float arg1Val = GetConstantSingle(arg1VN);
res = FloatingPointUtils::minimumNumber(arg0Val, arg1Val);
break;
}

case NI_System_Math_Pow:
{
assert(typ == TypeOfVN(arg1VN));
Expand Down