Linux 5.6.13
[linux/fpc-iii.git] / arch / arc / lib / memcpy-700.S
blobf2e239e219b2aad6c5cb8014d1c55551bf9fdecf
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
4  */
6 #include <linux/linkage.h>
8 ENTRY_CFI(memcpy)
9         or      r3,r0,r1
10         asl_s   r3,r3,30
11         mov_s   r5,r0
12         brls.d  r2,r3,.Lcopy_bytewise
13         sub.f   r3,r2,1
14         ld_s    r12,[r1,0]
15         asr.f   lp_count,r3,3
16         bbit0.d r3,2,.Lnox4
17         bmsk_s  r2,r2,1
18         st.ab   r12,[r5,4]
19         ld.a    r12,[r1,4]
20 .Lnox4:
21         lppnz   .Lendloop
22         ld_s    r3,[r1,4]
23         st.ab   r12,[r5,4]
24         ld.a    r12,[r1,8]
25         st.ab   r3,[r5,4]
26 .Lendloop:
27         breq    r2,0,.Last_store
28         ld      r3,[r5,0]
29 #ifdef __LITTLE_ENDIAN__
30         add3    r2,-1,r2
31         ; uses long immediate
32         xor_s   r12,r12,r3
33         bmsk    r12,r12,r2
34     xor_s       r12,r12,r3
35 #else /* BIG ENDIAN */
36         sub3    r2,31,r2
37         ; uses long immediate
38         xor_s   r3,r3,r12
39         bmsk    r3,r3,r2
40         xor_s   r12,r12,r3
41 #endif /* ENDIAN */
42 .Last_store:
43         j_s.d   [blink]
44         st      r12,[r5,0]
46         .balign 4
47 .Lcopy_bytewise:
48         jcs     [blink]
49         ldb_s   r12,[r1,0]
50         lsr.f   lp_count,r3
51         bhs_s   .Lnox1
52         stb.ab  r12,[r5,1]
53         ldb.a   r12,[r1,1]
54 .Lnox1:
55         lppnz   .Lendbloop
56         ldb_s   r3,[r1,1]
57         stb.ab  r12,[r5,1]
58         ldb.a   r12,[r1,2]
59         stb.ab  r3,[r5,1]
60 .Lendbloop:
61         j_s.d   [blink]
62         stb     r12,[r5,0]
63 END_CFI(memcpy)