You may have to specify a flag like "-C target-cpu=native" -- not all CPUs support popcnt, so LLVM can't generate it without knowing details about the target. I can't get the compiler on godbolt.org to generate it either way, though.
You need "-C opt-level=3 -C target-cpu=native -C target-feature=+ssse3"
There's a little typo in your C implementation of popcount: you reference `x` when you probably meant `n`
Thanks. I fixed it.
You can drop `-C target-feature=+ssse3` since `target-cpu=native` will cover that. The `-C opt-level=3` isn't necessary either, but if you drop that, it looks like there's a function that doesn't get inlined. However, even without opt-level=3, the popcnt instruction is still emitted.
Does Rust support FMV (function multi-versioning)?