mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-17 15:27:36 +00:00
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.
This commit is contained in:
parent
aacd7f348e
commit
014374187c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13065
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user