Illegal optimized vmovdqa instruction generated with no fallback on non-AVX Intel x86_64

My (admittedly very old) work machine has an Intel Xeon W5590 without AVX support. I can compile the following code snippet, using the latest version of fasthash, just fine:

use fasthash::metro;

fn main() {
    metro::hash128("hello world!");
}

However, when ran, it SIGILLs. gdb reveals that I'm hitting a vmovdqa AVX instruction, which my processor doesn't support. This only happens with optimizations enabled, and is apparently caused by this memcpy being optimized into a vmovdqa to copy the final 128-bit hash.

Any pointers on figuring out why (and where) this instruction is being emitted? Compiler intrinsics are a bit beyond me, and getting this far was already a wild ride.

I'll update this thread with a minimal test case when I get the chance (and if I can get around the optimizer), but any feedback would be great!

Make sure the build script doesn't set -mavx. It seems to use feature flags.

https://github.com/flier/rust-fasthash/blob/master/fasthash-sys/build.rs

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.