Macro std::is_x86_feature_detected
1.27.0 · source · macro_rules! is_x86_feature_detected { ("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") => { ... }; ("gfni") => { ... }; ("vaes") => { ... }; ("vpclmulqdq") => { ... }; ("avx512vnni") => { ... }; ("avx512bitalg") => { ... }; ("avx512bf16") => { ... }; ("avx512vp2intersect") => { ... }; ("f16c") => { ... }; ("fma") => { ... }; ("bmi1") => { ... }; ("bmi2") => { ... }; ("lzcnt") => { ... }; ("tbm") => { ... }; ("popcnt") => { ... }; ("fxsr") => { ... }; ("xsave") => { ... }; ("xsaveopt") => { ... }; ("xsaves") => { ... }; ("xsavec") => { ... }; ("cmpxchg16b") => { ... }; ("adx") => { ... }; ("rtm") => { ... }; ("movbe") => { ... }; ("ermsb") => { ... }; ("abm") => { ... }; ("avx512gfni") => { ... }; ("avx512vaes") => { ... }; ("avx512vpclmulqdq") => { ... }; ($t:tt,) => { ... }; ($t:tt) => { ... }; }
Available on x86 or x86-64 only.
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"
"gfni"
"vaes"
"vpclmulqdq"
"avx512vnni"
"avx512bitalg"
"avx512bf16"
"avx512vp2intersect"
"f16c"
"fma"
"bmi1"
"bmi2"
"abm"
"lzcnt"
"tbm"
"popcnt"
"fxsr"
"xsave"
"xsaveopt"
"xsaves"
"xsavec"
"cmpxchg16b"
"adx"
"rtm"
"movbe"
"ermsb"