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

[RISC-V] coreclr-jit directory #82379

Merged
merged 27 commits into from
Apr 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
15cf55b
[RISCV-V] coreclr-jit directory
clamp03 Oct 26, 2022
f4aa536
Fix in jit/CMakeLists.txt
clamp03 Feb 20, 2023
37f9519
Tidy up by jit-format
clamp03 Feb 20, 2023
f3a7a41
Add a emitIns_S_R_R to handling more temporary reg
clamp03 Feb 21, 2023
521db1c
Fix jit code format
clamp03 Feb 21, 2023
48c198c
Fix
clamp03 Mar 7, 2023
8760646
[JIT] Fix test
clamp03 Mar 7, 2023
60d461d
[JIT] Updated
clamp03 Mar 8, 2023
d18dba2
[JIT] JitFormat
clamp03 Mar 8, 2023
2ed1f9c
[JIT] Enable IsImplicitByrefParameterValuePostMorph
clamp03 Mar 8, 2023
d78f857
[JIT] Update
clamp03 Mar 9, 2023
ffb1eb6
Merge remote-tracking branch 'upstream/main' into riscv_jit
clamp03 Mar 10, 2023
6c4b302
[JIT] Replace to RISCV64
clamp03 Mar 15, 2023
30591c9
[JIT] Update emitter and fix bugs
clamp03 Mar 22, 2023
2cff93e
[JIT] Fix a build error (remove GT_ADDR)
clamp03 Apr 3, 2023
b8d92e1
[JIT] FIX BUILD ERROR
clamp03 Apr 4, 2023
618978a
[JIT] Update by reviews
clamp03 Apr 5, 2023
cec6fa0
[JIT] Update JCMP and fix related errors
clamp03 Apr 5, 2023
db341cc
[JIT] Add NYI
clamp03 Apr 5, 2023
607dd64
[JIT] Add getRISCV64PassStructInRegisterFlags
clamp03 Apr 6, 2023
6492c51
[JIT] Remove constant handling in genRangeCheck
clamp03 Apr 6, 2023
f06eef5
[VM] Add getRISCV64PassStructInRegisterFlags
clamp03 Apr 6, 2023
672629a
[VM] Update JITEEVersionIdentifier
clamp03 Apr 6, 2023
f25d760
Merge remote-tracking branch 'upstream/main' into riscv_jit
clamp03 Apr 6, 2023
718b6d9
Run jit-format
jakobbotsch Apr 6, 2023
b94ebc5
Merge branch 'main' of github.com:dotnet/runtime into pr-82379
jakobbotsch Apr 8, 2023
f39aaa3
Fix after merge
jakobbotsch Apr 8, 2023
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
Prev Previous commit
Next Next commit
Add a emitIns_S_R_R to handling more temporary reg
  • Loading branch information
clamp03 committed Mar 8, 2023
commit f3a7a41d5d6c0572b9ae65b7ae3b0a159f97ee0c
63 changes: 0 additions & 63 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,11 +793,7 @@ template void Compiler::compChangeLife<true>(VARSET_VALARG_TP newLife);
*/
void CodeGenInterface::spillReg(var_types type, TempDsc* tmp, regNumber reg)
{
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(type), emitActualTypeSize(type), reg, REG_NA, tmp->tdTempNum(), 0);
#else
GetEmitter()->emitIns_S_R(ins_Store(type), emitActualTypeSize(type), reg, tmp->tdTempNum(), 0);
#endif
}

/*****************************************************************************
Expand Down Expand Up @@ -3561,11 +3557,7 @@ void CodeGen::genFnPrologCalleeRegArgs(regNumber xtraReg, bool* pXtraRegClobbere
// Since slot is typically 1, baseOffset is typically 0
int baseOffset = (regArgTab[argNum].slot - 1) * slotSize;

#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(storeType), size, srcRegNum, REG_NA, varNum, baseOffset);
#else
GetEmitter()->emitIns_S_R(ins_Store(storeType), size, srcRegNum, varNum, baseOffset);
#endif

#ifndef UNIX_AMD64_ABI
// Check if we are writing past the end of the struct
Expand Down Expand Up @@ -4676,12 +4668,7 @@ void CodeGen::genZeroInitFrame(int untrLclHi, int untrLclLo, regNumber initReg,
if (layout->IsGCPtr(i))
{
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE,
#ifdef TARGET_RISCV64
genGetZeroReg(initReg, pInitRegZeroed), REG_NA, varNum,
i * REGSIZE_BYTES);
#else
genGetZeroReg(initReg, pInitRegZeroed), varNum, i * REGSIZE_BYTES);
#endif
}
}
}
Expand All @@ -4694,22 +4681,14 @@ void CodeGen::genZeroInitFrame(int untrLclHi, int untrLclLo, regNumber initReg,
unsigned i;
for (i = 0; i + REGSIZE_BYTES <= lclSize; i += REGSIZE_BYTES)
{
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, zeroReg, REG_NA, varNum, i);
#else
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, zeroReg, varNum, i);
#endif
}

#ifdef TARGET_64BIT
assert(i == lclSize || (i + sizeof(int) == lclSize));
if (i != lclSize)
{
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(TYP_INT), EA_4BYTE, zeroReg, REG_NA, varNum, i);
#else
GetEmitter()->emitIns_S_R(ins_Store(TYP_INT), EA_4BYTE, zeroReg, varNum, i);
#endif
i += sizeof(int);
}
#endif // TARGET_64BIT
Expand Down Expand Up @@ -6059,11 +6038,7 @@ void CodeGen::genFnProlog()

if (compiler->info.compPublishStubParam)
{
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_SECRET_STUB_PARAM, REG_NA,
#else
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_SECRET_STUB_PARAM,
#endif
compiler->lvaStubArgumentVar, 0);
assert(intRegState.rsCalleeRegArgMaskLiveIn & RBM_SECRET_STUB_PARAM);

Expand Down Expand Up @@ -6098,13 +6073,8 @@ void CodeGen::genFnProlog()
initRegZeroed = true;
}

#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, initReg, REG_NA, compiler->lvaShadowSPslotsVar,
firstSlotOffs);
#else
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, initReg, compiler->lvaShadowSPslotsVar,
firstSlotOffs);
#endif
}

#endif // !FEATURE_EH_FUNCLETS
Expand All @@ -6115,11 +6085,7 @@ void CodeGen::genFnProlog()
// Initialize the LocalAllocSP slot if there is localloc in the function.
if (compiler->lvaLocAllocSPvar != BAD_VAR_NUM)
{
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_SPBASE, REG_NA, compiler->lvaLocAllocSPvar, 0);
#else
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_SPBASE, compiler->lvaLocAllocSPvar, 0);
#endif
}
#endif // JIT32_GCENCODER

Expand Down Expand Up @@ -6365,11 +6331,7 @@ void CodeGen::genFnProlog()
}
else
{
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_EAX, REG_NA, argsStartVar, 0);
#else
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_EAX, argsStartVar, 0);
#endif
}
}

Expand All @@ -6381,11 +6343,7 @@ void CodeGen::genFnProlog()
assert(compiler->lvaReturnSpCheck != BAD_VAR_NUM);
assert(compiler->lvaGetDesc(compiler->lvaReturnSpCheck)->lvDoNotEnregister);
assert(compiler->lvaGetDesc(compiler->lvaReturnSpCheck)->lvOnFrame);
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_SPBASE, REG_NA, compiler->lvaReturnSpCheck, 0);
#else
GetEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_SPBASE, compiler->lvaReturnSpCheck, 0);
#endif
}
#endif // defined(DEBUG) && defined(TARGET_XARCH)

Expand Down Expand Up @@ -8204,11 +8162,7 @@ void CodeGen::genMultiRegStoreToLocal(GenTreeLclVar* lclNode)
{
// A byte field passed in a long register should be written on the stack as a byte.
instruction storeIns = ins_StoreFromSrc(reg, destType);
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(storeIns, emitTypeSize(destType), reg, REG_NA, fieldLclNum, 0);
#else
GetEmitter()->emitIns_S_R(storeIns, emitTypeSize(destType), reg, fieldLclNum, 0);
#endif
}
}
fieldVarDsc->SetRegNum(varReg);
Expand All @@ -8222,11 +8176,7 @@ void CodeGen::genMultiRegStoreToLocal(GenTreeLclVar* lclNode)
// Several fields could be passed in one register, copy using the register type.
// It could rewrite memory outside of the fields but local on the stack are rounded to POINTER_SIZE so
// it is safe to store a long register into a byte field as it is known that we have enough padding after.
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(srcType), emitTypeSize(srcType), reg, REG_NA, lclNum, offset);
#else
GetEmitter()->emitIns_S_R(ins_Store(srcType), emitTypeSize(srcType), reg, lclNum, offset);
#endif
offset += genTypeSize(srcType);

#ifdef DEBUG
Expand Down Expand Up @@ -8492,11 +8442,7 @@ void CodeGen::genStackPointerCheck(bool doStackPointerCheck,
assert(regTmp != REG_NA);
GetEmitter()->emitIns_Mov(INS_mov, EA_PTRSIZE, regTmp, REG_SPBASE, /* canSkip */ false);
GetEmitter()->emitIns_R_I(INS_sub, EA_PTRSIZE, regTmp, offset);
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(INS_cmp, EA_PTRSIZE, regTmp, REG_NA, lvaStackPointerVar, 0);
#else
GetEmitter()->emitIns_S_R(INS_cmp, EA_PTRSIZE, regTmp, lvaStackPointerVar, 0);
#endif
}
else
{
Expand Down Expand Up @@ -9409,23 +9355,14 @@ void CodeGen::genPoisonFrame(regMaskTP regLiveIn)
#ifdef TARGET_64BIT
if ((offs % 8) == 0 && end - offs >= 8)
{
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(TYP_LONG), EA_8BYTE, REG_SCRATCH, REG_NA, (int)varNum,
offs - addr);
#else
GetEmitter()->emitIns_S_R(ins_Store(TYP_LONG), EA_8BYTE, REG_SCRATCH, (int)varNum, offs - addr);
#endif
offs += 8;
continue;
}
#endif

assert((offs % 4) == 0 && end - offs >= 4);
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(TYP_INT), EA_4BYTE, REG_SCRATCH, REG_NA, (int)varNum, offs - addr);
#else
GetEmitter()->emitIns_S_R(ins_Store(TYP_INT), EA_4BYTE, REG_SCRATCH, (int)varNum, offs - addr);
#endif
offs += 4;
}
}
Expand Down
19 changes: 2 additions & 17 deletions src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,11 +1869,7 @@ void CodeGen::genPutArgStkFieldList(GenTreePutArgStk* putArgStk, unsigned outArg
#endif // FEATURE_SIMD
{
emitAttr attr = emitTypeSize(type);
#ifdef TARGET_RISCV64
GetEmitter()->emitIns_S_R(ins_Store(type), attr, reg, REG_NA, outArgVarNum, thisFieldOffset);
#else
GetEmitter()->emitIns_S_R(ins_Store(type), attr, reg, outArgVarNum, thisFieldOffset);
#endif
}

// We can't write beyond the arg area unless this is a tail call, in which case we use
Expand Down Expand Up @@ -2063,15 +2059,9 @@ void CodeGen::genSpillLocal(unsigned varNum, var_types type, GenTreeLclVar* lclN
// but the GTF_SPILL flag records the fact that the register value is going dead.
if (((lclNode->gtFlags & GTF_VAR_DEF) != 0) || (!varDsc->IsAlwaysAliveInMemory()))
{
// Store local variable to its home location.
// Ensure that lclVar stores are typed correctly.
#ifdef TARGET_RISCV64
assert(!compiler->isSIMDTypeLocalAligned(varNum));
GetEmitter()->emitIns_S_R(ins_Store(type, compiler->isSIMDTypeLocalAligned(varNum)), emitTypeSize(type), regNum,
REG_NA,
#else
// Store local variable to its home location.
// Ensure that lclVar stores are typed correctly.
GetEmitter()->emitIns_S_R(ins_Store(type, compiler->isSIMDTypeLocalAligned(varNum)), emitTypeSize(type), regNum,
#endif
varNum, 0);
}
}
Expand Down Expand Up @@ -2592,13 +2582,8 @@ void CodeGen::genStoreLongLclVar(GenTree* treeNode)

noway_assert((loVal->GetRegNum() != REG_NA) && (hiVal->GetRegNum() != REG_NA));

#ifdef TARGET_RISCV64
emit->emitIns_S_R(ins_Store(TYP_INT), EA_4BYTE, loVal->GetRegNum(), REG_NA, lclNum, 0);
emit->emitIns_S_R(ins_Store(TYP_INT), EA_4BYTE, hiVal->GetRegNum(), REG_NA, lclNum, genTypeSize(TYP_INT));
#else
emit->emitIns_S_R(ins_Store(TYP_INT), EA_4BYTE, loVal->GetRegNum(), lclNum, 0);
emit->emitIns_S_R(ins_Store(TYP_INT), EA_4BYTE, hiVal->GetRegNum(), lclNum, genTypeSize(TYP_INT));
#endif
}
#endif // !defined(TARGET_64BIT)

Expand Down
Loading