Skip to content

Target feature: rdrand / rdrnd #10

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

Closed
dhardy opened this issue Feb 18, 2019 · 2 comments
Closed

Target feature: rdrand / rdrnd #10

dhardy opened this issue Feb 18, 2019 · 2 comments
Labels

Comments

@dhardy
Copy link

dhardy commented Feb 18, 2019

Isn't this a typo?

if cfg!(target_feature="rdrand") {

$ rustc --print target-features
Available features for this target:
    ...
    rdrnd                         - Support RDRAND instruction.
    rdseed                        - Support RDSEED instruction.

This was also referenced in #5 #6 #9.

@nagisa
Copy link
Owner

nagisa commented Feb 18, 2019

--print target-features probably ends up printing the LLVM names for the features, however rustc has a mapping as seen here which is used to resolve the target_feature cfgs.

@nagisa nagisa added the wontfix label Feb 18, 2019
@nagisa
Copy link
Owner

nagisa commented Feb 18, 2019

This prints true when compiled with -Ctarget-features="+rdrnd":

fn main() {
    println!("{:?}", cfg!(target_feature="rdrand"));
}

One could argue that the name mismatch between -Ctarget-features and the target_features cfg is not great, but that would be an issue report against rustc either way.

@nagisa nagisa closed this as completed Feb 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants