-
Notifications
You must be signed in to change notification settings - Fork 13.3k
std::arch::x86::has_cpuid()
alternates between true
and false
when CPUID
is supported
#51691
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
Comments
Come to think of it, it's not at all clear that this test can be safely implemented in Rust for exactly the reason given at the link in the comment.
I don't know that LLVM has any guarantees about the values of eflags. The should be easy to write in inline assembly though. |
Oh yeah, fiddling with any (non-reserved) register like that is completely broken. This really should be an inline asm sequence, and honestly these intrinsics (edit: |
rust-lang/stdarch#492 should fix this. |
Looks good modulo the comment I left about |
Update stdsimd Closes rust-lang#51691
The code in question is here. The bug is on line 99 where the OR should be XOR.
This code demonstrates the bug.
I expected to see this happen:
x86::has_cpuid()
should be idempotent and thus the assertion should be satisfied.Instead, this happened:
Meta
The text was updated successfully, but these errors were encountered: