7 static void *spin_snb(void *uu)
9 char __attribute__((aligned(32))) m[2][32];
11 asm("vpxor %%xmm1, %%xmm1, %%xmm1;\n"
12 "vpxor %%xmm2, %%xmm2, %%xmm2;\n"
14 "vmovaps (%0), %%ymm0;\n"
15 "vmovaps %%ymm1, (%1);\n"
16 "vaddps %%ymm1, %%ymm1, %%ymm2\n"
17 "vmulps %%ymm3, %%ymm3, %%ymm4\n"
18 "vmovaps (%0), %%ymm0;\n"
19 "vmovaps %%xmm1, (%1);\n"
20 "vaddps %%ymm1, %%ymm1, %%ymm2\n"
21 "vmulps %%ymm3, %%ymm3, %%ymm4\n"
22 "vmovaps (%0), %%ymm0;\n"
23 "vaddps %%ymm1, %%ymm1, %%ymm2\n"
24 "vmulps %%ymm3, %%ymm3, %%ymm4\n"
27 : "r" (&m[0]), "r" (&m[1])
32 static void *spin(void *uu)
38 int main(int argc, char **argv)
44 for(i = 0; i < n; i++) {
45 if(pthread_create(&threads[i], NULL, spin, NULL)) {
46 fprintf(stderr, "loadcpu: pthread_create: %s\n", strerror(errno));
50 pthread_join(threads[0], NULL);
56 * compile-command: "gcc -g -Wall -o loadcpu loadcpu.c -lpthread"