Closed
Description
When setting target-feature=+fma
and printing the features via --print cfg
only avx and sse* are listed as target features. Also queries like #[cfg(target_feature = "fma")]
do not detect fma. FMA instructions like x86_mm256_fmadd_ps
are only usable when fma is enable via target-feature as expected.
The output of rustc -C target-feature=+fma --print cfg
is
debug_assertions
target_arch="x86_64"
target_endian="little"
target_env="gnu"
target_family="unix"
target_feature="avx"
target_feature="sse"
target_feature="sse2"
target_feature="sse3"
target_feature="sse4.1"
target_feature="sse4.2"
target_feature="ssse3"
target_has_atomic="16"
target_has_atomic="32"
target_has_atomic="64"
target_has_atomic="8"
target_has_atomic="ptr"
target_os="linux"
target_pointer_width="64"
target_thread_local
target_vendor="unknown"
unix
and the expected output is
[...]
target_feature="fma"
target_feature="avx"
target_feature="sse"
target_feature="sse2"
target_feature="sse3"
target_feature="sse4.1"
target_feature="sse4.2"
target_feature="ssse3"
[...]
Also this example
#![feature(cfg_target_feature)]
fn main() {
#[cfg(target_feature = "fma")]
println!("FMA is supported");
#[cfg(not(target_feature = "fma"))]
println!("FMA is not supported");
}
outputs FMA is not supported
even if it was enabled.
Meta
rustc --version --verbose
:
rustc 1.17.0-nightly (b1e3176 2017-03-03)
binary: rustc
commit-hash: b1e3176
commit-date: 2017-03-03
host: x86_64-unknown-linux-gnu
release: 1.17.0-nightly
LLVM version: 3.9
Metadata
Metadata
Assignees
Labels
No labels