Skip to content

Commit

Permalink
Don't emit mov for zero shift amount
Browse files Browse the repository at this point in the history
  • Loading branch information
amanasifkhalid committed Sep 3, 2024
1 parent ee5a4bb commit cd2656f
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/coreclr/jit/hwintrinsiccodegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,18 +434,8 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
for (helper.EmitBegin(); !helper.Done(); helper.EmitCaseEnd())
{
const int shiftAmount = helper.ImmValue();

if (shiftAmount == 0)
{
// TODO: Use emitIns_Mov instead.
// We do not use it currently because it will still elide the 'mov'
// even if 'canSkip' is false. We cannot elide the 'mov' here.
GetEmitter()->emitIns_R_R_R(INS_mov, emitTypeSize(node), targetReg, reg, reg);
}
else
{
GetEmitter()->emitIns_R_R_I(ins, emitSize, targetReg, reg, shiftAmount, opt);
}
assert((shiftAmount != 0) || (intrin.category == HW_Category_ShiftLeftByImmediate));
GetEmitter()->emitIns_R_R_I(ins, emitSize, targetReg, reg, shiftAmount, opt);
}
};

Expand Down

0 comments on commit cd2656f

Please sign in to comment.