Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Sum 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


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: