Bring back CpuOptLevel x86_64_v1 (#1590)

* Allow CpuOptLevel x86_64
Let's not force people to upgrade to x86_64_v2 yet. Default is unchanged
(x86_64_v2).
* target-cpu changes
* x86, and an old one at that? ew.
---------

Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
This commit is contained in:
Bjørn Forsman 2023-05-26 03:26:16 +02:00 committed by GitHub
parent 655a688ceb
commit 59c6723f7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@ enum CpuOptLevel {
none,
native,
neon_v8,
x86_64_legacy, // don't use this it's the oldest and worst. unless you've got a really old CPU, in which case, sorry?
x86_64_v2,
x86_64_v3,
}
@ -31,6 +32,7 @@ impl std::fmt::Display for CpuOptLevel {
CpuOptLevel::none => write!(f, "none"),
CpuOptLevel::native => write!(f, "native"),
CpuOptLevel::neon_v8 => write!(f, "neon_v8"),
CpuOptLevel::x86_64_legacy => write!(f, "x86_64"),
CpuOptLevel::x86_64_v2 => write!(f, "x86_64_v2"),
CpuOptLevel::x86_64_v3 => write!(f, "x86_64_v3"),
}
@ -66,6 +68,7 @@ pub fn apply_profile() {
CpuOptLevel::neon_v8 => {
println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-features=+neon,+fp-armv8")
}
CpuOptLevel::x86_64_legacy => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-cpu=x86-64"),
CpuOptLevel::x86_64_v2 => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-cpu=x86-64-v2"),
CpuOptLevel::x86_64_v3 => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-cpu=x86-64-v3"),
}