From 17d40c6057c88f4c432b0d7bac88e1b84cb7e67f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:03:36 +0200 Subject: Adding upstream version 1.65.0+dfsg1. Signed-off-by: Daniel Baumann --- .../crates/std_detect/src/detect/arch/aarch64.rs | 3 ++- .../stdarch/crates/std_detect/src/detect/macros.rs | 27 ++++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) (limited to 'library/stdarch/crates/std_detect/src') diff --git a/library/stdarch/crates/std_detect/src/detect/arch/aarch64.rs b/library/stdarch/crates/std_detect/src/detect/arch/aarch64.rs index f32f961ae..5f46c7696 100644 --- a/library/stdarch/crates/std_detect/src/detect/arch/aarch64.rs +++ b/library/stdarch/crates/std_detect/src/detect/arch/aarch64.rs @@ -72,7 +72,8 @@ features! { @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] pmull: "pmull"; /// FEAT_PMULL (Polynomial Multiply) @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] fp: "fp"; - /// FEAT_FP (Floating point support) + implied by target_features: ["neon"]; + /// FEAT_FP (Floating point support) - Implied by `neon` target_feature @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] fp16: "fp16"; /// FEAT_FP16 (Half-float support) @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve: "sve"; diff --git a/library/stdarch/crates/std_detect/src/detect/macros.rs b/library/stdarch/crates/std_detect/src/detect/macros.rs index 7548c9780..a467f9db6 100644 --- a/library/stdarch/crates/std_detect/src/detect/macros.rs +++ b/library/stdarch/crates/std_detect/src/detect/macros.rs @@ -1,3 +1,15 @@ +#[macro_export] +#[allow_internal_unstable(stdsimd)] +macro_rules! detect_feature { + ($feature:tt, $feature_lit:tt) => { + $crate::detect_feature!($feature, $feature_lit : $feature_lit) + }; + ($feature:tt, $feature_lit:tt : $($target_feature_lit:tt),*) => { + $(cfg!(target_feature = $target_feature_lit) ||)* + $crate::detect::__is_feature_detected::$feature() + }; +} + #[allow(unused)] macro_rules! features { ( @@ -7,7 +19,9 @@ macro_rules! features { @MACRO_ATTRS: $(#[$macro_attrs:meta])* $(@BIND_FEATURE_NAME: $bind_feature:tt; $feature_impl:tt; )* $(@NO_RUNTIME_DETECTION: $nort_feature:tt; )* - $(@FEATURE: #[$stability_attr:meta] $feature:ident: $feature_lit:tt; $(#[$feature_comment:meta])*)* + $(@FEATURE: #[$stability_attr:meta] $feature:ident: $feature_lit:tt; + $(implied by target_features: [$($target_feature_lit:tt),*];)? + $(#[$feature_comment:meta])*)* ) => { #[macro_export] $(#[$macro_attrs])* @@ -17,12 +31,11 @@ macro_rules! features { macro_rules! $macro_name { $( ($feature_lit) => { - cfg!(target_feature = $feature_lit) || - $crate::detect::__is_feature_detected::$feature() + $crate::detect_feature!($feature, $feature_lit $(: $($target_feature_lit),*)?) }; )* $( - ($bind_feature) => { $macro_name!($feature_impl) }; + ($bind_feature) => { $crate::$macro_name!($feature_impl) }; )* $( ($nort_feature) => { @@ -35,7 +48,7 @@ macro_rules! features { }; )* ($t:tt,) => { - $macro_name!($t); + $crate::$macro_name!($t); }; ($t:tt) => { compile_error!( @@ -66,7 +79,7 @@ macro_rules! features { }; )* $( - ($bind_feature) => { $macro_name!($feature_impl) }; + ($bind_feature) => { $crate::$macro_name!($feature_impl) }; )* $( ($nort_feature) => { @@ -79,7 +92,7 @@ macro_rules! features { }; )* ($t:tt,) => { - $macro_name!($t); + $crate::$macro_name!($t); }; ($t:tt) => { compile_error!( -- cgit v1.2.3