Skip to content

Commit 42094e3

Browse files
committed
Use stable AVX-512 intrinsics on Rust 1.89 or later
1 parent 96b270b commit 42094e3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ crate-type = ["cdylib"]
3030
[features]
3131
default = []
3232

33-
# Include runtime-detected functions that use AVX512VL.
34-
avx512 = []
35-
3633
# Avoid bundling libgcc on musl.
3734
unwind = ["unwinding"]
3835

@@ -41,6 +38,7 @@ unwind = ["unwinding"]
4138
yyjson = []
4239

4340
# Features detected by build.rs. Do not specify.
41+
avx512 = []
4442
generic_simd = []
4543
inline_int = []
4644
intrinsics = []

build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ fn main() {
2929
#[allow(unused_variables)]
3030
let is_64_bit_python = matches!(python_config.pointer_width, Some(64));
3131

32+
#[cfg(target_arch = "x86_64")]
33+
if version_check::is_min_version("1.89.0").unwrap_or(false) && is_64_bit_python {
34+
println!("cargo:rustc-cfg=feature=\"avx512\"");
35+
}
36+
3237
if version_check::supports_feature("core_intrinsics").unwrap_or(false) {
3338
println!("cargo:rustc-cfg=feature=\"intrinsics\"");
3439
}

0 commit comments

Comments
 (0)