根据通过内置函数使用向量指令,该程序应编译:
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];
}
相反,我在两个操作中都遇到错误,抱怨无效的操作数/类型。
我在 x86-64 系统上编译,所以 -msse2 是隐式的,我的编译器是 4.6.3(也用 4.7.0 测试过,它不起作用)。问题在哪里?