changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > plan9front / sys/src/libc/arm64/memmove.s

changeset 7218: 0e07d7fce9f3
child: f6786e3ba3da
author: cinap_lenrek@felloff.net
date: Thu, 09 May 2019 02:32:09 +0200
permissions: -rw-r--r--
description: libc: provide arm64 assembly versions for memmove() and memset()

just a first approximation, uses unaligned 8 byte loads and stores.
MOVP not yet implemented by the linker. no ZVA cache magic yet.
1 TEXT memcpy(SB), $-4
2 TEXT memmove(SB), $-4
3  MOV from+8(FP), R1
4  MOVWU n+16(FP), R2
5 
6  CMP R0, R1
7  BEQ _done
8  BLT _backward
9 
10 _forward:
11  ADD R0, R2, R3
12  BIC $7, R2, R4
13  CBZ R4, _floop1
14  ADD R0, R4, R4
15 
16 _floop8:
17  MOV (R1)8!, R5
18  MOV R5, (R0)8!
19  CMP R4, R0
20  BNE _floop8
21 
22 _floop1:
23  CMP R3, R0
24  BEQ _done
25  MOVBU (R1)1!, R5
26  MOVBU R5, (R0)1!
27  B _floop1
28 
29 _done:
30  RETURN
31 
32 _backward:
33  ADD R2, R1, R1
34  ADD R2, R0, R3
35  BIC $7, R2, R4
36  CBZ R4, _bloop1
37  SUB R4, R3, R4
38 
39 _bloop8:
40  MOV -8(R1)!, R5
41  MOV R5, -8(R3)!
42  CMP R4, R3
43  BNE _bloop8
44 
45 _bloop1:
46  CMP R0, R3
47  BEQ _done
48  MOVBU -1(R1)!, R5
49  MOVBU R5, -1(R3)!
50  B _bloop1