【发布时间】:2012-05-23 10:13:58
【问题描述】:
根据Using vector instructions through built-in functions,这个程序应该可以编译:
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 测试过,它不起作用)。问题在哪里?
【问题讨论】:
-
你用过C++编译器吗?
-
@drhirsch 是的。这些扩展是严格针对 gcc 的吗?
-
我不知道,但值得猜测 ;-)
-
@drhirsch gcc 接受下标,但仍拒绝 +
-
你应该在这里向 gcc-help 提问:gcc.gnu.org/lists.html
标签: gcc sse vectorization