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
fooan array.)It’s documented here, or in "Using Vector Instructions through Built-in Functions" section of the gcc manual (section 6.52 as of gcc 13.2.0).