我是GCC C的矢量扩展的新手。我在手册中读到,矢量可以通过使用强制转换来转换为任何类型。但是,我不清楚这是如何执行的,因为明显的方法失败了:
typedef int8_t s8a __attribute__((aligned (16)));
typedef int8_t v16s8 __attribute__ ((vector_size (16)));
s8a *x = _mm_malloc(512,16); // Grab some aligned mem for my int8s
x[0] = 4; x[2] = 1; x[5] = 7; x[15] = 1; // the rest should be junk
v16s8 y = (v16s8)x; // assign the aligned memory to a vector type
我明白了:
vec.c:22:2: error: can't convert value to a vector
v16s8 y = (v16s8)x;
如何将任意内存位置(已知对齐等于或优于向量)转换为向量类型?
谢谢!