~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/csky/abiv2/strcmp.S

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
  3 
  4 #include <linux/linkage.h>
  5 #include "sysdep.h"
  6 
  7 ENTRY(strcmp)
  8         mov     a3, a0
  9         /* Check if the s1 addr is aligned.  */
 10         xor     a2, a3, a1
 11         andi    a2, 0x3
 12         bnez    a2, 7f
 13         andi    t1, a0, 0x3
 14         bnez    t1, 5f
 15 
 16 1:
 17         /* If aligned, load word each time.  */
 18         ldw     t0, (a3, 0)
 19         ldw     t1, (a1, 0)
 20         /* If s1[i] != s2[i], goto 2f.  */
 21         cmpne   t0, t1
 22         bt      2f
 23         /* If s1[i] == s2[i], check if s1 or s2 is at the end.  */
 24         tstnbz  t0
 25         /* If at the end, goto 3f (finish comparing).  */
 26         bf      3f
 27 
 28         ldw     t0, (a3, 4)
 29         ldw     t1, (a1, 4)
 30         cmpne   t0, t1
 31         bt      2f
 32         tstnbz  t0
 33         bf      3f
 34 
 35         ldw     t0, (a3, 8)
 36         ldw     t1, (a1, 8)
 37         cmpne   t0, t1
 38         bt      2f
 39         tstnbz  t0
 40         bf      3f
 41 
 42         ldw     t0, (a3, 12)
 43         ldw     t1, (a1, 12)
 44         cmpne   t0, t1
 45         bt      2f
 46         tstnbz  t0
 47         bf      3f
 48 
 49         ldw     t0, (a3, 16)
 50         ldw     t1, (a1, 16)
 51         cmpne   t0, t1
 52         bt      2f
 53         tstnbz  t0
 54         bf      3f
 55 
 56         ldw     t0, (a3, 20)
 57         ldw     t1, (a1, 20)
 58         cmpne   t0, t1
 59         bt      2f
 60         tstnbz  t0
 61         bf      3f
 62 
 63         ldw     t0, (a3, 24)
 64         ldw     t1, (a1, 24)
 65         cmpne   t0, t1
 66         bt      2f
 67         tstnbz  t0
 68         bf      3f
 69 
 70         ldw     t0, (a3, 28)
 71         ldw     t1, (a1, 28)
 72         cmpne   t0, t1
 73         bt      2f
 74         tstnbz  t0
 75         bf      3f
 76 
 77         addi    a3, 32
 78         addi    a1, 32
 79 
 80         br      1b
 81 
 82 # ifdef __CSKYBE__
 83         /* d[i] != s[i] in word, so we check byte 0.  */
 84 2:
 85         xtrb0   a0, t0
 86         xtrb0   a2, t1
 87         subu    a0, a2
 88         bez     a2, 4f
 89         bnez    a0, 4f
 90 
 91         /* check byte 1 */
 92         xtrb1   a0, t0
 93         xtrb1   a2, t1
 94         subu    a0, a2
 95         bez     a2, 4f
 96         bnez    a0, 4f
 97 
 98         /* check byte 2 */
 99         xtrb2   a0, t0
100         xtrb2   a2, t1
101         subu    a0, a2
102         bez     a2, 4f
103         bnez    a0, 4f
104 
105         /* check byte 3 */
106         xtrb3   a0, t0
107         xtrb3   a2, t1
108         subu    a0, a2
109 # else
110         /* s1[i] != s2[i] in word, so we check byte 3.  */
111 2:
112         xtrb3   a0, t0
113         xtrb3   a2, t1
114         subu    a0, a2
115         bez     a2, 4f
116         bnez    a0, 4f
117 
118         /* check byte 2 */
119         xtrb2   a0, t0
120         xtrb2   a2, t1
121         subu    a0, a2
122         bez     a2, 4f
123         bnez    a0, 4f
124 
125         /* check byte 1 */
126         xtrb1   a0, t0
127         xtrb1   a2, t1
128         subu    a0, a2
129         bez     a2, 4f
130         bnez    a0, 4f
131 
132         /* check byte 0 */
133         xtrb0   a0, t0
134         xtrb0   a2, t1
135         subu    a0, a2
136 
137 # endif /* !__CSKYBE__ */
138         jmp     lr
139 3:
140         movi    a0, 0
141 4:
142         jmp     lr
143 
144         /* Compare when s1 or s2 is not aligned.  */
145 5:
146         subi    t1, 4
147 6:
148         ldb     a0, (a3, 0)
149         ldb     a2, (a1, 0)
150         subu    a0, a2
151         bez     a2, 4b
152         bnez    a0, 4b
153         addi    t1, 1
154         addi    a1, 1
155         addi    a3, 1
156         bnez    t1, 6b
157         br      1b
158 
159 7:
160         ldb     a0, (a3, 0)
161         addi    a3, 1
162         ldb     a2, (a1, 0)
163         addi    a1, 1
164         subu    a0, a2
165         bnez    a0, 4b
166         bnez    a2, 7b
167         jmp     r15
168 ENDPROC(strcmp)

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php