-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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] Added designated output instruction emitters #96741
[RISC-V] Added designated output instruction emitters #96741
Conversation
This reverts commit c238b82.
// This assert may be triggered by the untrimmed signed integers. Please refer to the TrimSigned helpers | ||
assertCodeLength(imm21, 21); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should call TrimSigned instead? These helpers assert isValidSimm anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On this stage imm
is unsigned
since the sign extension has to be removed at this stage (explicitly done via TrimSigned
functions or via LowerNBits
etc.). This means that I should use isValidUimm
or assertCodeLength
and I think that the latter one is more versatile.
static ssize_t LowerNBitsOfWord(ssize_t word) | ||
{ | ||
BYTE* const dst = *dp; | ||
BYTE* dstRW = *dp + writeableOffset; | ||
BYTE* dstRW2 = dstRW + 4; // addr for updating gc info if needed. | ||
const BYTE* const odstRW = dstRW; | ||
const BYTE* const odst = *dp; | ||
code_t code = 0; | ||
instruction ins; | ||
size_t sz; // = emitSizeOfInsDsc(id); | ||
static_assert(MaskSize < 32, "Given mask size is bigger than the word itself"); | ||
static_assert(MaskSize > 0, "Given mask size cannot be zero"); | ||
|
||
assert(REG_NA == (int)REG_NA); | ||
static constexpr size_t kMask = NBitMask(MaskSize); | ||
|
||
insOpts insOp = id->idInsOpt(); | ||
return word & kMask; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it strange that MaskSize
can only be up to 32 when the word is a 64 bit value?
…dotnet#96741)"" This reverts commit ecc044d.
* [RISC-V] Fix mistakes in emitter * Revert "[RISC-V] Added designated output instruction emitters (#96741)" This reverts commit 77fd98c. * Revert "Revert "[RISC-V] Added designated output instruction emitters (#96741)"" This reverts commit ecc044d. * [RISC-V] Sync emitOutputIns with the latest ref branch * [RISC-V] Formatted code * [RISC-V] Fixes * [RISC-V] Fixed sign cast in assert code len * [RISC-V] Readed assert * [RISC-V] Fixed fence sanity check and removed fence_i --------- Co-authored-by: Dong-Heon Jung <clamp03@gmail.com>
IMPORTANT: Before this PR could be merge, it requires changes from #96136This PR:
emitOutputInstr
function in order to use a newly added emittersThis PR is a part of a larger scope of work aiming to move all output instruction emission to the
emitOutputInstr
from theemitIns_*
functionsPart of #84834
cc @wscho77 @HJLeee @clamp03 @JongHeonChoi @t-mustafin @gbalykov @viewizard @ashaurtaev @brucehoult @sirntar @yurai007 @tomeksowi