Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we mark op2 as delayFree if it is rmw and the parent node returns a non-SIMD type #36226

Merged
1 commit merged into from
May 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/coreclr/src/jit/lsraxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2666,17 +2666,32 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree)
{
srcCount += BuildAddrUses(op2->gtGetOp1());
}
else if (isRMW && !op2->isContained())
else if (isRMW)
{
if (HWIntrinsicInfo::IsCommutative(intrinsicId))
if (!op2->isContained() && HWIntrinsicInfo::IsCommutative(intrinsicId))
{
// When op2 is not contained and we are commutative, we can set op2
// to also be a tgtPrefUse. Codegen will then swap the operands.

tgtPrefUse2 = BuildUse(op2);
srcCount += 1;
}
else
else if (!op2->isContained() || varTypeIsArithmetic(intrinsicTree->TypeGet()))
{
// When op2 is not contained or if we are producing a scalar value
// we need to mark it as delay free because the operand and target
// exist in the same register set.

srcCount += BuildDelayFreeUses(op2);
}
else
{
// When op2 is contained and we are not producing a scalar value we
// have no concerns of overwriting op2 because they exist in different
// register sets.

srcCount += BuildOperandUses(op2);
}
}
else
{
Expand Down