我在使用-std=c++11
時無法編譯GCC 4.9下的一些代碼。 GCC 4.9在Debian 8.5(Stable)下提供,所以它相當受歡迎。在GCC下使用-std = C++ 11時,__v2di聲明在哪裏?
相關的代碼是:
__inline __m128i
clmulepi64_si128 (__m128i a, __m128i b, const int i)
{
asm ("pclmulqdq %2, %1, %0" : "+x"(a) : "xm"(b), "i"(i));
return a;
}
試圖編譯它導致:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:43:0,
from /usr/include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33,
from /usr/include/c++/4.9/random:50,
from /usr/include/c++/4.9/bits/stl_algo.h:66,
from /usr/include/c++/4.9/algorithm:62,
...
error: expected ‘)’ before ‘__builtin_ia32_pclmulqdq128’
clmulepi64_si128 (__m128i a, __m128i b, const int i)
^
它沒有很大的意義,直到我去grepping爲__builtin_ia32_pclmulqdq128
:
$ grep -IR '__builtin_ia32_pclmulqdq128' /usr/lib 2>/dev/null | grep -iv clang
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h: return (__m128i) __builtin_ia32_pclmulqdq128 ((__v2di)__X,
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/wmmintrin.h: ((__m128i) __builtin_ia32_pclmulqdq128 ((__v2di)(__m128i)(X),
看來GCC執行一箇中間轉換爲__v2di
,但是缺少。包括GCC的<x86intrin.h>
超級標頭不提供它。
我找不到__v2di
通過grepping通過源文件。它可能在那裏,但我一直無法找到它。請參閱下面的greps
。
在GCC下的-std=c++11
中,__v2di
在哪裏申明或定義?
這裏的另一種扭曲......它的工作原理沒有-std=...
,但它失敗std=c++11
:
$ make CXXFLAGS=" -DDEBUG -g3 -O0 -fPIC -march=native" vmac.o
g++ -DDEBUG -g3 -O0 -fPIC -march=native -c vmac.cpp
$
和:
$ make CXXFLAGS=" -DDEBUG -g3 -O0 -std=c++11 -fPIC -march=native -pipe" vmac.o
g++ -DDEBUG -g3 -O0 -std=c++11 -fPIC -march=native -pipe -c vmac.cpp
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.9/include/x86intrin.h:43:0,
from /usr/include/x86_64-linux-gnu/c++/4.9/bits/opt_random.h:33,
from /usr/include/c++/4.9/random:50,
from /usr/include/c++/4.9/bits/stl_algo.h:66,
from /usr/include/c++/4.9/algorithm:62,
$ grep -IR '__v2di' /usr/lib 2>/dev/null | grep -iv clang | grep 'define'
$
$ grep -IR '__v2di' /usr/lib 2>/dev/null | grep -iv clang | grep 'struct'
$
$ grep -IR '__v2di' /usr/lib 2>/dev/null | grep -iv clang | grep '}'
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/avx2intrin.h: __v2di src = __extension__ (__v2di){ 0, 0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/avx2intrin.h: __v2di mask = __extension__ (__v2di){ ~0, ~0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/avx2intrin.h: __v2di src = __extension__ (__v2di){ 0, 0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/avx2intrin.h: __v2di mask = __extension__ (__v2di){ ~0, ~0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/emmintrin.h: return __extension__ (__m128i)(__v2di){ __q0, __q1 };
/usr/lib/gcc/x86_64-linux-gnu/4.9.2/include/avx2intrin.h: __v2di src = __extension__ (__v2di){ 0, 0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9.2/include/avx2intrin.h: __v2di mask = __extension__ (__v2di){ ~0, ~0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9.2/include/avx2intrin.h: __v2di src = __extension__ (__v2di){ 0, 0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9.2/include/avx2intrin.h: __v2di mask = __extension__ (__v2di){ ~0, ~0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9.2/include/emmintrin.h: return __extension__ (__m128i)(__v2di){ __q0, __q1 };
$ grep -IR '__v2di' /usr/lib 2>/dev/null | grep -iv clang | grep '{'
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/avx2intrin.h: __v2di src = __extension__ (__v2di){ 0, 0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/avx2intrin.h: __v2di mask = __extension__ (__v2di){ ~0, ~0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/avx2intrin.h: __v2di src = __extension__ (__v2di){ 0, 0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/avx2intrin.h: __v2di mask = __extension__ (__v2di){ ~0, ~0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9/include/emmintrin.h: return __extension__ (__m128i)(__v2di){ __q0, __q1 };
/usr/lib/gcc/x86_64-linux-gnu/4.9.2/include/avx2intrin.h: __v2di src = __extension__ (__v2di){ 0, 0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9.2/include/avx2intrin.h: __v2di mask = __extension__ (__v2di){ ~0, ~0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9.2/include/avx2intrin.h: __v2di src = __extension__ (__v2di){ 0, 0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9.2/include/avx2intrin.h: __v2di mask = __extension__ (__v2di){ ~0, ~0 };
/usr/lib/gcc/x86_64-linux-gnu/4.9.2/include/emmintrin.h: return __extension__ (__m128i)(__v2di){ __q0, __q1 };
以我V6的構建,它在emmintrin.h被定義爲'的typedef長長__v2di __attribute__((__vector_size__(16)));'。 –