-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Diagnostic: no EMMS instruction before call #57831
Comments
GCC just implemented rewiring the MMX intrinsics to 8byte SSE2 equivalents. Maybe rust could do the same to avoid this pitfall. |
@the8472 would you mind opening a separate issue to discuss that? This wouldn't help anybody trying to actually use the MMX registers. Implementing the rewiring should be trivial though. We could have a |
IMO with MMX support removed from Rust this should be closed. |
Agreed. It is no longer possible to invoke the relevant intrinsics on nightly, so Rust cannot cause the relevant interaction directly, and in particular the reproducer just results in a compiler error. This issue can be closed. |
The Intel compiler has an extremely useful warning (https://software.intel.com/en-us/articles/cdiag964) that triggers if MMX code interfaces with x87 code without an EMMS instruction before the x87 code.
Example (playground):
Without the call to
_mm_empty
noemms
instruction is emitted, and the program has undefined behavior.It would be nice if rustc could emit the following error message:
There are a couple of common ways to emit an EMMS instruction:
{core, std}::arch::{x86, x86_64}::{_mm_empty(), _m_empty()}
asm!("emms" : : : "volatile")
;The diagnostic should not be emitted if an EMMS instruction is emitted right before a call to an x87 function.
Note, LLVM, by design, does not emit EMMS instructions when they are needed (https://bugs.llvm.org/show_bug.cgi?id=1838). Instead, the user generating LLVM-IR is responsible of doing so manually when necessary.
The text was updated successfully, but these errors were encountered: