-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Fix target-cpu fpu features on Arm R/M-profile #123159
Conversation
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
These commits modify compiler targets. |
7b3b8d9
to
1b9e4db
Compare
1b9e4db
to
ad18e1d
Compare
Looks like the ability to do this dates back to LLVM 9.0.0: llvm/llvm-project@760df47b778a530e9368a4b |
r? compiler |
r? compiler |
r? compiler 😅 |
Lol r? compiler |
Let's pull in the ARM notification group. @rustbot ping arm |
Hey ARM Group! This bug has been identified as a good "ARM candidate". cc @adamgemmell @hug-dev @jacobbramley @JamieCunliffe @joaopaulocarreiro @raw-bin @Stammark |
so the thing that is happening here is that previously, we set flags that say "disable this architectural feature", because we (and especially LLVM) allow target features to be disabled. this is a questionable choice to begin with, however, it's particularly problematic when considering that but we had to do something like this to make clear that the fpu was a slightly underpowered one relative to the full-bore Arm FPUs that they have nowadays. certainly not 32 128-bit registers! only about 16-by-32 or so? and this way fixes that by making only a positive statment. the main question regarding this PR is whether this causes some oddity because someone was accidentally relying on us disabling those features. however, the new behavior will be more-correct in general, and we don't promise that our target feature settings for a given target remain static forever. and it's a fairly easy fix in general. in my experience, with dodgy feature settings that shouldn't work, it's far more likely they'll get a combination of effects that results in them failing instruction selection in LLVM, rather than emitting a bad binary that they can even try to run. |
That's my understanding of what's happening as well. This PR will result in the same set of features being enabled for users who do not use |
@chrisnc you know I had been thinking of any blatant contradictions (there are a few that toggling features on/off can get you, like especially with "use soft-float but use float registers") but I think those are less likely here yeah. |
Thanks for the info! That all makes sense to me. But I'm having a hard time verifying that the new set of features is correct for the given targets, and I don't think we are actually executing any tests for these targets. @workingjubilee, feel free to r+ if you are confident in the changes. Otherwise I'll go look for another reviewer. |
The combo feature names this PR uses are defined here: https://github.com/rust-lang/llvm-project/blob/rustc/18.0-2024-02-13/llvm/lib/Target/ARM/ARM.td#L63-L91 For For For For |
This is achieved by converting `+<fpu>,-d32,{,-fp64}` to `+<fpu>d16{,sp}`. By using a single additive feature that captures `d16` vs `d32` and `sp` vs `dp`, we prevent `-<feature>` from overriding `-C target-cpu` at build time. Remove extraneous `-fp16` from `armv7r` targets, as this is not included in `vfp3` anyway, but was preventing `fp16` from being enabled by e.g., `-C target-cpu=cortex-r7`, which does support `fp16`.
…tures, r=workingjubilee Fix target-cpu fpu features on Arm R/M-profile This is achieved by converting `+<fpu>,-d32,{,-fp64}` to `+<fpu>d16{,sp}`. By using a single additive feature that captures `d16` vs `d32` and `sp` vs `dp`, we prevent `-<feature>` from overriding `-C target-cpu` at build time. Remove extraneous `-fp16` from `armv7r` targets, as this is not included in `vfp3` anyway, but was preventing `fp16` from being enabled by e.g., `-C target-cpu=cortex-r7`, which does support `fp16`.
I noticed that this landed somewhat recently for the Aarch64 v8r target in LLVM. I think we'll need to make a similar change to the Arm (32-bit) v8r in LLVM to have this make more sense. |
…llaumeGomez Rollup of 8 pull requests Successful merges: - rust-lang#121419 (Add aarch64-apple-visionos and aarch64-apple-visionos-sim tier 3 targets) - rust-lang#123159 (Fix target-cpu fpu features on Arm R/M-profile) - rust-lang#123487 (CFI: Restore typeid_for_instance default behavior) - rust-lang#123500 (Revert removing miri jobserver workaround) - rust-lang#123505 (Revert "Use OS thread name by default") - rust-lang#123509 (Add jieyouxu to compiler review rotation and as a reviewer for `tests/run-make`, `src/tools/run-make-support` and `src/tools/compiletest`) - rust-lang#123514 (Fix typo in `compiler/rustc_middle/src/traits/solve/inspect.rs`) - rust-lang#123515 (Use `include` command to reduce code duplication) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#123159 - chrisnc:fix-arm-rm-none-eabihf-features, r=workingjubilee Fix target-cpu fpu features on Arm R/M-profile This is achieved by converting `+<fpu>,-d32,{,-fp64}` to `+<fpu>d16{,sp}`. By using a single additive feature that captures `d16` vs `d32` and `sp` vs `dp`, we prevent `-<feature>` from overriding `-C target-cpu` at build time. Remove extraneous `-fp16` from `armv7r` targets, as this is not included in `vfp3` anyway, but was preventing `fp16` from being enabled by e.g., `-C target-cpu=cortex-r7`, which does support `fp16`.
LLVM change is in review here. We can revisit rust's armv8r target features if and when this merges and rustc updates to use it. |
The llvm fix for armv8r is merged now with the reduced set of default features. Once the rust fork picks that up we can edit |
This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features.
This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. Add a run-make test that target-cpu=cortex-r52 enables double-precision and neon.
This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. Add a run-make test that target-cpu=cortex-r52 enables double-precision and neon.
This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture. Add a run-make test that target-cpu=cortex-r52 enables double-precision and neon.
This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture. Add a run-make test that an appropriate target-cpu enables double-precision and neon for thumbv8m.main-none-eabihf and armv8r-none-eabihf.
This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture. Add a run-make test that an appropriate target-cpu enables double-precision and neon for thumbv8m.main-none-eabihf and armv8r-none-eabihf.
This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture. Add a run-make test that an appropriate target-cpu enables double-precision and neon for thumbv7em-none-eabihf and thumbv8m.main-none-eabihf.
This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture. Add a run-make test that an appropriate target-cpu enables double-precision and neon for thumbv7em-none-eabihf and thumbv8m.main-none-eabihf.
This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture. Add a run-make test that an appropriate target-cpu enables double-precision and neon for thumbv7em-none-eabihf and thumbv8m.main-none-eabihf.
Fix target-cpu fpu features on Armv8-R. This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture. Add a run-make test that target-cpu=cortex-r52 enables double-precision and neon. try-job: dist-aarch64-linux try-job: dist-various-1 try-job: dist-various-2 try-job: dist-x86_64-linux try-job: dist-x86_64-msvc
This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture.
…ingjubilee Fix target-cpu fpu features on Armv8-R. This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture.
…ingjubilee Fix target-cpu fpu features on Armv8-R. This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture.
…ingjubilee Fix target-cpu fpu features on Armv8-R. This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture.
…ingjubilee Fix target-cpu fpu features on Armv8-R. This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture.
Rollup merge of rust-lang#130295 - chrisnc:armv8r-feature-fix, r=workingjubilee Fix target-cpu fpu features on Armv8-R. This is a follow-up to rust-lang#123159, but applied to Armv8-R. This required llvm/llvm-project#88287 to work properly. Now that this change exists in rustc's llvm, we can fix Armv8-R's default fpu features. In Armv8-R's case, the default features from LLVM for floating-point are sufficient, because there is no integer-only variant of this architecture.
This is achieved by converting
+<fpu>,-d32,{,-fp64}
to+<fpu>d16{,sp}
.By using a single additive feature that captures
d16
vsd32
andsp
vsdp
, we prevent-<feature>
from overriding-C target-cpu
at build time.Remove extraneous
-fp16
fromarmv7r
targets, as this is not included invfp3
anyway, but was preventingfp16
from being enabled by e.g.,-C target-cpu=cortex-r7
, which does supportfp16
.