summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjtc <jtc@NetBSD.org>1994-03-22 01:15:47 +0000
committerjtc <jtc@NetBSD.org>1994-03-22 01:15:47 +0000
commit98cbb217ac56c19aef9fd6fd4fecf9a8ae1f2a55 (patch)
tree4af72fb8a7c9eb405e9350f39dbf8d45d7ed1d80 /lib
parent46a09934d4e88aba8f3c200f72fd8fd8f642c762 (diff)
mem -> reg & reg->reg moves take the same time; so save a cycle by reading
the block length from the stack instead of caching it in a register.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/arch/i386/string/bcmp.S9
-rw-r--r--lib/libc/arch/i386/string/memcmp.S9
2 files changed, 8 insertions, 10 deletions
diff --git a/lib/libc/arch/i386/string/bcmp.S b/lib/libc/arch/i386/string/bcmp.S
index 239be1c2bf6..bb173202585 100644
--- a/lib/libc/arch/i386/string/bcmp.S
+++ b/lib/libc/arch/i386/string/bcmp.S
@@ -27,13 +27,13 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: bcmp.S,v 1.4 1994/03/12 01:39:55 jtc Exp $
+ * $Id: bcmp.S,v 1.5 1994/03/22 01:15:47 jtc Exp $
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS)
- RCSID("$Id: bcmp.S,v 1.4 1994/03/12 01:39:55 jtc Exp $")
+ RCSID("$Id: bcmp.S,v 1.5 1994/03/22 01:15:47 jtc Exp $")
#endif
/*
@@ -48,17 +48,16 @@ ENTRY(bcmp)
pushl %esi
movl 12(%esp),%edi
movl 16(%esp),%esi
- movl 20(%esp),%edx
xorl %eax,%eax /* clear return value */
cld /* set compare direction forward */
- movl %edx,%ecx /* compare by words */
+ movl 20(%esp),%ecx /* compare by words */
shrl $2,%ecx
repe
cmpsl
jne L1
- movl %edx,%ecx /* compare remainder by bytes */
+ movl 20(%esp),%ecx /* compare remainder by bytes */
andl $3,%ecx
repe
cmpsb
diff --git a/lib/libc/arch/i386/string/memcmp.S b/lib/libc/arch/i386/string/memcmp.S
index 49317a6498b..2f35ef5b380 100644
--- a/lib/libc/arch/i386/string/memcmp.S
+++ b/lib/libc/arch/i386/string/memcmp.S
@@ -27,13 +27,13 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: memcmp.S,v 1.5 1994/03/12 01:40:02 jtc Exp $
+ * $Id: memcmp.S,v 1.6 1994/03/22 01:15:49 jtc Exp $
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS)
- RCSID("$Id: memcmp.S,v 1.5 1994/03/12 01:40:02 jtc Exp $")
+ RCSID("$Id: memcmp.S,v 1.6 1994/03/22 01:15:49 jtc Exp $")
#endif
/*
@@ -48,16 +48,15 @@ ENTRY(memcmp)
pushl %esi
movl 12(%esp),%edi
movl 16(%esp),%esi
- movl 20(%esp),%edx
cld /* set compare direction forward */
- movl %edx,%ecx /* compare by words */
+ movl 20(%esp),%ecx /* compare by words */
shrl $2,%ecx
repe
cmpsl
jne L5 /* do we match so far? */
- movl %edx,%ecx /* compare remainder by bytes */
+ movl 20(%esp),%ecx /* compare remainder by bytes */
andl $3,%ecx
repe
cmpsb