Diagnostic 964: no EMMS instruction before call

Submit New Article

Last Modified On :   July 2, 2009 3:25 PM PDT
Rate
 


Cause:

It is usually incorrect for MMX code to be followed by x87 code without an intervening EMMS instruction.  Usually this will result in x87 stack overflow and unpredictable results at runtime.  When the compiler sees MMX code followed by a call without an intervening EMMS instruction, it has no way of knowing whether there is x87 code inside the call.  So it issues this warning.

Example:

#include <iostream>
#include <emmintrin.h>

extern void init(int);
int main(){

__m64 m0 = _mm_cvtsi32_si64 (1);
__m64 m1 = _mm_cvtsi32_si64 (2);
__m64 m2 = _mm_cvtsi32_si64 (4);

m2 = _mm_add_pi8(m0, m1);
int value = _mm_cvtsi64_si32(m2);

//_mm_empty();      // calling mm_empty() to restore the Floating-point Unit status on the CPU will resolve the warning message
init(value);

return value;
}

> icl -c diag964.cpp
Intel(R) C++ Compiler for applications running on IA-32, Version 10.1    Build 2
0080602 Package ID: w_cc_p_10.1.022
Copyright (C) 1985-2008 Intel Corporation.  All rights reserved.

diag964.cpp
diag964.cpp(14) (col. 2): warning #964: no EMMS instruction before call

Resolution:

Use the EMMS instruction (e.g.  by calling the _mm_empty() intrinsic ) after the MMX instructions immediately before the x87 code to restore the Floating-point status on the CPU.




This article applies to: Intel® C++ Compiler for Linux* Knowledge Base,   Intel® C++ Compiler for Mac OS X* Knowledge Base,   Intel® C++ Compiler for Windows* Knowledge Base,   Intel® Parallel Composer Knowledge Base