How can I pass codegen options to rustc from cargo?


#1

Sorry if it is FAQ.

I want to enable SSE4.2 and saw an article that I must pass target-cpu=native.

I looked at http://doc.crates.io/manifest.html but could not find the way.
Could you tell me it or a place of information?

Thanks.


#2

Cargo docs lack the necessary explanations.
I think there are two ways to do what you want, but so far I have found only the first:

cargo rustc --release --bin my_prog_name -- -C target-cpu=native


#3

Thank you!

It seems to work (could compile), but I could not get SSE instructions…

Does anyone know that how to let u64’s count method use SSE instruction?


#4

On ARM, to get a nice 2x speedup using NEON instructions in this code snippet, it was necessary to pass:

-C target-feature=+neon