You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe it is documented there where it says "Each target has a default base CPU.". Every target has a different default target-cpu. I do not believe there is an option to explicitly use the default.
rustc --print target-cpus could perhaps indicate which one is the default. I don't think the rustc book is the appropriate place to document the specs for every target.
The default rustc target is host and therefor the default target-cpu is native right? rustc --print target-cpus currently displays the host processor, e.g.
Available CPUs for this target:
native - Select the CPU of the current host (currently skylake).
No, native is different from the default. For example, the default CPU for x86_64-unknown-linux-gnu is x86-64, which is compatible with the very first generation of x86-64 CPUs. The "native" CPU on my machine is znver1. The default is hard-coded into rustc for each target, typically picking the oldest CPU that is possible for that target.
O, gotcha. Would it make more sense for --print target-cpus to display the default target cpu for the default target or for --print target list to show the default target cpu for each target? I guess showing the cpu for each target might be too much information, but I'm wondering how one could look up the cpu for any taget...
It might be reasonable to add a note next to the default CPU in the target-cpus list in a fashion similar to the native entry. But I am not on the compiler team, so it is not my call. Maybe something like:
cannonlake
cascadelake
cooperlake
core-avx-i
core-avx2
core2 - Default for the x86_64-apple-darwin target
corei7
corei7-avx
emeraldrapids
You can get the default cpu today on nightly by running rustc --print=target-spec-json.
Activity
ehuss commentedon Apr 21, 2023
I believe it is documented there where it says "Each target has a default base CPU.". Every target has a different default
target-cpu. I do not believe there is an option to explicitly use the default.rustc --print target-cpuscould perhaps indicate which one is the default. I don't think therustcbook is the appropriate place to document the specs for every target.mj10021 commentedon Apr 26, 2023
The default rustc target is host and therefor the default
target-cpuisnativeright?rustc --print target-cpuscurrently displays the host processor, e.g.ehuss commentedon Apr 26, 2023
No,
nativeis different from the default. For example, the default CPU forx86_64-unknown-linux-gnuisx86-64, which is compatible with the very first generation of x86-64 CPUs. The "native" CPU on my machine isznver1. The default is hard-coded into rustc for each target, typically picking the oldest CPU that is possible for that target.mj10021 commentedon Apr 26, 2023
O, gotcha. Would it make more sense for
--print target-cpusto display the default target cpu for the default target or for--print target listto show the default target cpu for each target? I guess showing the cpu for each target might be too much information, but I'm wondering how one could look up the cpu for any taget...@rustbot claim
ehuss commentedon Apr 26, 2023
It might be reasonable to add a note next to the default CPU in the
target-cpuslist in a fashion similar to thenativeentry. But I am not on the compiler team, so it is not my call. Maybe something like:You can get the default cpu today on nightly by running
rustc --print=target-spec-json.Rollup merge of rust-lang#110876 - mj10021:issue-110647-fix, r=b-naber
workingjubilee commentedon Jul 22, 2023
Addressed in #110876.