Commit | Line | Data |
---|---|---|
479ba603 RG |
1 | /* |
2 | * Copyright 2005-2010 Analog Devices Inc. | |
3 | * | |
de450838 | 4 | * Licensed under the Clear BSD license or the GPL-2 (or later) |
479ba603 RG |
5 | */ |
6 | ||
7 | #include <linux/linkage.h> | |
8 | ||
9 | /* void *strcmp(char *s1, const char *s2); | |
10 | * R0 = address (s1) | |
11 | * R1 = address (s2) | |
12 | * | |
13 | * Returns an integer less than, equal to, or greater than zero if s1 | |
14 | * (or the first n bytes thereof) is found, respectively, to be less | |
15 | * than, to match, or be greater than s2. | |
16 | */ | |
17 | ||
18 | #ifdef CONFIG_STRCMP_L1 | |
19 | .section .l1.text | |
20 | #else | |
21 | .text | |
22 | #endif | |
23 | ||
24 | .align 2 | |
25 | ||
26 | ENTRY(_strcmp) | |
27 | P0 = R0 ; /* s1 */ | |
28 | P1 = R1 ; /* s2 */ | |
29 | ||
30 | 1: | |
31 | R0 = B[P0++] (Z); /* get *s1 */ | |
32 | R1 = B[P1++] (Z); /* get *s2 */ | |
33 | CC = R0 == R1; /* compare a byte */ | |
34 | if ! cc jump 2f; /* not equal, break out */ | |
35 | CC = R0; /* at end of s1? */ | |
36 | if cc jump 1b (bp); /* no, keep going */ | |
37 | jump.s 3f; /* strings are equal */ | |
38 | 2: | |
39 | R0 = R0 - R1; /* *s1 - *s2 */ | |
40 | 3: | |
41 | RTS; | |
42 | ||
43 | ENDPROC(_strcmp) |