Skip to content

Commit 1aed08f

Browse files
committed
Add spilling side effect + Fix of formats (#65625)
1 parent fd79612 commit 1aed08f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/coreclr/jit/importer.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4542,6 +4542,9 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
45424542

45434543
retNode = cnsNode;
45444544

4545+
impSpillSideEffects(false, (unsigned)CHECK_SPILL_ALL DEBUGARG(
4546+
"spill side effects before folding two consts"));
4547+
45454548
impPopStack();
45464549
impPopStack();
45474550
DEBUG_DESTROY_NODE(otherNode);
@@ -4553,28 +4556,35 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
45534556

45544557
if (cnsNode->IsFloatNaN())
45554558
{
4559+
impSpillSideEffects(false, (unsigned)CHECK_SPILL_ALL DEBUGARG(
4560+
"spill side effects before propagating NaN"));
4561+
45564562
// maxsd, maxss, minsd, and minss all return op2 if either is NaN
45574563
// we require NaN to be propagated so ensure the known NaN is op2
4564+
45584565
impPopStack();
45594566
impPopStack();
45604567
DEBUG_DESTROY_NODE(otherNode);
45614568

45624569
retNode = cnsNode;
45634570
break;
45644571
}
4565-
else if (ni == NI_System_Math_Max)
4572+
4573+
if (ni == NI_System_Math_Max)
45664574
{
45674575
// maxsd, maxss return op2 if both inputs are 0 of either sign
45684576
// we require +0 to be greater than -0, so we can't handle if
45694577
// the known constant is +0. This is because if the unknown value
45704578
// is -0, we'd need the cns to be op2. But if the unknown value
45714579
// is NaN, we'd need the cns to be op1 instead.
4580+
45724581
if (cnsNode->IsFloatPositiveZero())
45734582
{
45744583
break;
45754584
}
45764585

45774586
// Given the checks, op1 can safely be the cns and op2 the other node
4587+
45784588
ni = (callType == TYP_DOUBLE) ? NI_SSE2_Max : NI_SSE_Max;
45794589

45804590
// one is constant and we know its something we can handle, so pop both peeked values
@@ -4591,12 +4601,14 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
45914601
// the known constant is -0. This is because if the unknown value
45924602
// is +0, we'd need the cns to be op2. But if the unknown value
45934603
// is NaN, we'd need the cns to be op1 instead.
4604+
45944605
if (cnsNode->IsFloatNegativeZero())
45954606
{
45964607
break;
45974608
}
45984609

45994610
// Given the checks, op1 can safely be the cns and op2 the other node
4611+
46004612
ni = (callType == TYP_DOUBLE) ? NI_SSE2_Min : NI_SSE_Min;
46014613

46024614
// one is constant and we know its something we can handle, so pop both peeked values

0 commit comments

Comments
 (0)