0

フラグ付きの GCC でこのコードをコンパイルしようとしたため、 Microsoft の SSE 組み込み関数が標準と少し異なるかどうか疑問に思っています。-msse -msse2 -msse3 -msse4

#include <stdio.h>
#include <smmintrin.h>

int main ()
{
    __m128i a, b;

    a.m128i_u64[0] = 0x000000000000000;
    b.m128i_u64[0] = 0xFFFFFFFFFFFFFFF;

    a.m128i_u64[1] = 0x000000000000000;
    b.m128i_u64[1] = 0x000000000000000;

    int res1 = _mm_testnzc_si128(a, b);

    a.m128i_u64[0] = 0x000000000000001;

    int res2 = _mm_testnzc_si128(a, b);

    printf_s("First result should be 0: %d\nSecond result should be 1: %d\n",
                res1, res2);

    return 0;
}

そして、それは私に次のエラーを与えました:

sse_test_not_zero.c||In function 'main':|
sse_test_not_zero.c|8|error: request for member 'm128i_u64' in something not a structure or union|
sse_test_not_zero.c|9|error: request for member 'm128i_u64' in something not a structure or union|
sse_test_not_zero.c|9|warning: integer constant is too large for 'long' type|
sse_test_not_zero.c|11|error: request for member 'm128i_u64' in something not a structure or union|
sse_test_not_zero.c|12|error: request for member 'm128i_u64' in something not a structure or union|
sse_test_not_zero.c|16|error: request for member 'm128i_u64' in something not a structure or union|
sse_test_not_zero.c|20|warning: implicit declaration of function 'printf_s'|

他の誰かが知っている場合、この問題に対するより良い解決策があるかもしれませんが、作成structする必要があるように私には思えます。__m128i

4

1 に答える 1

2

The definition of SSE types such as __m128i is different in Microsoft-land than in the rest of the world. If you want to write portable SSE code then stick with the intrinsics that are common to all platforms and don't make any assumptions about how the SSE vector types are defined (i.e. treat them as more-or-less opaque data types). You can implement the code in your question just using appropriate _mm_set_xxx intrinsics.

于 2013-07-07T21:43:30.627 に答える