Skip to content

Commit

Permalink
Apply suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Dec 7, 2023
1 parent 2da97d5 commit e4df08a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/coreclr/jit/codegenloongarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6424,23 +6424,18 @@ void CodeGen::genCodeForInitBlkLoop(GenTreeBlk* initBlkNode)
// Extend liveness of dstReg in case if it gets killed by the store.
gcInfo.gcMarkRegPtrVal(dstReg, dstNode->TypeGet());

const regNumber offsetReg = initBlkNode->ExtractTempReg();
const regNumber tempReg = initBlkNode->ExtractTempReg();
const regNumber offsetReg = initBlkNode->GetSingleTempReg();
instGen_Set_Reg_To_Imm(EA_PTRSIZE, offsetReg, size - TARGET_POINTER_SIZE);

BasicBlock* loop = genCreateTempLabel();
genDefineTempLabel(loop);
GetEmitter()->emitDisableGC(); // TODO: add gcinfo to tempReg and remove nogc

// tempReg = dstReg + offset (a new interior pointer, but in a nongc region)
GetEmitter()->emitIns_R_R_R(INS_add_d, EA_PTRSIZE, tempReg, dstReg, offsetReg);
// *tempReg = 0
GetEmitter()->emitIns_R_R_R(INS_st_d, EA_PTRSIZE, zeroReg, tempReg, 0);
// *(dstReg + offsetReg) = 0
GetEmitter()->emitIns_R_R_R(INS_stx_d, EA_PTRSIZE, zeroReg, dstReg, offsetReg);
// offsetReg = offsetReg - 8
GetEmitter()->emitIns_R_R_I(INS_addi_d, EA_PTRSIZE, offsetReg, offsetReg, -8);
// if (offsetReg != 0) goto loop;
GetEmitter()->emitIns_J_cond_la(INS_beq, loop, offsetReg, zeroReg);
GetEmitter()->emitEnableGC();

gcInfo.gcMarkRegSetNpt(genRegMask(dstReg));
}
Expand Down

0 comments on commit e4df08a

Please sign in to comment.