winnt.h declaration incompatible with func declared in emmintrin.h

winnt.h declaration incompatible with func declared in emmintrin.h

Taylor Kidd (Intel)'s picture

I assume that this forum is trolled by the Intel C++ experts for answers the communal mind doesn't have.

I'm using Visual C++ 2008 (9.0.21022.8). And IC C++ 11.0.066.

I'm working on a module that uses old SSE 2 code. It compiles fine with VS but gets the following error using the IC:

1>Getblk_sse2.cpp
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\\include\winnt.h(3332): error #147: declaration is incompatible with "void __cdecl _mm_pause()" (declared at line 375 of "C:\Program Files\Intel\Compiler\11.0\066\cpp\include\emmintrin.h")
1> _mm_pause (
1> ^
1>

The only thing I can find is that errors similar to this can occur if you're using an older version of the IC with a newer version of VS. But I'm not.

Any ideas? I'm using Vista SP2.

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Jennifer J. (Intel)'s picture
did you use "__cdecl (/Gd)"? Try to add it.

Jennifer

Taylor Kidd (Intel)'s picture

Quoting - Jennifer Jiang (Intel) did you use "__cdecl (/Gd)"? Try to add it.

Jennifer

Jennifer,

Thanks. It worked.

MSDN has an explanation of the calling conventions (http://msdn.microsoft.com/en-us/library/46t77ak2.aspx), but I have to admit that I'm not sure about their advantages and disadvantages outside of __fastcall.

So I'm guessing that the problem was that winnt.h uses a __stdcall convention which didn't match with the __cdecl convention used in emmintrin.h. (Hey, if I'm wrong, correct me.)

--Taylor

Jennifer J. (Intel)'s picture
Quoting - Taylor Kidd
So I'm guessing that the problem was that winnt.h uses a __stdcall convention which didn't match with the __cdecl convention used in emmintrin.h. (Hey, if I'm wrong, correct me.)

It's the mixmatch of winnt.h and emmintrin.h. If you do not use winnt.h, you can still use _stdcall with emmintrin.h. The icl knows what to do.

Jennifer

Sergey Kostrov's picture

Here are some technical details for reference:

In older versions ( v11 and before ) of Intel C++ compilers _mm_pause is declared as follows:
...
extern void _mm_pause(void);
...

In latest versions ( v12 and v13 ) of Intel C++ compilers _mm_pause is declared as follows:
...
extern void __ICL_INTRINCC _mm_pause(void);
...
and __ICL_INTRINCC is declared as follows:

/*
* Define the calling convention that will be used by intrinsics.
* For most of them this convention has almost no effect, as they are
* completely lowered by compiler. To override the calling convention
* throw an additional option -D__ICL_INTRINCC=. This may
* be needed to match MSFT declrartions, which miss __cdecl specifier.
*/
#ifndef __ICL_INTRINCC
#ifndef _MSC_VER
# define __ICL_INTRINCC
#else
# define __ICL_INTRINCC __cdecl
#endif
#endif /*__ICL_INTRINCC */

#ifndef __ICL_CDECLCC
#ifndef _MSC_VER
# define __ICL_CDECLCC
#else
# define __ICL_CDECLCC __cdecl
#endif
#endif /* __ICL_CDECLCC */

#ifndef _MSC_VER
#define __cdecl
#endif

As you can see there was a change in declaration of _mm_pause intrinsic function.

Login to leave a comment.