使用 __m64 引用将 C++ 项目转换为 x64 [英] Converting a C++ project to x64 with __m64 references

查看:25
本文介绍了使用 __m64 引用将 C++ 项目转换为 x64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,当我开始转换并将目标设置为x64"时,我得到了 7 个未解析的外部变量.两个例子:

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

所以我尝试更深入地研究这些,我发现它不喜欢头文件中的 __m64:特别是 mmintrin.h(可能还有其他的).在我对 C++ 的业余时间里,因为我多年没有接触过这门语言,(我通常在 C# 部门),我试图编辑头文件,并用 __m128i 替换 __m64 ??!!.不知道什么是正确的路线,让这个和其他 DLL 编译成 MachineX64.在编辑并将标题的源代码放入我的本地目录后,它仍然不允许我通过右键单击进行编译...再次-业余时间.有几个人问过类似的问题,但我找不到适合我的问题.

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.

这是一个带有不受支持的 __m64 的mmintrin.h"示例...

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);
...

推荐答案

来自 __m64 类型文档:

__m64 数据类型在 x64 处理器上不受支持.使用 __m64 作为 MMX 内在函数的一部分的应用程序必须重写为使用等效的 SSE 和 SSE2 内在函数.

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

所以看起来你有三个选择:坚持使用 32 位,将 MMX 内在函数移植到 SSE,或者回退到非 SIMD 实现(如果你有一个 - 如果没有,那么考虑在标量代码中重新实现).

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).

这篇关于使用 __m64 引用将 C++ 项目转换为 x64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆