blob: 3222573e50de6aebce1837152c91f7f209d029bd [file] [log] [blame]
Vineet Gupta5210d1e2013-01-18 15:12:18 +05301/*
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
Vineet Guptaec7ac6a2014-02-07 13:47:43 +05309#include <linux/linkage.h>
Vineet Gupta5210d1e2013-01-18 15:12:18 +053010
Vineet Guptaec7ac6a2014-02-07 13:47:43 +053011ENTRY(memcpy)
Vineet Gupta5210d1e2013-01-18 15:12:18 +053012 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]
Vineet Guptaec7ac6a2014-02-07 13:47:43 +053066END(memcpy)