diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2018-09-17 15:49:35 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2018-09-17 15:49:35 +0000 |
commit | 23ec0d58bf2008a8dfa6466f0c0dcc27c2312b0f (patch) | |
tree | 2e03e809308335de08a1ccc0b0285515d15fd8af /lib/libc/amd64 | |
parent | 09a6ada9919eac191b28e72fedfa9fa06e50b176 (diff) | |
download | src-23ec0d58bf2008a8dfa6466f0c0dcc27c2312b0f.tar.gz src-23ec0d58bf2008a8dfa6466f0c0dcc27c2312b0f.zip |
amd64: depessimize userspace memcpy/memmove/bcopy
The change resembles what was done in r334537 for kernel routines.
While here take care of i386 variants. Note that primitives remain
suboptimal.
Reviewed by: kib (previous version)
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D17167
Notes
Notes:
svn path=/head/; revision=338713
Diffstat (limited to 'lib/libc/amd64')
-rw-r--r-- | lib/libc/amd64/string/bcopy.S | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libc/amd64/string/bcopy.S b/lib/libc/amd64/string/bcopy.S index cc38f4755254..eca7a23d7721 100644 --- a/lib/libc/amd64/string/bcopy.S +++ b/lib/libc/amd64/string/bcopy.S @@ -66,6 +66,9 @@ ENTRY(bcopy) movsq movq %rdx,%rcx andq $7,%rcx /* any bytes left? */ + jne 2f + ret +2: rep movsb ret @@ -73,11 +76,13 @@ ENTRY(bcopy) addq %rcx,%rdi /* copy backwards. */ addq %rcx,%rsi std - andq $7,%rcx /* any fractional bytes? */ decq %rdi decq %rsi + andq $7,%rcx /* any fractional bytes? */ + je 3f rep movsb +3: movq %rdx,%rcx /* copy remainder by words */ shrq $3,%rcx subq $7,%rsi |