std::is_x86_feature_detected - Rust
Description: API documentation for the Rust `is_x86_feature_detected` macro in crate `std`.
Keywords: rust, rustlang, rust-lang, is_x86_feature_detected

# 1.27.0[−][src]Macro std::is_x86_feature_detected

    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") => { ... };
        ("fma") => { ... };
        ("bmi1") => { ... };
        ("bmi2") => { ... };
        ("abm") => { ... };
        ("lzcnt") => { ... };
        ("tbm") => { ... };
        ("popcnt") => { ... };
        ("fxsr") => { ... };
        ("xsave") => { ... };
        ("xsaveopt") => { ... };
        ("xsaves") => { ... };
        ("xsavec") => { ... };
        ("cmpxchg16b") => { ... };
        ("adx") => { ... };
        ($t:tt,) => { ... };
        ($t:tt) => { ... };
    }

A macro to test at runtime whether a CPU feature is available on x86/x86-64 platforms.

This macro is provided in the standard library and will detect at runtime whether the specified CPU feature is detected. This does not resolve at compile time unless the specified feature is already enabled for the entire crate. Runtime detection currently relies mostly on the `cpuid` instruction.

This macro only takes one argument which is a string literal of the feature being tested for. The feature names supported are the lowercase versions of the ones defined by Intel in their documentation.

## Supported arguments

This macro supports the same names that `#[target_feature]` supports. Unlike `#[target_feature]`, however, this macro does not support names separated with a comma. Instead testing for multiple features must be done through separate macro invocations for now.

Supported arguments are:

- `"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"`
- `"fma"`
- `"bmi1"`
- `"bmi2"`
- `"abm"`
- `"lzcnt"`
- `"tbm"`
- `"popcnt"`
- `"fxsr"`
- `"xsave"`
- `"xsaveopt"`
- `"xsaves"`
- `"xsavec"`

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)