我正在用GCC ( Linux/Ubuntu)用C语言写一个应用程序,它使用下面的内联汇编。
float a[4] = { 10, 20, 30, 40 };
float b[4] = { 0.1, 0.1, 0.1, 0.1 };
asm volatile("movups (%0), %%xmm0\n\t"
"mulps (%1), %%xmm0\n\t"
"movups %%xmm0, (%1)"
:: "r" (a), "r" (b));请原谅上面的打字错误(我是凭记忆写的)。Visual C++ 6.0中等效的内联汇编程序是什么?我发现我需要移植我的代码。
发布于 2009-07-22 04:45:12
__declspec(align(16)) float a[4] = { 10, 20, 30, 40 };
__declspec(align(16)) float b[4] = { 0.1f, 0.1f, 0.1f, 0.1f };
__asm {
movups xmm0, a; // could be movaps if array aligned
mulps xmm0, b;
movups b, xmm0; // could be movaps if array aligned
}我不确定Visual C++ 6是否适用,但它将在Visual C++ 2008中运行。
https://stackoverflow.com/questions/1163031
复制相似问题