Skip to content

Commit b2bffbe

Browse files
Ensure that the various Max*Number and Min*Number APIs optimize correctly (#98125)
* Ensure that the various `Max*Number` and `Min*Number` APIs optimize correctly * Don't mark the test methods as AO * Add a missing using statement to the test
1 parent 1c20e23 commit b2bffbe

File tree

3 files changed

+763
-1
lines changed

3 files changed

+763
-1
lines changed

src/coreclr/jit/importercalls.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -8522,7 +8522,8 @@ GenTree* Compiler::impMinMaxIntrinsic(CORINFO_METHOD_HANDLE method,
85228522

85238523
if (isNumber)
85248524
{
8525-
std::swap(op1, op2);
8525+
// Swap the operands so that the cnsNode is op1, this prevents
8526+
// the unknown value (which could be NaN) from being selected.
85268527

85278528
retNode->AsHWIntrinsic()->Op(1) = op2;
85288529
retNode->AsHWIntrinsic()->Op(2) = op1;

0 commit comments

Comments
 (0)