...before it will be too late:
static inline void *
vda_memcpy3(void * to, const void * from, size_t n)
{
int d0, d1, d2;
__asm__ __volatile__(
" andb $3, %b4\n" // we can save here a byte if %4 == eax
" rep; movsl\n"
" movb %b4, %%cl\n"
" rep; movsb\n"
: "=&c" (d0), "=&D" (d1), "=&S" (d2)
: "0" (n/4), "g" (n), "1" ((long) to), "2" ((long) from)
: "memory"
);
return (to);
}
Disassembly of section ff5:
00000000 <f5>:
0: a1 00 00 00 00 mov 0x0,%eax
5: 57 push %edi
6: 89 c1 mov %eax,%ecx
8: 56 push %esi
9: 8b 3d 00 00 00 00 mov 0x0,%edi
f: 8b 35 00 00 00 00 mov 0x0,%esi
15: c1 e9 02 shr $0x2,%ecx
18: 24 03 and $0x3,%al
1a: f3 a5 repz movsl %ds:(%esi),%es:(%edi)
1c: 88 c1 mov %al,%cl
1e: f3 a4 repz movsb %ds:(%esi),%es:(%edi)
20: 5e pop %esi
21: 5f pop %edi
22: c3 ret
;)))
-- vda - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/