Skip to content

Rename rdrnd target feature to rdrand - #48369

Merged
bors merged 3 commits into
rust-lang:masterfrom
newpavlov:rdrand
Feb 25, 2018
Merged

Rename rdrnd target feature to rdrand#48369
bors merged 3 commits into
rust-lang:masterfrom
newpavlov:rdrand

Conversation

@newpavlov

Copy link
Copy Markdown
Contributor

Plus minor cleanup.

Related stdsimd issue.

@rust-highfive

Copy link
Copy Markdown
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 20, 2018
Comment threadsrc/librustc_trans/llvm_util.rs Outdated
// WARNING: the features must be known to LLVM or the feature
// detection code will walk past the end of the feature array,
// leading to crashes.
// WARNING: the features after aplpying `to_llvm_feature` must be known

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: s/aplpying/applying

@nikomatsakis

Copy link
Copy Markdown
Contributor

r? @nagisa =)

@nikomatsakis

Copy link
Copy Markdown
Contributor

cc @alexcrichton@BurntSushi

@BurntSushi

Copy link
Copy Markdown
Member

This seems right to me, and is what Intel refers to upstream. Do we know why LLVM calls this rdrnd?

@nagisa

Copy link
Copy Markdown
Member

Looking at the blame, it seems that rdrnd was chosen to match what gcc and clang "use" (before 2013 the feature was named rdrand). Clang probably copied the name from GCC and it is probable that GCC implemented this feature before the RDRAND name was widespread/confirmed/etc.

@nagisa

Copy link
Copy Markdown
Member

This is the commit.

@BurntSushi

Copy link
Copy Markdown
Member

Ug, so you're saying other compiler front ends use rdrnd instead of rdrand? To me, that makes this a harder decision. So I think our choices are:

  1. Conform with what people expect using other popular compilers. (Accept only rdrnd.)
  2. Conform with upstream vendors. (Accept on rdrand.)
  3. Conform to both. (Accept rdrnd or rdrand as aliases of one another.)

I'm not really a fan of any of these, but I feel myself leaning toward (1).

@newpavlov

Copy link
Copy Markdown
ContributorAuthor

@alexcrichtonopinion was to follow vendor names.

@nagisa

Copy link
Copy Markdown
Member

@newpavlov that was an opinion in context of llvm vs vendor and not gcc/clang vs vendor, though.

I can say for sure that I was super surprised that +rdrand didn’t work and took me a while to figure out that it is in fact +rdrnd, so I’m certainly in favour of this change.

@newpavlov

Copy link
Copy Markdown
ContributorAuthor

@nagisa
I believe pclmul was chosen by LLVM over pclmulqdq for the same reasons as rdrnd over rdrand. In other words "lvm vs vendor" looks like is equivalent to "gcc/clang vs vendor", as clang follows gcc and in turn LLVM follows clang.

@nagisa

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Feb 22, 2018

Copy link
Copy Markdown
Collaborator

📌 Commit a33c1da has been approved by nagisa

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 22, 2018
@BurntSushi

BurntSushi commented Feb 22, 2018

Copy link
Copy Markdown
Member

I'm still not convinced that this is the right path to take. Being different from the vendor stinks, but being different from other mainstream compiler front ends also stinks (which is very different from eschewing LLVM names specifically, which I'd be totally fine with). I didn't see any consideration given to supporting both?

@nagisa

Copy link
Copy Markdown
Member

@BurntSushi well, it is something relevant to more than just rdrand, and is something we should decide about in context of all features. If we decide to have aliases for compatibility with other compilers, we can simply add the cases for all the features at the same time.

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 25, 2018
Rename rdrnd target feature to rdrand
Plus minor cleanup.
Related stdsimd [issue](rust-lang/stdarch#325).
@kennytmkennytm mentioned this pull request Feb 25, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Feb 25, 2018
Rename rdrnd target feature to rdrand
Plus minor cleanup.
Related stdsimd [issue](rust-lang/stdarch#325).
bors added a commit that referenced this pull request Feb 25, 2018
@bors
bors merged commit a33c1da into rust-lang:masterFeb 25, 2018
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@newpavlov@rust-highfive@nikomatsakis@BurntSushi@nagisa@bors