Memcopy by 8?

Alex K. (kolex@erols.com)
Sat, 15 May 1999 22:37:31 -0400


OK, here's my ideas for an optimization: in string-486.h in 2.2.8, the
memcpy function is either implemented into 3 separate functions: memcopy
by 4, 2, and 1 bytes. For this purpose, the number of bytes to be copied
is %ed by 4 and 2. I have two optimizations in mind:
1: Implement a memcpy by 8 for MMX machines that would use the MOVQ
command and an MMX register, and an analogous command on non-MMX
machines (for consistency) that would use a doubled long move.
2: Since the MOD is takes anyways, why not implement memcpy(to,from,n)
as this:
block copy (memcpy by 4 or 8) until n-n%{8,4 (depending on the
implementation)} and then memcpy by bytes for the rest of the array.
Wouldn't this be more efficient, esp. with optimization 1?
Can someone give me their opinion?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/