Lionel Sambuc 0a6a1f1d05 NetBSD re-synchronization of the source tree
This brings our tree to NetBSD 7.0, as found on -current on the
10-10-2015.

This updates:
 - LLVM to 3.6.1
 - GCC to GCC 5.1
 - Replace minix/commands/zdump with usr.bin/zdump
 - external/bsd/libelf has moved to /external/bsd/elftoolchain/
 - Import ctwm
 - Drop sprintf from libminc

Change-Id: I149836ac18e9326be9353958bab9b266efb056f0
2016-01-13 20:32:14 +01:00

109 lines
1.4 KiB
ArmAsm

/*
* Written by J.T. Conklin <jtc@NetBSD.org>.
* Public domain.
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: strncmp.S,v 1.4 2014/05/22 15:01:57 uebayasi Exp $")
#endif
/*
* NOTE: I've unrolled the loop eight times: large enough to make a
* significant difference, and small enough not to totally trash the
* cache.
*/
ENTRY(strncmp)
testq %rdx,%rdx
jmp L2 /* Jump into the loop! */
L1: incq %rdi
incq %rsi
decq %rdx
L2: jz L4 /* strings are equal */
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
je L1
L3: movzbl (%rdi),%eax /* unsigned comparison */
movzbl (%rsi),%ecx
subl %ecx,%eax
ret
L4: xorl %eax,%eax
ret
END(strncmp)