Does rustc / cargo have a -march=native equivalent?

99封情书 提交于 2021-02-16 10:21:28

问题


I feel like binary portability isn't really a concern, and so something like -march=native may always be the default behavior. I can't find anything saying one way or the other though.


回答1:


As mentioned in the comments, pass the -C target-cpu option to rustc:

rustc -C target-cpu=native

For more options:

$ rustc -C help
    ...     
    -C        target-cpu=val -- select target processor (rustc --print target-cpus for details)
    ...

See How to pass rustc flags to cargo? for more methods of passing the option.

I feel like binary portability isn't really a concern

I'm pretty sure that the Firefox developers that rely on Rust would disagree with you, as well as plenty of others.



来源:https://stackoverflow.com/questions/46780074/does-rustc-cargo-have-a-march-native-equivalent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!