__attribute__ vector_size(16)的含义是什么? [英] What is the meaning of the __attribute__ vector_size(16)?
问题描述
当我第一次看到 __属性__
关键字时,我得到了一个C程序。它似乎是一个GNU关键字。在GCC的此页中,他们解释了它与(vector_size(16))
属性,说:
$ b
int foo __attribute__((vector_size(16)));
使编译器将foo的模式设置为16个字节,分为整数大小的单位。假设一个32位的int(4个单元的4个字节的向量),foo的对应模式将是V4SI。
这是什么意思?现在将 foo
声明为一个4元素的ints数组?如果是这样,有什么问题:
int foo [4];
?
它用于SIMD矢量化。 (不,它不会使 foo
数组)。 //gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Vector-Extensions.html#Vector-Extensionsrel =nofollow>这里。
I got a C program were I saw the __attribute__
keyword for the 1st time. It seems like it is a GNU keyword. In GCC's this page, they explain its use with the (vector_size(16))
attribute, saying:
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.
What does this mean? Is foo
now declared as a 4-element array of ints? If so, what is wrong with just:
int foo[4];
?
It's for use with SIMD vectorization. (No, it doesn't make foo
an array.)
It's documented here.
这篇关于__attribute__ vector_size(16)的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!