From 01fe03877fa9539008263453bf25c248a50ca427 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Tue, 5 Mar 2024 03:12:28 +0000 Subject: [PATCH] Bug 1882291. Switch to stdarch_arm_neon_intrinsics feature on rust >=1.78. r=glandium We only need this on ARM32 because the ARM64 intrinsics are stable. stdarch_arm_neon_intrinsics was split out from stdsimd here: https://github.com/rust-lang/stdarch/pull/1486 Differential Revision: https://phabricator.services.mozilla.com/D203039 --- Cargo.lock | 1 + gfx/qcms/Cargo.toml | 3 +++ gfx/qcms/build.rs | 7 +++++++ gfx/qcms/src/lib.rs | 6 ++++-- 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 gfx/qcms/build.rs diff --git a/Cargo.lock b/Cargo.lock index a55b3e6dc37ab..23601ec89b6d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4274,6 +4274,7 @@ name = "qcms" version = "0.2.0" dependencies = [ "libc", + "version_check", ] [[package]] diff --git a/gfx/qcms/Cargo.toml b/gfx/qcms/Cargo.toml index e976054a7b32a..f50d6623a1b4e 100644 --- a/gfx/qcms/Cargo.toml +++ b/gfx/qcms/Cargo.toml @@ -20,3 +20,6 @@ cmyk = [] [dependencies] libc = {version = "0.2", optional = true } + +[build-dependencies] +version_check = "0.9" diff --git a/gfx/qcms/build.rs b/gfx/qcms/build.rs new file mode 100644 index 0000000000000..6810a8828edeb --- /dev/null +++ b/gfx/qcms/build.rs @@ -0,0 +1,7 @@ +extern crate version_check as rustc; + +fn main() { + if rustc::is_min_version("1.78.0").unwrap_or(false) { + println!("cargo:rustc-cfg=stdsimd_split"); + } +} diff --git a/gfx/qcms/src/lib.rs b/gfx/qcms/src/lib.rs index c311964ee3f49..fc496816a8bfc 100644 --- a/gfx/qcms/src/lib.rs +++ b/gfx/qcms/src/lib.rs @@ -7,9 +7,11 @@ #![allow(non_upper_case_globals)] // These are needed for the neon SIMD code and can be removed once the MSRV supports the // instrinsics we use -#![cfg_attr(feature = "neon", feature(stdsimd))] +#![cfg_attr(all(stdsimd_split, target_arch = "arm", feature = "neon"), feature(stdarch_arm_neon_intrinsics))] +#![cfg_attr(all(stdsimd_split, target_arch = "arm", feature = "neon"), feature(stdarch_arm_feature_detection))] +#![cfg_attr(all(not(stdsimd_split), target_arch = "arm", feature = "neon"), feature(stdsimd))] #![cfg_attr( - feature = "neon", + all(target_arch = "arm", feature = "neon"), feature(arm_target_feature, raw_ref_op) )]