Merge branch 'work.splice_read' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / arch / arc / lib / memcpy-700.S
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
11 ENTRY_CFI(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]
66 END_CFI(memcpy)