-
Notifications
You must be signed in to change notification settings - Fork 324
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
Conversation
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. |
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 |
The number is small, but yes, some code can be removed. |
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
That works, thanks. :) @bors r+ |
Implement LLVM x86 adx intrinsics See title. It also explots a small opportunity to deduplicate a bit of intrinsics code.
💔 Test failed - checks-actions |
@bors r+ |
☀️ Test successful - checks-actions |
See title. It also explots a small opportunity to deduplicate a bit of intrinsics code.