From 86103fd589e2f335fb1a895027220e9f7960e973 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Wed, 21 Jun 2023 17:06:43 -0700 Subject: [PATCH] Ensure Min/Max APIs are handled for float in VN (#87872) * Ensure Min/Max APIs are handled for float in VN * Apply formatting patch --- src/coreclr/jit/valuenum.cpp | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/coreclr/jit/valuenum.cpp b/src/coreclr/jit/valuenum.cpp index 51b97de0c5450..0e53adf01f848 100644 --- a/src/coreclr/jit/valuenum.cpp +++ b/src/coreclr/jit/valuenum.cpp @@ -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)); @@ -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));