by anonymous · 14y ago · 0 comments
If you are not working on high-performance bit-twiddling algorithms then you will probably have limited use for shuffle intrinsics. For those applications, it can save a few clock cycles for each call relative to more naive methods.
Basic example, doing addition of 4 values in 2 ALU operations:
vec4 sum(vec4 v) // return v.x+v.y+v.z+v.w repeated 4 times
{
vec4 temp = v + v.yxzw;
return temp + temp.zwxy; // did I get this right?
}
Practical examples: https://github.com/rikusalminen/threedee-simd (work in progress)
Requires this: http://gruntthepeon.free.fr/ssemath/