Diagnostic: no EMMS instruction before call #57831
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-SIMD
Area: SIMD (Single Instruction Multiple Data)
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
O-x86_32
Target: x86 processors, 32 bit (like i686-*) (IA-32)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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: