]> git.saurik.com Git - apple/libc.git/blob - i386/string/strcmp.s
Libc-391.2.3.tar.gz
[apple/libc.git] / i386 / string / strcmp.s
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 .text
24 .globl _strcmp
25 _strcmp:
26 movl 0x04(%esp),%eax
27 movl 0x08(%esp),%edx
28 jmp L2 /* Jump into the loop! */
29
30 .align 2,0x90
31 L1: incl %eax
32 incl %edx
33 L2: movb (%eax),%cl
34 testb %cl,%cl /* null terminator??? */
35 jz L3
36 cmpb %cl,(%edx) /* chars match??? */
37 jne L3
38 incl %eax
39 incl %edx
40 movb (%eax),%cl
41 testb %cl,%cl
42 jz L3
43 cmpb %cl,(%edx)
44 jne L3
45 incl %eax
46 incl %edx
47 movb (%eax),%cl
48 testb %cl,%cl
49 jz L3
50 cmpb %cl,(%edx)
51 jne L3
52 incl %eax
53 incl %edx
54 movb (%eax),%cl
55 testb %cl,%cl
56 jz L3
57 cmpb %cl,(%edx)
58 jne L3
59 incl %eax
60 incl %edx
61 movb (%eax),%cl
62 testb %cl,%cl
63 jz L3
64 cmpb %cl,(%edx)
65 jne L3
66 incl %eax
67 incl %edx
68 movb (%eax),%cl
69 testb %cl,%cl
70 jz L3
71 cmpb %cl,(%edx)
72 jne L3
73 incl %eax
74 incl %edx
75 movb (%eax),%cl
76 testb %cl,%cl
77 jz L3
78 cmpb %cl,(%edx)
79 jne L3
80 incl %eax
81 incl %edx
82 movb (%eax),%cl
83 testb %cl,%cl
84 jz L3
85 cmpb %cl,(%edx)
86 je L1
87 .align 2, 0x90
88 L3: movzbl (%eax),%eax /* unsigned comparison */
89 movzbl (%edx),%edx
90 subl %edx,%eax
91 ret