Skip to content

Commit

Permalink
JIT: ensure AVX512 ternary operands aren't used twice (#91851)
Browse files Browse the repository at this point in the history
Don't spill unused zeros early; we might decide to use them later.

Fixes #91796.
  • Loading branch information
AndyAyersMS authored Sep 11, 2023
1 parent 036c14e commit c84ccfa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/coreclr/jit/hwintrinsicxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3602,17 +3602,19 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
op2 = impSIMDPopStack();
op1 = impSIMDPopStack();

if (unusedVal1)
// Consume operands we won't use, in case they have side effects.
//
if (unusedVal1 && !(*val1)->IsVectorZero())
{
impAppendTree(gtUnusedValNode(*val1), CHECK_SPILL_ALL, impCurStmtDI);
}

if (unusedVal2)
if (unusedVal2 && !(*val2)->IsVectorZero())
{
impAppendTree(gtUnusedValNode(*val2), CHECK_SPILL_ALL, impCurStmtDI);
}

if (unusedVal3)
if (unusedVal3 && !(*val3)->IsVectorZero())
{
impAppendTree(gtUnusedValNode(*val3), CHECK_SPILL_ALL, impCurStmtDI);
}
Expand Down

0 comments on commit c84ccfa

Please sign in to comment.