Skip to content

Commit d6a09a7

Browse files
committed
Auto merge of #120820 - CKingX:cpu-base-minimum, r=petrochenkov
Enable CMPXCHG16B, SSE3, SAHF/LAHF and 128-bit Atomics (in nightly) in Windows x64 As Rust plans to set Windows 10 as the minimum supported OS for target x86_64-pc-windows-msvc, I have added the cmpxchg16b and sse3 feature. Windows 10 requires CMPXCHG16B, LAHF/SAHF, and PrefetchW as stated in the requirements [here](https://download.microsoft.com/download/c/1/5/c150e1ca-4a55-4a7e-94c5-bfc8c2e785c5/Windows%2010%20Minimum%20Hardware%20Requirements.pdf). Furthermore, CPUs that meet these requirements also have SSE3 ([see](https://walbourn.github.io/directxmath-sse3-and-ssse3/))
2 parents bea5beb + 376c7b9 commit d6a09a7

5 files changed

+10
-5
lines changed

compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
33
pub fn target() -> Target {
44
let mut base = base::windows_gnu::opts();
55
base.cpu = "x86-64".into();
6+
base.features = "+cx16,+sse3,+sahf".into();
67
base.plt_by_default = false;
78
// Use high-entropy 64 bit address space for ASLR
89
base.add_pre_link_args(
910
LinkerFlavor::Gnu(Cc::No, Lld::No),
1011
&["-m", "i386pep", "--high-entropy-va"],
1112
);
1213
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64", "-Wl,--high-entropy-va"]);
13-
base.max_atomic_width = Some(64);
14+
base.max_atomic_width = Some(128);
1415
base.linker = Some("x86_64-w64-mingw32-gcc".into());
1516

1617
Target {

compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
33
pub fn target() -> Target {
44
let mut base = base::windows_gnullvm::opts();
55
base.cpu = "x86-64".into();
6+
base.features = "+cx16,+sse3,+sahf".into();
67
base.plt_by_default = false;
78
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
8-
base.max_atomic_width = Some(64);
9+
base.max_atomic_width = Some(128);
910
base.linker = Some("x86_64-w64-mingw32-clang".into());
1011

1112
Target {

compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ use crate::spec::{base, SanitizerSet, Target};
33
pub fn target() -> Target {
44
let mut base = base::windows_msvc::opts();
55
base.cpu = "x86-64".into();
6+
base.features = "+cx16,+sse3,+sahf".into();
67
base.plt_by_default = false;
7-
base.max_atomic_width = Some(64);
8+
base.max_atomic_width = Some(128);
89
base.supported_sanitizers = SanitizerSet::ADDRESS;
910

1011
Target {

compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
33
pub fn target() -> Target {
44
let mut base = base::windows_uwp_gnu::opts();
55
base.cpu = "x86-64".into();
6+
base.features = "+cx16,+sse3,+sahf".into();
67
base.plt_by_default = false;
78
// Use high-entropy 64 bit address space for ASLR
89
base.add_pre_link_args(
910
LinkerFlavor::Gnu(Cc::No, Lld::No),
1011
&["-m", "i386pep", "--high-entropy-va"],
1112
);
1213
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64", "-Wl,--high-entropy-va"]);
13-
base.max_atomic_width = Some(64);
14+
base.max_atomic_width = Some(128);
1415

1516
Target {
1617
llvm_target: "x86_64-pc-windows-gnu".into(),

compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ use crate::spec::{base, Target};
33
pub fn target() -> Target {
44
let mut base = base::windows_uwp_msvc::opts();
55
base.cpu = "x86-64".into();
6+
base.features = "+cx16,+sse3,+sahf".into();
67
base.plt_by_default = false;
7-
base.max_atomic_width = Some(64);
8+
base.max_atomic_width = Some(128);
89

910
Target {
1011
llvm_target: "x86_64-pc-windows-msvc".into(),

0 commit comments

Comments
 (0)