1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2013 Regents of the University of California
6 #include <linux/linkage.h>
9 /* void *memcpy(void *, const void *, size_t) */
12 move t6, a0 /* Preserve return value */
14 /* Defer to byte-oriented copy for small sizes */
17 /* Use word-oriented copy only if low-order bits match */
22 beqz a3, 2f /* Skip if already aligned */
24 * Round to nearest double word-aligned address
25 * greater than or equal to start address
27 andi a3, a1, ~(SZREG-1)
29 /* Handle initial misalignment */
37 sub a2, a2, a4 /* Update count */
40 andi a4, a2, ~((16*SZREG)-1)
64 REG_L a4, 10*SZREG(a1)
65 REG_L a5, 11*SZREG(a1)
66 REG_L a6, 12*SZREG(a1)
67 REG_L a7, 13*SZREG(a1)
68 REG_L t0, 14*SZREG(a1)
69 REG_L t1, 15*SZREG(a1)
71 REG_S a4, 10*SZREG(t6)
72 REG_S a5, 11*SZREG(t6)
73 REG_S a6, 12*SZREG(t6)
74 REG_S a7, 13*SZREG(t6)
75 REG_S t0, 14*SZREG(t6)
76 REG_S t1, 15*SZREG(t6)
79 andi a2, a2, (16*SZREG)-1 /* Update count */
82 /* Handle trailing misalignment */
86 /* Use word-oriented copy if co-aligned to word boundary */