Skip to content

Instantly share code, notes, and snippets.

@zhaofeng-shu33
Last active April 10, 2020 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhaofeng-shu33/6edeac8a50a8a775af19db203cf40ae8 to your computer and use it in GitHub Desktop.
Save zhaofeng-shu33/6edeac8a50a8a775af19db203cf40ae8 to your computer and use it in GitHub Desktop.
#include <immintrin.h>
const int NUM = 1000000;
static float X[NUM], Y[NUM], Z[NUM];
void dig_hole() {
__m128 a,b,c;
for(int j = 0; j < 1000; j++) {
for(int i = 0; i < NUM; i += 4) {
a = _mm_load_ps(&X[i]);
b = _mm_load_ps(&Y[i]);
c = _mm_add_ps(a, b);
_mm_store_ps(&Z[i], c);
}
}
}
int main() {
dig_hole();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment