2 * Copyright (C) 2013 Regents of the University of California
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #include <linux/linkage.h>
17 /* void *memcpy(void *, const void *, size_t) */
19 move t6, a0 /* Preserve return value */
21 /* Defer to byte-oriented copy for small sizes */
24 /* Use word-oriented copy only if low-order bits match */
29 beqz a3, 2f /* Skip if already aligned */
31 * Round to nearest double word-aligned address
32 * greater than or equal to start address
34 andi a3, a1, ~(SZREG-1)
36 /* Handle initial misalignment */
44 sub a2, a2, a4 /* Update count */
47 andi a4, a2, ~((16*SZREG)-1)
71 REG_L a4, 10*SZREG(a1)
72 REG_L a5, 11*SZREG(a1)
73 REG_L a6, 12*SZREG(a1)
74 REG_L a7, 13*SZREG(a1)
75 REG_L t0, 14*SZREG(a1)
76 REG_L t1, 15*SZREG(a1)
78 REG_S a4, 10*SZREG(t6)
79 REG_S a5, 11*SZREG(t6)
80 REG_S a6, 12*SZREG(t6)
81 REG_S a7, 13*SZREG(t6)
82 REG_S t0, 14*SZREG(t6)
83 REG_S t1, 15*SZREG(t6)
86 andi a2, a2, (16*SZREG)-1 /* Update count */
89 /* Handle trailing misalignment */
93 /* Use word-oriented copy if co-aligned to word boundary */