diff options
author | dg <dg@FreeBSD.org> | 1995-12-27 18:54:51 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-12-27 18:54:51 +0000 |
commit | 6b2ff3fdc92df6ef62b6a3b5c0ece42a2ca0509d (patch) | |
tree | ebcd1b60671736efb79984a54c836a82cda93e7c /sys | |
parent | 092f38aea585d6cdfb5955a340362bb4a51fd2ff (diff) | |
download | FreeBSD-src-6b2ff3fdc92df6ef62b6a3b5c0ece42a2ca0509d.zip FreeBSD-src-6b2ff3fdc92df6ef62b6a3b5c0ece42a2ca0509d.tar.gz |
Update bcopyb & bcopy to reflect changes I made in the libc version of
bcopy:
Be smarter about handling overlapped copies and only go backwards if it
is really necessary. Going backwards on a P6 is much slower than forwards
and it's a little slower on a P5. Also moved the count mask and 'std'
down a few lines - it's a couple percent faster this way on a P5.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/support.S | 19 | ||||
-rw-r--r-- | sys/amd64/amd64/support.s | 19 | ||||
-rw-r--r-- | sys/i386/i386/support.s | 19 |
3 files changed, 36 insertions, 21 deletions
diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index 85f0a89..a158e54 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: support.s,v 1.28 1995/12/24 08:10:43 davidg Exp $ + * $Id: support.s,v 1.29 1995/12/26 13:58:11 bde Exp $ */ #include "assym.s" /* system definitions */ @@ -206,8 +206,10 @@ bcopyb: movl 12(%esp),%esi movl 16(%esp),%edi movl 20(%esp),%ecx - cmpl %esi,%edi /* potentially overlapping? */ - jnb 1f + movl %edi,%eax + subl %esi,%eax + cmpl %ecx,%eax /* overlapping? */ + jb 1f cld /* nope, copy forwards */ rep movsb @@ -219,9 +221,9 @@ bcopyb: 1: addl %ecx,%edi /* copy backwards. */ addl %ecx,%esi - std decl %edi decl %esi + std rep movsb popl %edi @@ -241,8 +243,11 @@ bcopy: movl 12(%esp),%esi movl 16(%esp),%edi movl 20(%esp),%ecx - cmpl %esi,%edi /* potentially overlapping? */ - jnb 1f + + movl %edi,%eax + subl %esi,%eax + cmpl %ecx,%eax /* overlapping? */ + jb 1f shrl $2,%ecx /* copy by 32-bit words */ cld /* nope, copy forwards */ rep @@ -259,9 +264,9 @@ bcopy: 1: addl %ecx,%edi /* copy backwards */ addl %ecx,%esi - andl $3,%ecx /* any fractional bytes? */ decl %edi decl %esi + andl $3,%ecx /* any fractional bytes? */ std rep movsb diff --git a/sys/amd64/amd64/support.s b/sys/amd64/amd64/support.s index 85f0a89..a158e54 100644 --- a/sys/amd64/amd64/support.s +++ b/sys/amd64/amd64/support.s @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: support.s,v 1.28 1995/12/24 08:10:43 davidg Exp $ + * $Id: support.s,v 1.29 1995/12/26 13:58:11 bde Exp $ */ #include "assym.s" /* system definitions */ @@ -206,8 +206,10 @@ bcopyb: movl 12(%esp),%esi movl 16(%esp),%edi movl 20(%esp),%ecx - cmpl %esi,%edi /* potentially overlapping? */ - jnb 1f + movl %edi,%eax + subl %esi,%eax + cmpl %ecx,%eax /* overlapping? */ + jb 1f cld /* nope, copy forwards */ rep movsb @@ -219,9 +221,9 @@ bcopyb: 1: addl %ecx,%edi /* copy backwards. */ addl %ecx,%esi - std decl %edi decl %esi + std rep movsb popl %edi @@ -241,8 +243,11 @@ bcopy: movl 12(%esp),%esi movl 16(%esp),%edi movl 20(%esp),%ecx - cmpl %esi,%edi /* potentially overlapping? */ - jnb 1f + + movl %edi,%eax + subl %esi,%eax + cmpl %ecx,%eax /* overlapping? */ + jb 1f shrl $2,%ecx /* copy by 32-bit words */ cld /* nope, copy forwards */ rep @@ -259,9 +264,9 @@ bcopy: 1: addl %ecx,%edi /* copy backwards */ addl %ecx,%esi - andl $3,%ecx /* any fractional bytes? */ decl %edi decl %esi + andl $3,%ecx /* any fractional bytes? */ std rep movsb diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s index 85f0a89..a158e54 100644 --- a/sys/i386/i386/support.s +++ b/sys/i386/i386/support.s @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: support.s,v 1.28 1995/12/24 08:10:43 davidg Exp $ + * $Id: support.s,v 1.29 1995/12/26 13:58:11 bde Exp $ */ #include "assym.s" /* system definitions */ @@ -206,8 +206,10 @@ bcopyb: movl 12(%esp),%esi movl 16(%esp),%edi movl 20(%esp),%ecx - cmpl %esi,%edi /* potentially overlapping? */ - jnb 1f + movl %edi,%eax + subl %esi,%eax + cmpl %ecx,%eax /* overlapping? */ + jb 1f cld /* nope, copy forwards */ rep movsb @@ -219,9 +221,9 @@ bcopyb: 1: addl %ecx,%edi /* copy backwards. */ addl %ecx,%esi - std decl %edi decl %esi + std rep movsb popl %edi @@ -241,8 +243,11 @@ bcopy: movl 12(%esp),%esi movl 16(%esp),%edi movl 20(%esp),%ecx - cmpl %esi,%edi /* potentially overlapping? */ - jnb 1f + + movl %edi,%eax + subl %esi,%eax + cmpl %ecx,%eax /* overlapping? */ + jb 1f shrl $2,%ecx /* copy by 32-bit words */ cld /* nope, copy forwards */ rep @@ -259,9 +264,9 @@ bcopy: 1: addl %ecx,%edi /* copy backwards */ addl %ecx,%esi - andl $3,%ecx /* any fractional bytes? */ decl %edi decl %esi + andl $3,%ecx /* any fractional bytes? */ std rep movsb |