Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
954 views
in Technique[技术] by (71.8m points)

visual c++ - Converting a C++ project to x64 with __m64 references

So when I started the conversion and set the target to 'x64', I get 7 unresolved externals. Two examples:

error LNK2001: unresolved external symbol _m_empty    ...CONVOLUTION_2D_USHORT.obj  CONVOLUTION_2D_USHORT
error LNK2001: unresolved external symbol _mm_setzero_si64  ...CONVOLUTION_2D_USHORT.obj    CONVOLUTION_2D_USHORT

So I tried investigating these a bit deeper, and I found that it doesn't like the __m64 inside the header files: Specifically mmintrin.h (there might be others). In my amateur hour with C++, because I haven't messed with the language in years, (I'm usually in the C# department), I attempted to edit the header files, and replace __m64 with __m128i ??!!. Don't know what is the correct route, to get this and other DLLs to compile against MachineX64. After editing and putting the source of the header in my local directory, it still doesn't allow me to compile via right-click... again-Amateur-hour. There has been a few people that have asked similar questions, but I couldn't find the right one for me.

Here is a sample of 'mmintrin.h' with unsupported __m64...

typedef union __declspec(intrin_type)_CRT_ALIGN(8) __m64
{
unsigned __int64    m64_u64;
float               m64_f32[2];
__int8              m64_i8[8];
__int16             m64_i16[4];
__int32             m64_i32[2];
__int64             m64_i64;
unsigned __int8     m64_u8[8];
unsigned __int16    m64_u16[4];
unsigned __int32    m64_u32[2];
} __m64;

/* General support intrinsics */
void  _m_empty(void);
__m64 _m_from_int(int _I);
int   _m_to_int(__m64 _M);
__m64 _m_packsswb(__m64 _MM1, __m64 _MM2);
__m64 _m_packssdw(__m64 _MM1, __m64 _MM2);
__m64 _m_packuswb(__m64 _MM1, __m64 _MM2);
__m64 _m_punpckhbw(__m64 _MM1, __m64 _MM2);
__m64 _m_punpckhwd(__m64 _MM1, __m64 _MM2);
__m64 _m_punpckhdq(__m64 _MM1, __m64 _MM2);
__m64 _m_punpcklbw(__m64 _MM1, __m64 _MM2);
__m64 _m_punpcklwd(__m64 _MM1, __m64 _MM2);
__m64 _m_punpckldq(__m64 _MM1, __m64 _MM2);
...
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

From the __m64 type documentation:

The __m64 data type is not supported on x64 processors. Applications that use __m64 as part of MMX intrinsics must be rewritten to use equivalent SSE and SSE2 intrinsics.

http://msdn.microsoft.com/en-us/library/08x3t697(v=vs.110).aspx

So it looks like you have three options: stick with 32 bits, port the MMX intrinsics to SSE, or fall back to a non-SIMD implementation (if you have one - if not then consider re-implementing in scalar code).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...