-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
aarch64 softfloat target: always pass floats in int registers #133102
Conversation
r? @Nadrieril rustbot has assigned @Nadrieril. Use |
This comment has been minimized.
This comment has been minimized.
d2a6139
to
7d57c37
Compare
Ah, we also have to do something for ScalarPair types. The easiest thing to do is pass them indirectly, so that's what I did for now. |
7d57c37
to
10a2a67
Compare
r? compiler |
Isn't this the second target we are manufacturing a by-integer ABI for? |
Is it? I am not aware of another.
|
x87 Rust ABI? |
There we are returning floats by-ptr, I think? Ah maybe we only do that for floats larger than a ptr. |
I am mostly musing that I should probably cross-check those cases to see if there's something that can be factored out before accepting this. |
For x86-32 we only do something with the return value, since arguments anyway never use the x87 stack. But yeah we could probably use the same logic for both. I am just not sure what is the best way to share that logic. |
OTOH we might want to change the x87 thing to use SSE registers if we can, so sharing the code might not be such a good idea. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me, just a few comments.
10a2a67
to
f484507
Compare
f484507
to
666bcbd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense
@bors r=davidtwco,wesleywiser |
…dtwco,wesleywiser aarch64 softfloat target: always pass floats in int registers This is a part of rust-lang#131058: on softfloat aarch64 targets, the float registers may be unavailable. And yet, LLVM will happily use them to pass float types if the corresponding target features are enabled. That's a problem as it means enabling/disabling `neon` instructions can change the ABI. Other targets have a `soft-float` target feature that forces the use of the soft-float ABI no matter whether float registers are enabled or not; aarch64 has nothing like that. So we follow the aarch64 [softfloat ABI](rust-lang#131058 (comment)) and treat floats like integers for `extern "C"` functions. For the "Rust" ABI, we do the same for scalars, and then just do something reasonable for ScalarPair that avoids the pointer indirection. Cc `@workingjubilee`
Rollup of 13 pull requests Successful merges: - rust-lang#130867 (distinguish overflow and unimplemented in Step::steps_between) - rust-lang#131859 (Update TRPL to add new Chapter 17: Async and Await) - rust-lang#132090 (Stop being so bail-y in candidate assembly) - rust-lang#132658 (Detect const in pattern with typo) - rust-lang#133041 (Print name of env var in `--print=deployment-target`) - rust-lang#133102 (aarch64 softfloat target: always pass floats in int registers) - rust-lang#133159 (Don't allow `-Zunstable-options` to take a value ) - rust-lang#133217 ([AIX] Add option -X32_64 to the "strip" command) - rust-lang#133237 (Minimally constify `Add`) - rust-lang#133238 (re-export `is_loongarch_feature_detected`) - rust-lang#133286 (Re-delay a resolve `bug` related to `Self`-ctor in patterns) - rust-lang#133301 (Add code example for `wrapping_neg` method for signed integers) - rust-lang#133313 (Use arc4random of libc for RTEMS target) Failed merges: - rust-lang#133215 (Fix missing submodule in `./x vendor`) r? `@ghost` `@rustbot` modify labels: rollup
…dtwco,wesleywiser aarch64 softfloat target: always pass floats in int registers This is a part of rust-lang#131058: on softfloat aarch64 targets, the float registers may be unavailable. And yet, LLVM will happily use them to pass float types if the corresponding target features are enabled. That's a problem as it means enabling/disabling `neon` instructions can change the ABI. Other targets have a `soft-float` target feature that forces the use of the soft-float ABI no matter whether float registers are enabled or not; aarch64 has nothing like that. So we follow the aarch64 [softfloat ABI](rust-lang#131058 (comment)) and treat floats like integers for `extern "C"` functions. For the "Rust" ABI, we do the same for scalars, and then just do something reasonable for ScalarPair that avoids the pointer indirection. Cc ``@workingjubilee``
…mpiler-errors Rollup of 8 pull requests Successful merges: - rust-lang#132090 (Stop being so bail-y in candidate assembly) - rust-lang#132658 (Detect const in pattern with typo) - rust-lang#132911 (Pretty print async fn sugar in opaques and trait bounds) - rust-lang#133102 (aarch64 softfloat target: always pass floats in int registers) - rust-lang#133159 (Don't allow `-Zunstable-options` to take a value ) - rust-lang#133208 (generate-copyright: Now generates a library file too.) - rust-lang#133215 (Fix missing submodule in `./x vendor`) - rust-lang#133264 (implement OsString::truncate) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#133102 - RalfJung:aarch64-softfloat, r=davidtwco,wesleywiser aarch64 softfloat target: always pass floats in int registers This is a part of rust-lang#131058: on softfloat aarch64 targets, the float registers may be unavailable. And yet, LLVM will happily use them to pass float types if the corresponding target features are enabled. That's a problem as it means enabling/disabling `neon` instructions can change the ABI. Other targets have a `soft-float` target feature that forces the use of the soft-float ABI no matter whether float registers are enabled or not; aarch64 has nothing like that. So we follow the aarch64 [softfloat ABI](rust-lang#131058 (comment)) and treat floats like integers for `extern "C"` functions. For the "Rust" ABI, we do the same for scalars, and then just do something reasonable for ScalarPair that avoids the pointer indirection. Cc ```@workingjubilee```
…gjubilee reject aarch64 target feature toggling that would change the float ABI ~~Stacked on top of rust-lang#133099. Only the last two commits are new.~~ The first new commit lays the groundwork for separately controlling whether a feature may be enabled or disabled. The second commit uses that to make it illegal to *disable* the `neon` feature (which is only possible via `-Ctarget-feature`, and so the new check just adds a warning). Enabling the `neon` feature remains allowed on targets that don't disable `neon` or `fp-armv8`, which is all our built-in targets. This way, the entire PR is not a breaking change. Fixes rust-lang#131058 for hardfloat targets (together with rust-lang#133102 which fixed it for softfloat targets). Part of rust-lang#116344.
reject aarch64 target feature toggling that would change the float ABI ~~Stacked on top of rust-lang/rust#133099. Only the last two commits are new.~~ The first new commit lays the groundwork for separately controlling whether a feature may be enabled or disabled. The second commit uses that to make it illegal to *disable* the `neon` feature (which is only possible via `-Ctarget-feature`, and so the new check just adds a warning). Enabling the `neon` feature remains allowed on targets that don't disable `neon` or `fp-armv8`, which is all our built-in targets. This way, the entire PR is not a breaking change. Fixes rust-lang/rust#131058 for hardfloat targets (together with rust-lang/rust#133102 which fixed it for softfloat targets). Part of rust-lang/rust#116344.
This is a part of #131058: on softfloat aarch64 targets, the float registers may be unavailable. And yet, LLVM will happily use them to pass float types if the corresponding target features are enabled. That's a problem as it means enabling/disabling
neon
instructions can change the ABI.Other targets have a
soft-float
target feature that forces the use of the soft-float ABI no matter whether float registers are enabled or not; aarch64 has nothing like that.So we follow the aarch64 softfloat ABI and treat floats like integers for
extern "C"
functions. For the "Rust" ABI, we do the same for scalars, and then just do something reasonable for ScalarPair that avoids the pointer indirection.Cc @workingjubilee