我看到了一个 C 程序,我看到了 __attribute__
第一次使用关键字。它似乎是一个 GNU 关键字。在海湾合作委员会的 this page ,他们用 (vector_size(16))
解释了它的用法。属性,说:
int foo __attribute__ ((vector_size (16)));
causes the compiler to set the mode for foo, to be 16 bytes, divided into int sized units. Assuming a 32-bit int (a vector of 4 units of 4 bytes), the corresponding mode of foo will be V4SI.
这是什么意思?是foo
现在声明为一个 4 元素的整数数组?如果是这样,那么只是有什么问题:int foo[4];
?
最佳答案
它用于 SIMD 矢量化。 (不,它不会使 foo
成为一个数组。)
已记录在案 here .
关于gcc - __attribute__ vector_size(16) 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7843597/