Skip to content

Commit

Permalink
[RISC-V] Put scalar stack args with sign extension (#97662)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-mustafin authored Jan 30, 2024
1 parent 28ad7e9 commit 558cde6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5336,6 +5336,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

0 comments on commit 558cde6

Please sign in to comment.