默认发行版本会一直使用多达SSSE3指令吗?

Str*_*ger 4 sse x86-64 simd rust

查看由cargocargo 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
Run Code Online (Sandbox Code Playgroud)

给定SIMD ISA(AVX2或SSSE3)时,我有不同的路径,并且期望具有默认构建的非SIMD路径。

#[cfg(target_feature = "avx2")]
{
    ...
    return;
}
#[cfg(target_feature = "ssse3")]
{
    ...
    return;
}
// portable Rust code at the end
...
Run Code Online (Sandbox Code Playgroud)

这是否意味着默认发布版本将始终使用多达SSSE3指令,而不仅仅是在x86_64上强制使用的SSE2?

She*_*ter 7

target_os="macos"
Run Code Online (Sandbox Code Playgroud)

是的,将在macOS上构建默认发行版。

由于Apple从未出售过任何AMD或Pentium4 CPU,因此OS X上的x86-64也意味着SSSE3(第一代Core2)。首批x86 Mac是Core(不是Core2),但它们只有32位。很遗憾,您不能使用SSE4.1或-mpopcnt