どのように私は、Visual C ++ 6.0で、次のインラインアセンブリコードを書くのですか?

StackOverflow https://stackoverflow.com/questions/1163031

質問

私はGCCでCでアプリケーションを書いています(のためのLinux / Ubuntuの)次のインラインアセンブリを使用します。

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での同等のインラインアセンブラとは何ですか?私はポートに私のコードを必要とすることを発見した。

役に立ちましたか?

解決

__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で動作します。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top