3 ms·
How would you sum 4 numbers with 2 adds + 2 shuffles (sorry, I'm rusty in SIMD) But remember, similar (old, but simpler) tricks were adopted by compilers, lik
by raverbashing 14y ago
How would you sum 4 numbers with 2 adds + 2 shuffles
(sorry, I'm rusty in SIMD)
But remember, similar (old, but simpler) tricks were adopted by compilers, like xor to load 0, lea to do math (not sure about this one), shifts instead of multiply/divide etc
- exDM69 14y agoSum of elements in a 4-vector with SIMD in OpenGL/OpenCL style vector shuffle syntax: vec4 s1 = v + v.yxwz; // s1 = (v.x+v.y, v.y+v.x, v.z+v.w, v.w+v.z) vec4 sum = s1 + s1.zwxy; // sum = sum of v More practical examples, related to 3d graphics: https://github.com/rikusalminen/threedee-simd https://github.com/rikusalminen/threedee-simd