Forbid disabling SSE on x86 targets that have SSE in their "baseline" #133611
Labels
A-target-feature
Area: Enabling/disabling target features like AVX, Neon, etc.
C-discussion
Category: Discussion or questions that doesn't represent real issues.
O-x86_32
Target: x86 processors, 32 bit (like i686-*)
O-x86_64
Target: x86-64 processors (like x86_64-*)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Passing
-Ctarget-feature=-sse
on an x86-64 target currently produces an ugly LLVM error.Doing the same on a x86-32 target leads to unsound floating-point behavior.
Therefore, I think we should deprecate and eventually fully forbid toggling the
sse
/sse2
target features on x86 targets, except for those targets that do not have these features to begin with (e.g.i586-unknown-linux-gnu
).I am implementing some machinery here that could help with that, but properly implementing this will be tricky since one can also use
-Ctarget-cpu
to disable these target features.Once this is implemented, we have some options for improving the Rust ABI on these targets as well:
PassMode::Indirect
Here, compiler team triage decided "Current Tier 1 x86 targets require SSE-based floats at minimum". The concrete proposal above got MCP'd in rust-lang/compiler-team#808.
Open questions
How do we best implement this? It's non trivial since
-Ctarget-cpu
can alter thesse
/sse2
feature gates, so our usual approach of just checking which target features got toggled with-Ctarget-feature
does not work.To make things worse, the way we control whether
sse
/sse2
is available in the "basline" is via thebase.cpu
field, not via the explicit list of target features, so if we want to do things "only if the baseline has SSE", that's non-trivial to implement. Maybe we should just add abool
field to the target spec that directly controls "use SSE registers for Rust ABI" or "requires SSE registers" or so?Cc @bjorn3 @workingjubilee @Amanieu
The text was updated successfully, but these errors were encountered: