Skip to content
New issue

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

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

Already on GitHub? # to your account

[JIT] X64 - Three instruction replacement sequence for multiply in certain cases #76981

Merged
merged 25 commits into from
Oct 20, 2022
Merged
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,12 +1107,12 @@ void CodeGen::genCodeForMul(GenTreeOp* treeNode)
inst_RV_SH(INS_shl, size, targetReg, shiftAmount);
}
#ifdef TARGET_AMD64
else if (!requiresOverflowCheck && rmOp->isUsedFromReg() && isPow2(imm + 1))
else if (!requiresOverflowCheck && rmOp->isUsedFromReg() && (imm <= 127) && isPow2(imm + 1))
{
uint64_t zextImm = static_cast<uint64_t>(static_cast<size_t>(imm + 1));
unsigned int shiftAmount = genLog2(zextImm );

inst_Mov(targetType, targetReg, rmOp->GetRegNum(), /* canSkip */ true);
inst_Mov(targetType, targetReg, rmOp->GetRegNum(), /* canSkip */ false);

inst_RV_SH(INS_shl, size, targetReg, shiftAmount);

Expand Down