https://sourceware.org/bugzilla/show_bug.cgi?id=31142

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Robbin Ehn from comment #1)
> I'm no expert in RV ABI, but from 18.2 RVG Calling Convention:
> 
> "Values are returned from functions in integer registers a0 and a1 and
> floating-point registers fa0 and fa1. Floating-point values are returned in
> floating-point registers only if they are primitives or members of a struct
> consisting of only one or two floating-point values. Other return values
> that fit into two pointer-words are returned in a0 and a1. Larger return
> values are passed entirely
> in memory; the caller allocates this memory region and passes a pointer to
> it as an implicit first parameter to the callee."
> 
> AFAICT they should be packed into a0+a1 seen as 8/16 byte field.
> 
> rv32 a0 would be quot and a1 would be rem
> rv64 a0 low 32-bit would be quot and a0 high 32-bit would be rem
> 
> This seems to be inline with what clang do, removes sign extension, shift
> and or the values in.
> 
> Did this help ?

Yes, thanks. I believe I know now which DWARF location description to use for a
function returning a (small) struct containing just integers or just floats.
The code is already there, it is just detecting the struct member types (and
total struct size).

I am not sure what this exactly means for a mix of an integers and floats in a
small struct. Does the calling convention actually handle that? If you have a
struct { int a; float f; } would that be returned with the first piece in a0
and the second piece in fa0? Or would such a return struct be returned entirely
in memory?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to