-
Notifications
You must be signed in to change notification settings - Fork 352
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
miri: implement some llvm.x86.sse.*
intrinsics and add tests
#2989
Conversation
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 looks very good, thanks a lot for all the comments. :) I left a bunch of notes, mostly minor.
I can't actually tell if these implementations are correct, I'll just have to trust you on that and wait for bug reports otherwise. ;)
One thing that might be useful is to briefly establish some terminology at the top of sse.rs. In particular "ss" and "ps" seem to be very common and I have no idea what these are for.
@eduardosm so through this PR I became aware of nontemporal_store, which led to rust-lang/rust#114582, and getcsr/setcsr, which led to rust-lang/stdarch#1454... which other hideous monsters are lurking in stdarch?^^ |
Please never merge master into your PR, and only rebase when there are conflicts or it is needed to resolve CI failures (which might be the case here due to the operand_deref rename). |
I was avoiding force-pushing so everything appears as new commits to make it easier to review. I was planning on squashing everything together at the end. |
Yeah, keeping it in new commits is definitely appreciated, even across the rebase. I guess the merge commits don't hurt if we remember to squash-before-merge. |
I've added a commit that moves the entire "multiply by (1+err)" logic into the helper function, makes it much more clear what's going on IMO. I wonder if it wouldn't be easier to just XOR all but the first 11 or 12 bits of the mantissa with random garbage, but I don't know how to do that with apfloat so 🤷 . LGTM, thanks a lot for enduring the review! Can you please squash? |
Implements LLVM intrisics needed to run most SSE functions from `core::arch::x86{,_64}`. Also adds miri tests for those functions (mostly copied from core_arch tests).
31ed6d0
to
16a4a9f
Compare
Squashed! Thanks for the thorough review :) |
This test failure here is concerning: https://github.com/rust-lang/miri/actions/runs/5832262620/job/15817332780 This failed here. Is it possible that the tests are expecting more precision from RCP/RSQRT than they provide? |
Nah, that's because it was calculating sqrt(x) instead of 1/sqrt(x). Lines 531 to 539 in 31ed6d0
I fixed it before squashing. |
Oh, I screwed up then. oops Thanks for taking care of it! |
@bors r+ |
☀️ Test successful - checks-actions |
Add checked float-to-int helper function As discussed in #2989 (comment)
Add checked float-to-int helper function As discussed in rust-lang/miri#2989 (comment)
Implement some `llvm.x86.sse2.*` intrinsics and add tests Continuation of #2989 with SSE2 intrinsics. Thankfully, a significant amount of SSE2 functions use `simd_*` intrinsics, which are already implemented in Miri.
Implement some `llvm.x86.sse2.*` intrinsics and add tests Continuation of rust-lang/miri#2989 with SSE2 intrinsics. Thankfully, a significant amount of SSE2 functions use `simd_*` intrinsics, which are already implemented in Miri.
PR moved from rust-lang/rust#113932.
Implements LLVM intrisics needed to run most SSE functions from
core::arch::x86{,_64}
.Also adds miri tests for those functions (mostly copied from core_arch tests).
r? @RalfJung
The first commit is the same that the commit in the PR I had opened in the Rust repository. I addressed review comments in additional commits to make it easier to review. I also fixed formatting and clippy warnings.