1 ! Copyright (C) 2013 Imagination Technologies Ltd.
3 ! Licensed under LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
10 .type _strcmp,function
17 ADD D1Re0,D1Re0,#0x0101
19 GETD D1Ar3,[D1Ar1+#4++] ! Load 32-bits from s1
20 GETD D1Ar5,[D0Ar2+#4++] ! Load 32-bits from s2
21 LSL D0FrT,D1Re0,#7 ! D0FrT = 0x80808080
23 SUB D0Re0,D1Ar3,D1Re0 ! D1Re0 = 0x01010101
25 SUBS D0Ar4,D1Ar3,D1Ar5 ! Calculate difference
27 GETD D1Ar3,[D1Ar1+#4++] ! Load 32-bits from s1
29 ANDSZ D0Ar6,D0Re0,D0FrT ! D0FrT = 0x80808080
30 GETD D1Ar5,[D0Ar2+#4++] ! Load 32-bits from s2
32 AND D0Ar6, D0Re0, D0FrT ! D0FrT = 0x80808080
34 ! Either they are different or they both contain a NULL + junk
37 LSLS D0Re0,D0Ar4,#24 ! Was Byte[0] the same?
38 LSLSZ D0Ar2,D0Ar6,#24 ! Yes: AND they where not zero?
39 LSLSZ D0Re0,D0Ar4,#16 ! Yes: Was Byte[1] the same?
40 LSLSZ D0Ar2,D0Ar6,#16 ! Yes: AND they where not zero?
41 LSLSZ D0Re0,D0Ar4,#8 ! Tes: Was Byte[2] the same?
42 LSLSZ D0Ar2,D0Ar6,#8 ! Yes: AND they where not zero?
43 MOVZ D0Re0,D0Ar4 ! Yes: Must by Byte[3] thats the result
44 ASR D0Re0,D0Re0,#24 ! Sign extend result to integer
47 ! Misaligned case, byte at a time
50 GETB D1Ar3,[D1Ar1++] ! Load char from s1
51 GETB D1Ar5,[D0Ar2++] ! Load char from s2
52 CMP D1Ar3,#1 ! Null -> C and NZ, rest -> NC (\1->Z)
53 CMPNC D1Ar3,D1Ar5 ! NOT Null: Same -> Z, else -> NZ
54 BZ $Lstrcmp_slow ! NOT Null and Same: Loop
55 SUB D0Re0,D1Ar3,D1Ar5 ! Generate result
58 .size _strcmp,.-_strcmp
61 libc_hidden_def(strcmp)
62 #ifndef __UCLIBC_HAS_LOCALE__
63 strong_alias(strcmp,strcoll)
64 libc_hidden_def(strcoll)