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] Put scalar stack args with sign extension #97662

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5048,6 +5048,14 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
instruction storeIns = ins_Store(slotType);
emitAttr storeAttr = emitTypeSize(slotType);

// When passed in registers or on the stack, integer scalars narrower than XLEN bits
// are widened according to the sign of their type up to 32 bits, then sign-extended to XLEN bits.
if (EA_SIZE(storeAttr) < EA_PTRSIZE && varTypeUsesIntReg(slotType))
{
storeAttr = EA_PTRSIZE;
storeIns = INS_sd;
}

// If it is contained then source must be the integer constant zero
if (source->isContained())
{
Expand Down