-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sparc64: passing structures with floats in registers should use floating point registers #57103
Comments
I suspect that the specification does not really specify anything for this specific scenario. In that case, please fill/find a bug against clang/gcc about this and reference it here. This seems like an unfortunate discrepancy to deal with for all parties involved. |
You are right. Alignment overrides and especially unaligned variables are not covered by vendor specification, so gcc/clang need to get to an agreement by themselves. I will file bugs. It would still be great for rust to be compatible regarding non-packed structs like |
I can fill a clang bug for you if you want. |
@nagiso: Yes, please go ahead. You should be able to copy/paste the contents of the GCC report. |
Triage: no movement whatsoever on the clang bug |
librustc_target/abi/call/sparc64.rs
passes structures asUniform
, which get allocated to stack or "promoted" to integer registers by LLVM. According to the SPARC v9 64 Bit ABI definition in the SPARC Compliance Definition, floating point members should be promoted into floating point registers instead of integer registers, see page 47 in SCD 2.4.1. This also affects returning of structures, and makesrun-pass/structs-enums/struct-return.rs
fail. gcc returns the members ofstruct Floats
in%d0
,%o1
and%d4
, whereas Rust expects the members to be in%o0
,%o1
and%o2
.I guess we need to create a
CastTarget
that contains a mixture of Int and Float registers in the prefix with an empty tail. As structures with at most 256 bits (8 * 32 bits) can be returned in registers, the eight class items in the prefix are enough. I expect that the structures needs to be flattened, so a structure containing a structure containing a float also has the float value passed in a floating point register.Unaligned Floats and Doubles (with
__attribute__((packed))
) end up being put in integer registers bygcc
andclang
, whereas "accidently" aligned floating point members get passed in integer registers bygcc
and floating point registers byclang
:The text was updated successfully, but these errors were encountered: