Skip to content

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

Closed
@djc

Description

@djc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions