1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2005-2017 Andes Technology Corporation
5 beq $r1, $r0, quit_memcpy
7 srli $r3, $r2, #5 ! check if len < cache-line size 32
8 beqz $r3, word_copy_entry
9 andi $r4, $r0, #0x3 ! check byte-align
10 beqz $r4, unalign_word_copy_entry
13 abs $r4, $r4 ! check how many un-align byte to copy
14 sub $r2, $r2, $r4 ! update $R2
20 bnez $r4, unalign_byte_copy
23 unalign_word_copy_entry:
24 andi $r3, $r0, 0x1f ! check cache-line unaligncount
29 sub $r2, $r2, $r3 ! update $R2
35 bnez $r3, unalign_word_copy
38 addi $r3, $r2, #-32 ! to check $r2< cache_line , than go to word_copy
39 bltz $r3, word_copy_entry
42 beqz $r3, word_copy_entry