]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/i386/i686/strcmp.S
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / i386 / i686 / strcmp.S
CommitLineData
6923133b 1/* Highly optimized version for ix86, x>=6.
d4697bc9 2 Copyright (C) 1999-2014 Free Software Foundation, Inc.
6923133b
UD
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
5
6 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
6923133b
UD
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 14 Lesser General Public License for more details.
6923133b 15
41bdb6e2 16 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
6923133b
UD
19
20#include <sysdep.h>
21#include "asm-syntax.h"
22
2366713d 23#define PARMS 4 /* no space for saved regs */
3f02f778 24#define STR1 PARMS
2366713d 25#define STR2 STR1+4
6923133b
UD
26
27 .text
2366713d 28ENTRY (strcmp)
3f02f778
GM
29
30 movl STR1(%esp), %ecx
31 movl STR2(%esp), %edx
32
33L(oop): movb (%ecx), %al
6923133b 34 cmpb (%edx), %al
3f02f778 35 jne L(neq)
2fc08826 36 incl %ecx
6923133b
UD
37 incl %edx
38 testb %al, %al
3f02f778
GM
39 jnz L(oop)
40
6923133b 41 xorl %eax, %eax
2fc08826
GM
42 /* when strings are equal, pointers rest one beyond
43 the end of the NUL terminators. */
bc15410e 44 ret
3f02f778 45
dbda6079
UD
46L(neq): movl $1, %eax
47 movl $-1, %ecx
48 cmovbl %ecx, %eax
3f02f778 49
3f02f778 50 ret
2366713d 51END (strcmp)
85dd1003 52libc_hidden_builtin_def (strcmp)