Skip to content

Instantly share code, notes, and snippets.

@trast
Created May 17, 2013 12:35
Show Gist options
  • Select an option

  • Save trast/5598743 to your computer and use it in GitHub Desktop.

Select an option

Save trast/5598743 to your computer and use it in GitHub Desktop.
typedef float v32float __attribute__((vector_size(32)));
v32float sqrt_v32float(v32float x) {
v32float r;
#ifdef __AVX__
__asm__ __volatile__ ("VSQRTPS %0, %1" : "=x"(r) : "xm"(x));
#else
int i;
for (i = 0; i < 8; i++)
r[i] = sqrtf(x[i]);
#endif
return r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment