Skip to content

Commit 3d45d16

Browse files
[RISC-V] Replace addi, addiw with mov, sext.w when immediate is zero
1 parent aafccd4 commit 3d45d16

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/coreclr/jit/emitriscv64.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,7 @@ void emitter::emitIns_Mov(
591591
{
592592
assert(isGeneralRegisterOrR0(srcReg));
593593
assert(isGeneralRegisterOrR0(dstReg));
594-
// emitIns_R_R_I(INS_addiw, attr, dstReg, srcReg, 0);
595-
emitIns_R_R(INS_sext_w, attr, dstReg, srcReg); // namu
594+
emitIns_R_R(INS_sext_w, attr, dstReg, srcReg);
596595
}
597596
else if (INS_fsgnj_s == ins || INS_fsgnj_d == ins)
598597
{
@@ -608,8 +607,7 @@ void emitter::emitIns_Mov(
608607
{
609608
assert(isGeneralRegisterOrR0(srcReg));
610609
assert(isGeneralRegisterOrR0(dstReg));
611-
// emitIns_R_R_I(INS_addi, attr, dstReg, srcReg, 0);
612-
emitIns_R_R(INS_mov, attr, dstReg, srcReg); // namu
610+
emitIns_R_R(INS_mov, attr, dstReg, srcReg);
613611
}
614612
}
615613
}
@@ -621,8 +619,7 @@ void emitter::emitIns_Mov(emitAttr attr, regNumber dstReg, regNumber srcReg, boo
621619
assert(attr == EA_4BYTE || attr == EA_PTRSIZE);
622620
if (isGeneralRegisterOrR0(dstReg) && isGeneralRegisterOrR0(srcReg))
623621
{
624-
// emitIns_R_R_I(attr == EA_4BYTE ? INS_addiw : INS_addi, attr, dstReg, srcReg, 0);
625-
emitIns_R_R(attr == EA_4BYTE ? INS_sext_w : INS_mov, attr, dstReg, srcReg); // namu
622+
emitIns_R_R(attr == EA_4BYTE ? INS_sext_w : INS_mov, attr, dstReg, srcReg);
626623
}
627624
else if (isGeneralRegisterOrR0(dstReg) && genIsValidFloatReg(srcReg))
628625
{

0 commit comments

Comments
 (0)