C - How to access elements of vector using GCC SSE vector extension
问题 Usually I work with 3D vectors using following types: typedef vec3_t float[3]; initializing vectors using smth. like: vec3_t x_basis = {1.0, 0.0, 0.0}; vec3_t y_basis = {0.0, 1.0, 0.0}; vec3_t z_basis = {0.0, 0.0, 1.0}; and accessing them using smth. like: x_basis[X] * y_basis[X] + ... Now I need a vector arithmetics using SSE instructions. I have following code: typedef float v4sf __attribute__ ((mode(V4SF))) int main(void) { v4sf a,b,c; a = (v4sf){0.1f,0.2f,0.3f,0.4f}; b = (v4sf){0.1f,0.2f