* [PATCH] rust: x86: remove `-3dnow{,a}` from target features
@ 2024-08-06 14:45 Miguel Ojeda
2024-08-06 15:00 ` Benno Lossin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Miguel Ojeda @ 2024-08-06 14:45 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
Nathan Chancellor, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, rust-for-linux, Nick Desaulniers,
Bill Wendling, Justin Stitt, llvm, H. Peter Anvin, linux-kernel,
patches, Nikita Popov
LLVM 19 is dropping support for 3DNow! in commit f0eb5587ceeb ("Remove
support for 3DNow!, both intrinsics and builtins. (#96246)"):
Remove support for 3DNow!, both intrinsics and builtins. (#96246)
This set of instructions was only supported by AMD chips starting in
the K6-2 (introduced 1998), and before the "Bulldozer" family
(2011). They were never much used, as they were effectively superseded
by the more-widely-implemented SSE (first implemented on the AMD side
in Athlon XP in 2001).
This is being done as a predecessor towards general removal of MMX
register usage. Since there is almost no usage of the 3DNow!
intrinsics, and no modern hardware even implements them, simple
removal seems like the best option.
Thus we should avoid passing these to the backend, since otherwise we
get a diagnostic about it:
'-3dnow' is not a recognized feature for this target (ignoring feature)
'-3dnowa' is not a recognized feature for this target (ignoring feature)
We could try to disable them only up to LLVM 19 (not the C side one,
but the one used by `rustc`, which may be built with a range of
LLVMs). However, to avoid more complexity, we can likely just remove
them altogether. According to Nikita [2]:
> I don't think it's needed because LLVM should not generate 3dnow
instructions unless specifically asked to, using intrinsics that Rust
does not provide in the first place.
Thus do so, like Rust did for one of their builtin targets [3].
For those curious: Clang will warn only about trying to enable them
(`-m3dnow{,a}`), but not about disabling them (`-mno-3dnow{,a}`), so
there is no change needed there.
Cc: Nikita Popov <github@npopov.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: x86@kernel.org
Link: https://github.com/llvm/llvm-project/commit/f0eb5587ceeb641445b64cb264c822b4751de04a [1]
Link: https://github.com/rust-lang/rust/pull/127864#issuecomment-2235898760 [2]
Link: https://github.com/rust-lang/rust/pull/127864 [3]
Closes: https://github.com/Rust-for-Linux/linux/issues/1094
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
scripts/generate_rust_target.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
index 87f34925eb7b..404edf7587e0 100644
--- a/scripts/generate_rust_target.rs
+++ b/scripts/generate_rust_target.rs
@@ -162,7 +162,7 @@ fn main() {
"data-layout",
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
);
- let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string();
+ let mut features = "-mmx,+soft-float".to_string();
if cfg.has("MITIGATION_RETPOLINE") {
features += ",+retpoline-external-thunk";
}
@@ -179,7 +179,7 @@ fn main() {
"data-layout",
"e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128",
);
- let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string();
+ let mut features = "-mmx,+soft-float".to_string();
if cfg.has("MITIGATION_RETPOLINE") {
features += ",+retpoline-external-thunk";
}
base-commit: de9c2c66ad8e787abec7c9d7eff4f8c3cdd28aed
--
2.46.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] rust: x86: remove `-3dnow{,a}` from target features
2024-08-06 14:45 [PATCH] rust: x86: remove `-3dnow{,a}` from target features Miguel Ojeda
@ 2024-08-06 15:00 ` Benno Lossin
2024-08-08 15:58 ` Alice Ryhl
2024-08-09 22:15 ` Miguel Ojeda
2 siblings, 0 replies; 4+ messages in thread
From: Benno Lossin @ 2024-08-06 15:00 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho,
Nathan Chancellor, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Andreas Hindborg,
Alice Ryhl, rust-for-linux, Nick Desaulniers, Bill Wendling,
Justin Stitt, llvm, H. Peter Anvin, linux-kernel, patches,
Nikita Popov
On 06.08.24 16:45, Miguel Ojeda wrote:
> LLVM 19 is dropping support for 3DNow! in commit f0eb5587ceeb ("Remove
> support for 3DNow!, both intrinsics and builtins. (#96246)"):
>
> Remove support for 3DNow!, both intrinsics and builtins. (#96246)
>
> This set of instructions was only supported by AMD chips starting in
> the K6-2 (introduced 1998), and before the "Bulldozer" family
> (2011). They were never much used, as they were effectively superseded
> by the more-widely-implemented SSE (first implemented on the AMD side
> in Athlon XP in 2001).
>
> This is being done as a predecessor towards general removal of MMX
> register usage. Since there is almost no usage of the 3DNow!
> intrinsics, and no modern hardware even implements them, simple
> removal seems like the best option.
>
> Thus we should avoid passing these to the backend, since otherwise we
> get a diagnostic about it:
>
> '-3dnow' is not a recognized feature for this target (ignoring feature)
> '-3dnowa' is not a recognized feature for this target (ignoring feature)
>
> We could try to disable them only up to LLVM 19 (not the C side one,
> but the one used by `rustc`, which may be built with a range of
> LLVMs). However, to avoid more complexity, we can likely just remove
> them altogether. According to Nikita [2]:
>
>> I don't think it's needed because LLVM should not generate 3dnow
> instructions unless specifically asked to, using intrinsics that Rust
> does not provide in the first place.
>
> Thus do so, like Rust did for one of their builtin targets [3].
>
> For those curious: Clang will warn only about trying to enable them
> (`-m3dnow{,a}`), but not about disabling them (`-mno-3dnow{,a}`), so
> there is no change needed there.
>
> Cc: Nikita Popov <github@npopov.com>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: x86@kernel.org
> Link: https://github.com/llvm/llvm-project/commit/f0eb5587ceeb641445b64cb264c822b4751de04a [1]
> Link: https://github.com/rust-lang/rust/pull/127864#issuecomment-2235898760 [2]
> Link: https://github.com/rust-lang/rust/pull/127864 [3]
> Closes: https://github.com/Rust-for-Linux/linux/issues/1094
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
> scripts/generate_rust_target.rs | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Works on my machine:
Tested-by: Benno Lossin <benno.lossin@proton.me>
---
Cheers,
Benno
> diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
> index 87f34925eb7b..404edf7587e0 100644
> --- a/scripts/generate_rust_target.rs
> +++ b/scripts/generate_rust_target.rs
> @@ -162,7 +162,7 @@ fn main() {
> "data-layout",
> "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
> );
> - let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string();
> + let mut features = "-mmx,+soft-float".to_string();
> if cfg.has("MITIGATION_RETPOLINE") {
> features += ",+retpoline-external-thunk";
> }
> @@ -179,7 +179,7 @@ fn main() {
> "data-layout",
> "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128",
> );
> - let mut features = "-3dnow,-3dnowa,-mmx,+soft-float".to_string();
> + let mut features = "-mmx,+soft-float".to_string();
> if cfg.has("MITIGATION_RETPOLINE") {
> features += ",+retpoline-external-thunk";
> }
>
> base-commit: de9c2c66ad8e787abec7c9d7eff4f8c3cdd28aed
> --
> 2.46.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rust: x86: remove `-3dnow{,a}` from target features
2024-08-06 14:45 [PATCH] rust: x86: remove `-3dnow{,a}` from target features Miguel Ojeda
2024-08-06 15:00 ` Benno Lossin
@ 2024-08-08 15:58 ` Alice Ryhl
2024-08-09 22:15 ` Miguel Ojeda
2 siblings, 0 replies; 4+ messages in thread
From: Alice Ryhl @ 2024-08-08 15:58 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Alex Gaynor, Wedson Almeida Filho, Nathan Chancellor,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, rust-for-linux, Nick Desaulniers, Bill Wendling,
Justin Stitt, llvm, H. Peter Anvin, linux-kernel, patches,
Nikita Popov
On Tue, Aug 6, 2024 at 4:47 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> LLVM 19 is dropping support for 3DNow! in commit f0eb5587ceeb ("Remove
> support for 3DNow!, both intrinsics and builtins. (#96246)"):
>
> Remove support for 3DNow!, both intrinsics and builtins. (#96246)
>
> This set of instructions was only supported by AMD chips starting in
> the K6-2 (introduced 1998), and before the "Bulldozer" family
> (2011). They were never much used, as they were effectively superseded
> by the more-widely-implemented SSE (first implemented on the AMD side
> in Athlon XP in 2001).
>
> This is being done as a predecessor towards general removal of MMX
> register usage. Since there is almost no usage of the 3DNow!
> intrinsics, and no modern hardware even implements them, simple
> removal seems like the best option.
>
> Thus we should avoid passing these to the backend, since otherwise we
> get a diagnostic about it:
>
> '-3dnow' is not a recognized feature for this target (ignoring feature)
> '-3dnowa' is not a recognized feature for this target (ignoring feature)
>
> We could try to disable them only up to LLVM 19 (not the C side one,
> but the one used by `rustc`, which may be built with a range of
> LLVMs). However, to avoid more complexity, we can likely just remove
> them altogether. According to Nikita [2]:
>
> > I don't think it's needed because LLVM should not generate 3dnow
> instructions unless specifically asked to, using intrinsics that Rust
> does not provide in the first place.
>
> Thus do so, like Rust did for one of their builtin targets [3].
>
> For those curious: Clang will warn only about trying to enable them
> (`-m3dnow{,a}`), but not about disabling them (`-mno-3dnow{,a}`), so
> there is no change needed there.
>
> Cc: Nikita Popov <github@npopov.com>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: x86@kernel.org
> Link: https://github.com/llvm/llvm-project/commit/f0eb5587ceeb641445b64cb264c822b4751de04a [1]
> Link: https://github.com/rust-lang/rust/pull/127864#issuecomment-2235898760 [2]
> Link: https://github.com/rust-lang/rust/pull/127864 [3]
> Closes: https://github.com/Rust-for-Linux/linux/issues/1094
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Works with Rust Binder on the x86 cuttlefish emulator.
Tested-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rust: x86: remove `-3dnow{,a}` from target features
2024-08-06 14:45 [PATCH] rust: x86: remove `-3dnow{,a}` from target features Miguel Ojeda
2024-08-06 15:00 ` Benno Lossin
2024-08-08 15:58 ` Alice Ryhl
@ 2024-08-09 22:15 ` Miguel Ojeda
2 siblings, 0 replies; 4+ messages in thread
From: Miguel Ojeda @ 2024-08-09 22:15 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Alex Gaynor, Wedson Almeida Filho, Nathan Chancellor,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, rust-for-linux, Nick Desaulniers,
Bill Wendling, Justin Stitt, llvm, H. Peter Anvin, linux-kernel,
patches, Nikita Popov
On Tue, Aug 6, 2024 at 4:47 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> LLVM 19 is dropping support for 3DNow! in commit f0eb5587ceeb ("Remove
> support for 3DNow!, both intrinsics and builtins. (#96246)"):
>
> Remove support for 3DNow!, both intrinsics and builtins. (#96246)
>
> This set of instructions was only supported by AMD chips starting in
> the K6-2 (introduced 1998), and before the "Bulldozer" family
> (2011). They were never much used, as they were effectively superseded
> by the more-widely-implemented SSE (first implemented on the AMD side
> in Athlon XP in 2001).
>
> This is being done as a predecessor towards general removal of MMX
> register usage. Since there is almost no usage of the 3DNow!
> intrinsics, and no modern hardware even implements them, simple
> removal seems like the best option.
>
> Thus we should avoid passing these to the backend, since otherwise we
> get a diagnostic about it:
>
> '-3dnow' is not a recognized feature for this target (ignoring feature)
> '-3dnowa' is not a recognized feature for this target (ignoring feature)
>
> We could try to disable them only up to LLVM 19 (not the C side one,
> but the one used by `rustc`, which may be built with a range of
> LLVMs). However, to avoid more complexity, we can likely just remove
> them altogether. According to Nikita [2]:
>
> > I don't think it's needed because LLVM should not generate 3dnow
> instructions unless specifically asked to, using intrinsics that Rust
> does not provide in the first place.
>
> Thus do so, like Rust did for one of their builtin targets [3].
>
> For those curious: Clang will warn only about trying to enable them
> (`-m3dnow{,a}`), but not about disabling them (`-mno-3dnow{,a}`), so
> there is no change needed there.
>
> Cc: Nikita Popov <github@npopov.com>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: x86@kernel.org
> Link: https://github.com/llvm/llvm-project/commit/f0eb5587ceeb641445b64cb264c822b4751de04a [1]
> Link: https://github.com/rust-lang/rust/pull/127864#issuecomment-2235898760 [2]
> Link: https://github.com/rust-lang/rust/pull/127864 [3]
> Closes: https://github.com/Rust-for-Linux/linux/issues/1094
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Applied to `rust-fixes` -- thanks everyone!
(If someone from x86 still wants to take a look / Ack it, please let me know!)
Cheers,
Miguel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-09 22:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-06 14:45 [PATCH] rust: x86: remove `-3dnow{,a}` from target features Miguel Ojeda
2024-08-06 15:00 ` Benno Lossin
2024-08-08 15:58 ` Alice Ryhl
2024-08-09 22:15 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).