gcc - __attribute__ vector_size(16) 是什么意思?

标签 gcc attributes

我看到了一个 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/

相关文章:

c - 带有属性的 movl AT&T 语法

c++ - 在 Linux 中寻找将加密文本从 C++ 应用程序写入加密 gpg 文件的正确方法

c - 使用 goto 扩展 asm,包括 gcc 文档中的一个示例,无法编译

facebook - 将 Facebook 集成到 Google 分析中

sql - 按同一列上的多个值过滤

java - 如何在 Servlet 上下文中获取所有属性名称(嵌套或不嵌套)并迭代它是映射还是列表?

C++ - 字符数组以某种方式初始化为错误的大小

Python:使类可迭代

python - Python 中的类字典对象,允许设置任意属性

gcc - 我如何要求汇编程序 "give me a full size register"?