From: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 23:27:35 +0000 (-0600) Subject: JIT: ensure AVX512 ternary operands aren't used twice (#91883) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~122 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=267b39201599f6493b1d8f23874fbcca9e8f6c96;p=platform%2Fupstream%2Fdotnet%2Fruntime.git JIT: ensure AVX512 ternary operands aren't used twice (#91883) Don't spill unused zeros early; we might decide to use them later. Fixes #91796. Co-authored-by: Andy Ayers --- diff --git a/src/coreclr/jit/hwintrinsicxarch.cpp b/src/coreclr/jit/hwintrinsicxarch.cpp index 488f65b..0659999 100644 --- a/src/coreclr/jit/hwintrinsicxarch.cpp +++ b/src/coreclr/jit/hwintrinsicxarch.cpp @@ -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); }