Skip to content

Commit c84ccfa

Browse files
authored
JIT: ensure AVX512 ternary operands aren't used twice (#91851)
Don't spill unused zeros early; we might decide to use them later. Fixes #91796.
1 parent 036c14e commit c84ccfa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/coreclr/jit/hwintrinsicxarch.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3602,17 +3602,19 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
36023602
op2 = impSIMDPopStack();
36033603
op1 = impSIMDPopStack();
36043604

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

3610-
if (unusedVal2)
3612+
if (unusedVal2 && !(*val2)->IsVectorZero())
36113613
{
36123614
impAppendTree(gtUnusedValNode(*val2), CHECK_SPILL_ALL, impCurStmtDI);
36133615
}
36143616

3615-
if (unusedVal3)
3617+
if (unusedVal3 && !(*val3)->IsVectorZero())
36163618
{
36173619
impAppendTree(gtUnusedValNode(*val3), CHECK_SPILL_ALL, impCurStmtDI);
36183620
}

0 commit comments

Comments
 (0)