From b19a4c5968ccd41072c0c3d80b49d9064d9844ba Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Fri, 26 Jan 2024 14:51:17 -0800 Subject: [PATCH] Ensure we always consume the rounding mode operand and produce the register --- src/coreclr/jit/hwintrinsiccodegenxarch.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/coreclr/jit/hwintrinsiccodegenxarch.cpp b/src/coreclr/jit/hwintrinsiccodegenxarch.cpp index 5f6b24925aac7..ec936c349c8f2 100644 --- a/src/coreclr/jit/hwintrinsiccodegenxarch.cpp +++ b/src/coreclr/jit/hwintrinsiccodegenxarch.cpp @@ -194,6 +194,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) if (lastOp->isContained()) { assert(lastOp->IsCnsIntOrI()); + int8_t mode = static_cast(lastOp->AsIntCon()->IconValue()); instOptions = AddEmbRoundingMode(instOptions, mode); } @@ -207,14 +208,13 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) emitAttr simdSize = emitActualTypeSize(Compiler::getSIMDTypeForSize(node->GetSimdSize())); assert(simdSize != 0); + genConsumeMultiOpOperands(node); + genConsumeRegs(lastOp); + switch (numArgs) { case 2: { - genConsumeRegs(node->Op(1)); - genConsumeRegs(node->Op(2)); - genConsumeRegs(lastOp); - auto emitSwCase = [&](int8_t i) { insOpts newInstOptions = AddEmbRoundingMode(instOptions, i); genHWIntrinsic_R_R_RM(node, ins, simdSize, newInstOptions); @@ -231,6 +231,9 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) unreached(); } } + + genProduceReg(node); + return; } } } @@ -558,6 +561,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) unreached(); break; } + genProduceReg(node); return; }