Skip to content
Open
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
13 changes: 10 additions & 3 deletions riscv-elf.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ register if it is no more than FLEN bits wide and at least one floating-point
argument register is available. Otherwise, it is passed according to the
integer calling convention.

A struct containing just one floating-point real is passed as though it were
a standalone floating-point real.
A struct containing just one floating-point real or (as a special case) one
floating-point real and any number of zero-size bitfields is passed as though
it were a standalone floating-point real.

A struct containing two floating-point reals is passed in two floating-point
registers, if neither is more than FLEN bits wide and at least two floating-point
Expand All @@ -215,7 +216,13 @@ without extending the integer to XLEN bits, provided the floating-point real
is no more than FLEN bits wide and the integer is no more than XLEN bits wide,
and at least one floating-point argument register and at least one integer
argument register is available. Otherwise, it is passed according to the
integer calling convention.
integer calling convention. Note that the bitfield may have a type that is
larger than XLEN but can still be considered eligible for passing in this way
provided the bitfield size is no more than XLEN bits wide. e.g. `struct {
float f; int64_t i : 32; }` is eligible for being passed in a floating-point
argument register and an integer argument register even when XLEN is 32.
Zero-size bitfields are not ignored, so `struct { float f; int64_t i : 32; int
0;`} would be passed according to the integer calling convention.
Comment on lines +224 to +225
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, actually, #99 (comment) suggests GCC has since changed ABI for zero-size bitfields, meaning I think this sentence (and the diff above to add a special special case on top of the special case) should go. @jim-wilson do you agree?


Unions are never flattened and are always passed according to the integer
calling convention.
Expand Down