【发布时间】:2019-12-06 22:28:08
【问题描述】:
查看cargo (cargo build --release) 生成的二进制代码。我在二进制文件中发现使用了SSSE3 指令,如pshufb。
看看我的cfg:
$ rustc --print cfg
debug_assertions
target_arch="x86_64"
target_endian="little"
target_env=""
target_family="unix"
target_feature="fxsr"
target_feature="sse"
target_feature="sse2"
target_feature="sse3"
target_feature="ssse3"
target_os="macos"
target_pointer_width="64"
target_vendor="apple"
unix
在给定 SIMD ISA(AVX2 或 SSSE3)的情况下,我有不同的路径,并希望在默认构建中使用非 SIMD 路径。
#[cfg(target_feature = "avx2")]
{
...
return;
}
#[cfg(target_feature = "ssse3")]
{
...
return;
}
// portable Rust code at the end
...
这是否意味着默认发布版本将始终使用最多 SSSE3 指令,而不仅仅是在 x86_64 上强制使用的 SSE2?
【问题讨论】: