-
Enhancement
-
Resolution: Fixed
-
P4
-
repo-riscv-port
-
riscv
-
linux
Reference: https://github.com/riscv-non-isa/riscv-elf-psabi-doc
" Scalars that are at most XLEN bits wide are passed in a single argument register, or on the stack by value if none is available.
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.
When passed in registers or on the stack, floating-point types narrower than XLEN bits are widened to XLEN bits, with the upper bits undefined."
So there is no need to do sign extension for signed integer input parameters.
" Scalars that are at most XLEN bits wide are passed in a single argument register, or on the stack by value if none is available.
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.
When passed in registers or on the stack, floating-point types narrower than XLEN bits are widened to XLEN bits, with the upper bits undefined."
So there is no need to do sign extension for signed integer input parameters.