changelog shortlog tags branches changeset files revisions annotate raw help

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

changeset 7223: f6786e3ba3da
parent: 0e07d7fce9f3
child: 31f1de7ff0d4
author: cinap_lenrek@felloff.net
date: Thu, 09 May 2019 11:40:54 +0200
permissions: -rw-r--r--
description: libc: use MOVP instruction for arm64 memmove() and memset()
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 $15, R2, R4
13  CBZ R4, _floop1
14  ADD R0, R4, R4
15 
16 _floop16:
17  MOVP (R1)16!, R5, R6
18  MOVP R5, R6, (R0)16!
19  CMP R4, R0
20  BNE _floop16
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 $15, R2, R4
36  CBZ R4, _bloop1
37  SUB R4, R3, R4
38 
39 _bloop16:
40  MOVP -16(R1)!, R5, R6
41  MOVP R5, R6, -16(R3)!
42  CMP R4, R3
43  BNE _bloop16
44 
45 _bloop1:
46  CMP R0, R3
47  BEQ _done
48  MOVBU -1(R1)!, R5
49  MOVBU R5, -1(R3)!
50  B _bloop1