#include #include "memcpy_SSE2.h" // SSE2のmovdqu命令を用いて128bitずつデータを移動する void memcpy_sse2(void *src, void *dst, size_t size) { asm ("\n" " mov %0, %%eax\n" " lea (%%esi, %0), %%ebx\n" " ssecalc:\n" " movdqu (%%esi),%%xmm0\n" " lea 16(%%esi), %%esi \n" " movdqu %%xmm0,(%%edi)\n" " lea 16(%%edi), %%edi\n" " sub $16, %%eax\n" " cmp $16, %%eax\n" " jge ssecalc\n" " cmp %%ebx, %%esi\n" " je end\n" " normalcalc:\n" " mov (%%esi), %%al\n" " lea 1(%%esi), %%esi\n" " mov %%al, (%%edi)\n" " lea 1(%%edi), %%edi\n" " cmp %%ebx, %%esi\n" " jne normalcalc\n" " end:\n" " emms" :: "r" (size), "S" (src), "D" (dst)); }