sparc: Regenerate ULPs
[glibc.git] / sysdeps / csky / abiv2 / strcpy.S
blob0ad32d715b584c0676aa1928c645aa07877f6f37
1 /* The assembly function for string copy.  C-SKY ABIV2 version.
2    Copyright (C) 2018-2024 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library.  If not, see
17    <https://www.gnu.org/licenses/>.  */
19 #include <sysdep.h>
21 ENTRY (strcpy)
22         mov     a3, a0
23         /* Check if the src addr is aligned.  */
24         andi    t0, a1, 3
25         bnez    t0, 11f
27         /* Check if all the bytes in the word are not zero.  */
28         ldw     a2, (a1)
29         tstnbz  a2
30         bf      9f
31         stw     a2, (a3)
33         ldw     a2, (a1, 4)
34         tstnbz  a2
35         bf      2f
36         stw     a2, (a3, 4)
38         ldw     a2, (a1, 8)
39         tstnbz  a2
40         bf      3f
41         stw     a2, (a3, 8)
43         ldw     a2, (a1, 12)
44         tstnbz  a2
45         bf      4f
46         stw     a2, (a3, 12)
48         ldw     a2, (a1, 16)
49         tstnbz  a2
50         bf      5f
51         stw     a2, (a3, 16)
53         ldw     a2, (a1, 20)
54         tstnbz  a2
55         bf      6f
56         stw     a2, (a3, 20)
58         ldw     a2, (a1, 24)
59         tstnbz  a2
60         bf      7f
61         stw     a2, (a3, 24)
63         ldw     a2, (a1, 28)
64         tstnbz  a2
65         bf      8f
66         stw     a2, (a3, 28)
68         addi    a3, 32
69         addi    a1, 32
70         br      1b
73         addi    a3, 4
74         br      9f
77         addi    a3, 8
78         br      9f
81         addi    a3, 12
82         br      9f
85         addi    a3, 16
86         br      9f
89         addi    a3, 20
90         br      9f
93         addi    a3, 24
94         br      9f
97         addi    a3, 28
99         xtrb3   t0, a2
100         st.b    t0, (a3)
101         bez     t0, 10f
102         xtrb2   t0, a2
103         st.b    t0, (a3, 1)
104         bez     t0, 10f
105         xtrb1   t0, a2
106         st.b    t0, (a3, 2)
107         bez     t0, 10f
108         stw     a2, (a3)
110         jmp     lr
113         subi    t0, 4
115         ld.b    a2, (a1)
116         st.b    a2, (a3)
117         bez     a2, 10b
118         addi    t0, 1
119         addi    a1, a1, 1
120         addi    a3, a3, 1
121         bnez    t0, 12b
122         br      1b
124 END (strcpy)
126 libc_hidden_def (strcpy)
127 .weak strcpy