Lor*_*one 3 gcc sse vectorization
按照通过内置函数使用向量指令,这个程序应该编译:
int main(){
double v_sse __attribute__ ((vector_size (16)));
/*
* Should work: "For the convenience in C it is allowed to use a binary vector operation where one operand is a scalar."
*/
v_sse=v_sse+3.4;
/*
* Should work: "Vectors can be subscripted as if the vector were an array with the same number of elements and base type."
*/
double result=v_sse[0];
}
Run Code Online (Sandbox Code Playgroud)
相反,我在两个操作中都遇到错误,抱怨无效的操作数/类型.
我在x86-64系统上编译,所以-msse2是隐式的,我的编译器是4.6.3(也用4.7.0测试,它不起作用).捕获量在哪里?
http://gcc.gnu.org/onlinedocs/gcc/上的文档涉及当前的开发.
请查看http://gcc.gnu.org/onlinedocs/gcc-XYZ/以查找您正在使用的版本的文档(请参阅http://gcc.gnu.org/onlinedocs/上的索引以获取指向该版本的链接.每个系列的最新版本的文档).
在这种情况下:
......这解释了你所看到的.
当编译为C时,这两个都适用于4.7.0,但在编译为C++时则不行.