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

Implement LLVM x86 adx intrinsics #3690

Merged
merged 3 commits into from
Jun 22, 2024
Merged

Implement LLVM x86 adx intrinsics #3690

merged 3 commits into from
Jun 22, 2024

Conversation

TDecking
Copy link
Contributor

See title. It also explots a small opportunity to deduplicate a bit of intrinsics code.

@TDecking
Copy link
Contributor Author

This is likely the last extension I can develop for a while. The remaining ones are either not supprted by my computer or implemented in stdarch using inline assembly.

On a related note, I managed to rewrite some intrinsics in stdarch using generic intrinsics, which means that the next stdarch submodule update over at rust-lang will come with free and full support for x86 fma.

@RalfJung
Copy link
Member

Oh that's cool, does that mean we can remove some of the intrinsics in Miri as they can no longer be reached via stdarch? :D

@TDecking
Copy link
Contributor Author

TDecking commented Jun 20, 2024

The number is small, but yes, some code can be removed.

@RalfJung
Copy link
Member

Good to know, I opened #3691 to track that.

if unprefixed_name == "subborrow.64" && this.tcx.sess.target.arch != "x86_64" {

// Used to implement the `_addcarryx_u{32, 64}` functions. They are semantically identical with the `_addcarry_u{32, 64}` functions,
// except for a slightly different type signature and the requirement for the "adx" target feature.
Copy link
Member

Choose a reason for hiding this comment

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

Sounds like you could have a helper function that takes the two places to write the result to, and call that in both cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This pattern is too small and does not appear often enough to justify it IMHO. Adding such a function now would increase the number of lines a reader needs to parse.

Copy link
Member

Choose a reason for hiding this comment

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

It's more lines but still less mental effort overall as it avoids having to parse the same logic twice.

Copy link
Contributor Author

@TDecking TDecking Jun 21, 2024

Choose a reason for hiding this comment

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

Ok. I've added the function.

Copy link
Member

Choose a reason for hiding this comment

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

I was talking about sharing the entire add-with-carry logic, not just writing two values to two places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The addition logic can be moved out, that has been done. Actually unifiying the result writing logic did not look good after one attempt, so I'd prefer if that was left alone.

src/shims/x86/mod.rs Outdated Show resolved Hide resolved
@RalfJung
Copy link
Member

That works, thanks. :)

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 22, 2024

📌 Commit 6374a87 has been approved by RalfJung

It is now in the queue for this repository.

bors added a commit that referenced this pull request Jun 22, 2024
Implement LLVM x86 adx intrinsics

See title. It also explots a small opportunity to deduplicate a bit of intrinsics code.
@bors
Copy link
Collaborator

bors commented Jun 22, 2024

⌛ Testing commit 6374a87 with merge 0904817...

@bors
Copy link
Collaborator

bors commented Jun 22, 2024

💔 Test failed - checks-actions

@RalfJung
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 22, 2024

📌 Commit be9eece has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jun 22, 2024

⌛ Testing commit be9eece with merge be67edb...

@bors
Copy link
Collaborator

bors commented Jun 22, 2024

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing be67edb to master...

@bors bors merged commit be67edb into rust-lang:master Jun 22, 2024
8 checks passed
@TDecking TDecking deleted the adx branch June 22, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants