1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
6 #include <asm/alternative-asm.h>
8 #include <asm/asmmacro.h>
10 #include <asm/export.h>
11 #include <asm/regdef.h>
13 SYM_FUNC_START(memcpy)
15 * Some CPUs support hardware unaligned access
17 ALTERNATIVE "b __memcpy_generic", \
18 "b __memcpy_fast", CPU_FEATURE_UAL
25 * void *__memcpy_generic(void *dst, const void *src, size_t n)
31 SYM_FUNC_START(__memcpy_generic)
44 SYM_FUNC_END(__memcpy_generic)
45 _ASM_NOKPROBE(__memcpy_generic)
48 SYM_FUNC_START_NOALIGN(__memcpy_small)
104 SYM_FUNC_END(__memcpy_small)
105 _ASM_NOKPROBE(__memcpy_small)
108 * void *__memcpy_fast(void *dst, const void *src, size_t n)
114 SYM_FUNC_START(__memcpy_fast)
116 bnez t0, __memcpy_small
123 /* align up destination address */
133 /* copy 64 bytes at a time */
153 bltu a1, a4, .Lloop64
155 /* copy the remaining bytes */
192 SYM_FUNC_END(__memcpy_fast)
193 _ASM_NOKPROBE(__memcpy_fast)