[−][src]Attribute Macro multiversion::target_clones
#[target_clones]
Provides automatic function multiversioning by compiling clones of the function for each target.
The proper function clone is invoked depending on runtime CPU feature detection. Priority is evaluated left-to-right, selecting the first matching target. If no matching target is found, a clone with no required features is called.
Example
The function square
runs with AVX or SSE compiler optimizations when detected on the CPU at
runtime.
use multiversion::target_clones; #[target_clones("[x86|x86_64]+avx", "x86+sse")] fn square(x: &mut [f32]) { for v in x { *v *= *v; } }