Skip to content

Commit

Permalink
Ensure Min/Max APIs are handled for float in VN (#87872)
Browse files Browse the repository at this point in the history
* Ensure Min/Max APIs are handled for float in VN

* Apply formatting patch
  • Loading branch information
tannergooding authored Jun 22, 2023
1 parent b23c198 commit 86103fd
Showing 1 changed file with 48 additions and 0 deletions.
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

0 comments on commit 86103fd

Please sign in to comment.