Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc --print cfg prints features that are invalid for -Ctarget-feature #81881

Closed
djc opened this issue Feb 8, 2021 · 2 comments
Closed

rustc --print cfg prints features that are invalid for -Ctarget-feature #81881

djc opened this issue Feb 8, 2021 · 2 comments
Labels
C-bug Category: This is a bug.

Comments

@djc
Copy link
Contributor

djc commented Feb 8, 2021

I have been investigating how to optimize my binaries for the least common denominator across a number of different CPU types (that is, something between the default CPU and target-cpu=native). In the linked thread, someone pointed me at rustc --print cfg and I found some relevant documentation in the SIMD docs. However, I found that the output of rustc --target x86_64-unknown-linux-gnu --print target-features and rustc --print cfg --target x86_64-unknown-linux-gnu are inconsistent, and the latter outputs features that don't actually work with -Ctarget-feature. So far, the ones that I noticed are:

  • bmi (target-feature) vs bmi1 (cfg)
  • pclmul vs pclmulqdq
  • rdrnd vs rdrand

Should the --print cfg command be updated to print output that's consistent with the target-feature list?

djc-2019 cpu-features rust $ rustc -vV                                                      
rustc 1.49.0 (e1884a8e3 2020-12-29)
binary: rustc
commit-hash: e1884a8e3c3e813aada8254edfa120e85bf5ffca
commit-date: 2020-12-29
host: x86_64-apple-darwin
release: 1.49.0
@djc djc added the C-bug Category: This is a bug. label Feb 8, 2021
@nagisa
Copy link
Member

nagisa commented Jul 23, 2021

-Ctarget-feature accepts rust feature names as of #84991

@nagisa nagisa closed this as completed Jul 23, 2021
@djc
Copy link
Contributor Author

djc commented Jul 25, 2021

@nagisa the other part of this issue is getting --print target-features aligned with --print cfg, which as far as I can tell is not affected by #84991. Should we keep this issue open until that part is addressed as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants