Loading...
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/linkage.h>
10
11ENTRY(memcpy)
12 or r3,r0,r1
13 asl_s r3,r3,30
14 mov_s r5,r0
15 brls.d r2,r3,.Lcopy_bytewise
16 sub.f r3,r2,1
17 ld_s r12,[r1,0]
18 asr.f lp_count,r3,3
19 bbit0.d r3,2,.Lnox4
20 bmsk_s r2,r2,1
21 st.ab r12,[r5,4]
22 ld.a r12,[r1,4]
23.Lnox4:
24 lppnz .Lendloop
25 ld_s r3,[r1,4]
26 st.ab r12,[r5,4]
27 ld.a r12,[r1,8]
28 st.ab r3,[r5,4]
29.Lendloop:
30 breq r2,0,.Last_store
31 ld r3,[r5,0]
32#ifdef __LITTLE_ENDIAN__
33 add3 r2,-1,r2
34 ; uses long immediate
35 xor_s r12,r12,r3
36 bmsk r12,r12,r2
37 xor_s r12,r12,r3
38#else /* BIG ENDIAN */
39 sub3 r2,31,r2
40 ; uses long immediate
41 xor_s r3,r3,r12
42 bmsk r3,r3,r2
43 xor_s r12,r12,r3
44#endif /* ENDIAN */
45.Last_store:
46 j_s.d [blink]
47 st r12,[r5,0]
48
49 .balign 4
50.Lcopy_bytewise:
51 jcs [blink]
52 ldb_s r12,[r1,0]
53 lsr.f lp_count,r3
54 bhs_s .Lnox1
55 stb.ab r12,[r5,1]
56 ldb.a r12,[r1,1]
57.Lnox1:
58 lppnz .Lendbloop
59 ldb_s r3,[r1,1]
60 stb.ab r12,[r5,1]
61 ldb.a r12,[r1,2]
62 stb.ab r3,[r5,1]
63.Lendbloop:
64 j_s.d [blink]
65 stb r12,[r5,0]
66END(memcpy)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
4 */
5
6#include <linux/linkage.h>
7
8ENTRY_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]
45
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]
63END_CFI(memcpy)