diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-09-10 19:04:24 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-09-10 19:04:24 -0400 |
commit | 2bf469310de6793228c103691859ed4d3158b117 (patch) | |
tree | b292372faf231031dbe9404efb081fdf341ff719 /src/string/x86_64 | |
parent | a9555a995cea8aa67da571c95af61109140f2c8d (diff) | |
download | musl-2bf469310de6793228c103691859ed4d3158b117.tar.gz musl-2bf469310de6793228c103691859ed4d3158b117.tar.xz musl-2bf469310de6793228c103691859ed4d3158b117.zip |
asm for memmove on i386 and x86_64
for the sake of simplicity, I've only used rep movsb rather than breaking up the copy for using rep movsd/q. on all modern cpus, this seems to be fine, but if there are performance problems, there might be a need to go back and add support for rep movsd/q.
Diffstat (limited to 'src/string/x86_64')
-rw-r--r-- | src/string/x86_64/memmove.s | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/string/x86_64/memmove.s b/src/string/x86_64/memmove.s new file mode 100644 index 00000000..247f0ac3 --- /dev/null +++ b/src/string/x86_64/memmove.s @@ -0,0 +1,15 @@ +.global memmove +.type memmove,@function +memmove: + mov %rdi,%rax + sub %rsi,%rax + cmp %rdx,%rax + jae memcpy + mov %rdx,%rcx + lea -1(%rdi,%rdx),%rdi + lea -1(%rsi,%rdx),%rsi + std + rep movsb + cld + lea 1(%rdi),%rax + ret |