Skip to content

Instantly share code, notes, and snippets.

@FrankNiemeyer
Created August 28, 2015 16:38
Show Gist options
  • Save FrankNiemeyer/41d78f5220ddcb68e452 to your computer and use it in GitHub Desktop.
Save FrankNiemeyer/41d78f5220ddcb68e452 to your computer and use it in GitHub Desktop.
static void Dot3SoaVectorized(float[] xs, float[] ys, float[] zs, float[] dp) {
for (var j = 0; j < reps; ++j) {
for (var i = 0; i < dp.Length; i += laneWidth) {
var x = new Vector<float>(xs, i);
var y = new Vector<float>(ys, i);
var z = new Vector<float>(zs, i);
var d = x * x + y * y + z * z;
d.CopyTo(dp, i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment