Macro std::is_x86_feature_detected 1.27.0[−][src]
macro_rules! is_x86_feature_detected { ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($feature_lit) => { ... }; ($bind_feature) => { ... }; ($t:tt,) => { ... }; ($t:tt) => { ... }; }
Expand description
一个在 运行时 测试 x86/x86-64 平台上是否具有 CPU 功能的宏。
标准库中提供了此宏,它将在运行时检测是否检测到指定的 CPU 功能。
除非在整个 crate 中启用了指定功能,否则在编译时不会解析。
当前,运行时检测主要依赖于 cpuid
指令。
该宏仅使用一个参数,该参数是要测试的功能的字符串字面量。 支持的功能名称是 their 文档 中 Intel 定义的功能的小写版本。
支持参数
该宏支持 #[target_feature]
支持的相同名称。
但是,与 #[target_feature]
不同,此宏不支持用逗号分隔的名称。
相反,针对多个功能的测试目前必须通过单独的宏调用来完成。
支持的参数有:
"aes"
"pclmulqdq"
"rdrand"
"rdseed"
"tsc"
"mmx"
"sse"
"sse2"
"sse3"
"ssse3"
"sse4.1"
"sse4.2"
"sse4a"
"sha"
"avx"
"avx2"
"avx512f"
"avx512cd"
"avx512er"
"avx512pf"
"avx512bw"
"avx512dq"
"avx512vl"
"avx512ifma"
"avx512vbmi"
"avx512vpopcntdq"
"avx512vbmi2"
"avx512gfni"
"avx512vaes"
"avx512vpclmulqdq"
"avx512vnni"
"avx512bitalg"
"avx512bf16"
"avx512vp2intersect"
"f16c"
"fma"
"bmi1"
"bmi2"
"abm"
"lzcnt"
"tbm"
"popcnt"
"fxsr"
"xsave"
"xsaveopt"
"xsaves"
"xsavec"
"cmpxchg16b"
"adx"
"rtm"