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

target_features for bit manipulation instruction sets #30462

Closed
gnzlbg opened this issue Dec 18, 2015 · 4 comments
Closed

target_features for bit manipulation instruction sets #30462

gnzlbg opened this issue Dec 18, 2015 · 4 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Dec 18, 2015

There are currently no target features for bit manipulation instruction sets, in particular:

  • AMD's Advanced Bit Manipulation (ABM) and Trailing Bit Manipulation (TBM) instructions, and
  • Intel's Bit Manipulation Instructions (BMI1 and BMI2).

Since clang has macros to detect these I guess llvm offers the ability to obtain this functionality from the CPUID as well.

Wikipedia offers a pretty good and brief review of the situation. Basically all modern processors support ABM and BMI1. Modern Intel CPUs support BMI2, and next generation AMD CPUs will as well.

AMD also has TBM but these won't be supported anymore in future CPUs.

Huon's llvmin offers intrinsics for all these instruction sets but without a target config macro there is no way of wrapping these into a higher level safer abstraction portably.

So basically I would like to have target features to use in #[cfg(_)] for: amb, bmi1,bmi2, and tmb.

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Dec 18, 2015

Related to #29717.

gnzlbg added a commit to gnzlbg/rust that referenced this issue Jun 21, 2016
This commit adds support for detecting all of llc's target features for the x86/x86_64 architectures.

Closes rust-lang#30462.
Helps with rust-lang#29717 and rust-lang#34382.
@steveklabnik steveklabnik added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 18, 2017
@steveklabnik
Copy link
Member

Triage: no idea what the status is here, honestly.

@steveklabnik
Copy link
Member

Triage: no idea what the status is here, honestly. @gnzlbg any update?

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Sep 24, 2018

This was fixed ages ago, and is already available on stable, e.g., #[cfg(target_feature = "bmi2")] :)

Thanks for the triage!

@gnzlbg gnzlbg closed this as completed Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants