Skip to content

Commit

Permalink
Ensure we always consume the rounding mode operand and produce the re…
Browse files Browse the repository at this point in the history
…gister
  • Loading branch information
tannergooding committed Jan 27, 2024
1 parent cffe6ba commit b19a4c5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/coreclr/jit/hwintrinsiccodegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
if (lastOp->isContained())
{
assert(lastOp->IsCnsIntOrI());

int8_t mode = static_cast<int8_t>(lastOp->AsIntCon()->IconValue());
instOptions = AddEmbRoundingMode(instOptions, mode);
}
Expand All @@ -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);
Expand All @@ -231,6 +231,9 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
unreached();
}
}

genProduceReg(node);
return;
}
}
}
Expand Down Expand Up @@ -558,6 +561,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
unreached();
break;
}

genProduceReg(node);
return;
}
Expand Down

0 comments on commit b19a4c5

Please sign in to comment.