On 8/27/20 8:07 AM, Doerr, Martin wrote:
I will use __attribute__ ((align(16))) instead of __vector, and make
them arrays of 16 unsigned char.
Maybe __vectors works as expected, too, now. Whatever we use, I'd appreciate to 
double-check the alignment e.g. by using gdb.
I don't remember what we had tried and why it didn't work as desired.


I just now tried on gcc-7.5.0, declaring a __vector at 1, 2, 3, 8, 9, and 15 byte offsets in a struct, trying to force a misalignment, but the compiler realigned all of them on 16-byte boundaries.

If someone decides to make the intrinsic work on AIX (big endian), and compiles with 7.3.1, I don't know what will happen w.r.t. alignment, so to be on the safe side, I will make the declarations 16-byte unsigned char arrays with an align attribute.

Looking a bit deeper, I see that the __vector type comes out of the C preprocessor as: __attribute__((altivec(vector__))). It's part of the compiler's basic set of predefined macros, and can be seen using this command:

%  gcc -dM -E - < /dev/null | grep __vector

#define __vector __attribute__((altivec(vector__)))

Some information here:
https://gcc.gnu.org/onlinedocs/gcc/PowerPC-Type-Attributes.html

I don't know if this is helpful or not, but it might answer part of your question about the meaning of __vector.

Regards,

- Corey

Reply via email to