#[allow(unused_macros, reason = "XXX")]
macro_rules! new {
($name:ident, $($feature:tt),+) => {
mod $name {
#[cfg(miri)]
#[inline]
pub(crate) fn exist() -> bool {
$(
cfg!(target_feature = $feature) &&
)+ true
}
#[cfg(all(
not(miri),
feature = "runtime-cpu-detection",
feature = "std",
any(target_arch = "x86", target_arch = "x86_64")
))]
#[inline]
pub(crate) fn exist() -> bool {
$(
::std::arch::is_x86_feature_detected!($feature) &&
)+ true
}
#[cfg(all(
not(miri),
feature = "runtime-cpu-detection",
feature = "std",
any(target_arch = "aarch64", target_arch = "arm64ec")
))]
#[inline]
pub(crate) fn exist() -> bool {
$(
::std::arch::is_aarch64_feature_detected!($feature) &&
)+ true
}
#[cfg(all(
not(miri),
feature = "runtime-cpu-detection",
feature = "std",
any(target_arch = "loongarch32", target_arch = "loongarch64")
))]
#[inline]
pub(crate) fn exist() -> bool {
$(
::std::arch::is_loongarch_feature_detected!($feature) &&
)+ true
}
#[cfg(all(
not(miri),
feature = "runtime-cpu-detection",
feature = "std",
not(any(
target_arch = "x86",
target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "arm64ec",
target_arch = "loongarch32",
target_arch = "loongarch64"
))
))]
#[inline]
pub(crate) const fn exist() -> bool {
$(
cfg!(target_feature = $feature) &&
)+ true
}
#[cfg(all(
not(miri),
feature = "runtime-cpu-detection",
not(feature = "std"),
any(
target_arch = "x86",
target_arch = "x86_64"
)
))]
#[inline]
pub(crate) fn exist() -> bool {
::cpufeatures::new!($name, $($feature),+);
(
$(
cfg!(target_feature = $feature) &&
)+ true
) || $name::get()
}
#[cfg(all(
not(miri),
feature = "runtime-cpu-detection",
not(feature = "std"),
not(any(
target_arch = "x86",
target_arch = "x86_64"
))
))]
#[inline]
pub(crate) const fn exist() -> bool {
$(
cfg!(target_feature = $feature) &&
)+ true
}
#[cfg(all(
not(miri),
not(feature = "runtime-cpu-detection")
))]
#[inline]
pub(crate) const fn exist() -> bool {
$(
cfg!(target_feature = $feature) &&
)+ true
}
}
};
}
#[allow(unused_imports, reason = "XXX")]
pub(crate) use new;