私はインテルSSE2イントリンシクスで書かれたルーチンをMicrosoftの32ビットプラットフォームに移植しています。 GCC、Clang、および64ビットWindowsでは正常に動作します。元のコードは、効果的に次のことを行います。64ビット整数型から__m64をロードしますか?
typedef unsigned __int64 word64;
// input is aligned on 16-byte boundary
void (const byte* input)
{
const word64 m0 = ((const word64*)input)[ 0];
const word64 m1 = ((const word64*)input)[ 8];
...
__m128 t0 = _mm_set_epi64x(m0, m1);
}
マイクロソフトは、32ビットプラットフォーム上で_mm_set_epi64x
を提供していないので、私は_mm_set_epi64
を使用します。
今では問題...まず、
__m64 m0, m1;
m0 = *(word64*)(input+0);
結果:
1> error C2679: binary '=' : no operator found which takes a right-hand operand
of type 'word64' (or there is no acceptable conversion)
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\mmintrin.h(42):
could be '__m64 &__m64::operator =(const __m64 &)'
1> while trying to match the argument list '(__m64, word64)'
第二に、word64
との潜在的な問題を回避し、直接unsigned __int64*
を使用しようとしている:
m0 = *(unsigned __int64*)(input+0);
同じ結果:
1> blake2.cpp(530): error C2679: binary '=' : no operator found which takes a right-hand
operand of type 'unsigned __int64' (or there is no acceptable conversion)
第三には、私は<mmintrin.h>
を通じて見て、_m_from_int
を見つけました:それは、その結果
m0 = _m_from_int(*(word64*)(input+0));
:
1> blake2.cpp(529): warning C4244: 'argument' : conversion from 'word64'
to 'int', possible loss of data
私はこの時点で他に何をしようとするかわかりません。
__m64
を64ビット整数型からロードするにはどうすればよいですか?以下は
__m64
のMicrosoftの宣言ですが、我々は不透明として扱うことになっている:
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;
http:// stackoverflow。com/questions/27258261/msvc-avx-code-compilation-mm256-setr-epi64x/27267287#27267287 –