2013-04-28 7 views
9

Visual C++ for WIN32では、4つ以上のSSEパラメータを持つ関数に長年にわたる問題があります。Visual Studioのパラメータの配置制限とWindows x64 ABI

__m128i foo4(__m128i m0, __m128i m1, __m128i m2, __m128i m3) {} 

はエラーを生成します。

align.c(8) : error C2719: 'm3': formal parameter with __declspec(align('16')) won't be aligned 

問題、機能は__inline場合でも、まだ不ABI制限を課しているのVisual C++を化合物に。

これは64ビットWindowsでまだ問題があるのでしょうか? ABIの制限はx64にも適用されますか?

(私はそう、私はそれを自分で試してみた64ビットのWindowsシステムへのアクセス権を持っていない、と豊富なGoogle検索は決定的なものが提供されていません。)

+1

[Agner霧の "規則を呼び出す" マニュアル(セクション7.2)]によれば、(http://www.agner.org/optimize/)、Windows64は、すべての__m128パラメータを渡しポインタなので、4つ以上の__m128パラメータはそこで問題にすべきではありません。 (Windowsシステムへのアクセス権もないので、これをチェックすることはできません)。 –

答えて

7

あなたはできるだけ多く128ビットを渡すことができますx64で好きなようにSSEの本質的なパラメータ。 x64 ABIは、これらのタイプを念頭に置いて設計されています。 MSDN documentationから

__m128 types, arrays and strings are never passed by immediate value but rather a pointer is passed to memory allocated by the caller. Structs/unions of size 8, 16, 32, or 64 bits and __m64 are passed as if they were integers of the same size. Structs/unions other than these sizes are passed as a pointer to memory allocated by the caller. For these aggregate types passed as a pointer (including __m128), the caller-allocated temporary memory will be 16-byte aligned.

+0

ありがとうございます。これはWindows x64のみを対象にしているようです。x64実行可能ファイルをビルドして実行するために必要なWindowsとVisual Studioの最小バージョンを知っていますか? –

+1

VS2008だと思います。 XP64はありますが、それはほとんど使われていません。 Vista 64おそらく賢明なミニレベル。 –

+0

ありがとう - それは大きな助けです。 –

関連する問題