Attribute Macro multiversion::target

source ·
#[target]
Expand description

Provides a less verbose equivalent to the cfg(target_arch) and target_feature attributes.

A function tagged with #[target("x86_64+avx+avx2")], for example, is equivalent to a function tagged with each of:

  • #[cfg(target_arch = "x86_64")]
  • #[target_feature(enable = "avx")]
  • #[target_feature(enable = "avx2")]

The target attribute is intended to be used in tandem with the multiversion attribute to produce hand-written multiversioned functions.