Skip to content

Commit 0528053

Browse files
asbaswaterman
authored andcommitted
In the integer calling convention, reals are passed without sign extension (#82)
The previous wording indicated 32-bit floats should be sign-extended when passed in integer registers (e.g. when using the lp64 ABI): 1) When passed in registers, scalars narrower than XLEN bits are widened according to the sign of their type up to 32 bits, then sign-extended to XLEN bits. 2) Floating-point reals are passed the same way as integers of the same size 3) For aggregates, bits unused due to padding, and bits past the end of an aggregate whose size in bits is not divisible by XLEN, are undefined. This isn't obeyed in GCC (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87690), and it seems likely that the original wording simply intended to describe the behaviour regarding selecting registers or passing on the stack, rather than implying sign-extension. Reword to say that reals are passed in the same way as aggregates of the same size, which means when the float is narrower than XLEN the extra bits are undefined.
1 parent bd82119 commit 0528053

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

riscv-elf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ undefined.
125125

126126
Arguments passed by reference may be modified by the callee.
127127

128-
Floating-point reals are passed the same way as integers of the same size, and
128+
Floating-point reals are passed the same way as aggregates of the same size,
129129
complex floating-point numbers are passed the same way as a struct containing
130130
two floating-point reals.
131131

0 commit comments

Comments
 (0)