-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
add optional soft-float feature for s390x target #151154
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
base: main
Are you sure you want to change the base?
Conversation
to use soft-float one need to also set the `s390x-softfloat` flag in the .rustc_abi target field. This will automatically enable the +soft-float feature. On normal compilation with the default ABI soft-float is still marked incompatible. So the ABI cannot be be broken by accident.
|
Cc @RalfJung who is the expert in this bit of code.
There aren't any tests indicating how this is meant to be used; do you mean that attempting to use +soft-float is rejected via target properties? I.e., what happens when a binary built with +soft-float gets linked against the normal The ABI change can be covered with a simple test in |
|
The way the code works allows us to take a simpler route for this case:
Then we do not need to have "agreement" on the soft-float flag between target-features in FeatureConstraints, because it becomes "use the target or bust". |
|
The above description of how it is easier to solve this by avoiding the question of target-features being set at all is why we have nudged towards "a new target": @fneddy @uweigand To bring you up to speed on a detail that has become important to clarify, and I think may have been missed: Rust target features are not LLVM target features. This is not just because Cranelift and GCC are backends in the process of being implemented. It is mandated by the language itself. Long ago, in Rust RFC 2045, Rust decided to allow However, because these attributes live in Rust source code, they are subject to rustc's stability policies around the language, or at least there is an expectation that they are. People are not amused when you tell them that their source code doesn't build because LLVM changed how they support that feature! Unfortunately, the list of LLVM features changes surprisingly often. This story is well-told by the mapping of Rust features to LLVM features in And that is on top of the realization that many target features are nonsensical to set on a per-function basis, despite being implemented as settable in that way by LLVM! Since that realization, the compiler and language teams have more-or-less been trying to walk that back as much as possible. I'm approximating. This is the other big reason for my and Ralf's suggestion of "new target" as the way to "configure" this, instead of requiring agreement: There's no reason to reflect the way C compilers configure something like this when we already have to go so far in a different direction. The main reason to introduce target modifiers for a target is when you want to support many subtle variations, especially along more than one axis. The many-splendored world of ABI-incompatible RISCV variants, for example. Here, we only have heard calls for two de facto targets. |
| /// On x86-32/64 only: do not use any FPU or SIMD registers for the ABI. | ||
| X86Softfloat = "x86-softfloat", | ||
| // On S390x only: do not use any FPU or Vector registers for the ABI. | ||
| S390xSoftFloat = "s390x-softfloat", |
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.
Can you just rename X86Softfloat to Softfloat and use that also for s390x?
Note that the target feature already exists, it just needs the message to be changed. Also I think we can't make it |
Actually, it seems I misremembered. It can remain |
followup on #150766
to use the soft-float feature one need to also set the
s390x-softfloatflag in the.rustc_abitarget field. This will automatically enable the LLVM+soft-floatfeature flag. On normal compilation with the default ABI, soft-float is still marked incompatible! So the ABI cannot be be broken by accident.open soft-float points from previous PR:
s390x-unknown-none-softfloattarget?r? @cuviper