Pass tune-cpu to LLVM

I think this is how it should work...
This commit is contained in:
Mingye Wang 2020-09-17 17:39:26 +08:00 committed by Mingye Wang
parent 285fc7d704
commit a35a93f09c
9 changed files with 80 additions and 8 deletions

View file

@ -497,8 +497,10 @@ point instructions in software. It takes one of the following values:
This instructs `rustc` to generate code specifically for a particular processor.
You can run `rustc --print target-cpus` to see the valid options to pass
here. Additionally, `native` can be passed to use the processor of the host
machine. Each target has a default base CPU.
here. Each target has a default base CPU. Special values include:
* `native` can be passed to use the processor of the host machine.
* `generic` refers to an LLVM target with minimal features but modern tuning.
## target-feature
@ -530,6 +532,20 @@ This also supports the feature `+crt-static` and `-crt-static` to control
Each target and [`target-cpu`](#target-cpu) has a default set of enabled
features.
## tune-cpu
This instructs `rustc` to schedule code specifically for a particular
processor. This does not affect the compatibility (instruction sets or ABI),
but should make your code slightly more efficient on the selected CPU.
The valid options are the same as those for [`target-cpu`](#target-cpu).
The default is `None`, which LLVM translates as the `target-cpu`.
This is an unstable option. Use `-Z tune-cpu=machine` to specify a value.
Due to limitations in LLVM (12.0.0-git9218f92), this option is currently
effective only for x86 targets.
[option-emit]: ../command-line-arguments.md#option-emit
[option-o-optimize]: ../command-line-arguments.md#option-o-optimize
[profile-guided optimization]: ../profile-guided-optimization.md