changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > plan9front / sys/src/ape/lib/ap/arm64/memset.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 memset(SB), $-4
2  MOVBU c+8(FP), R1
3  MOVWU n+16(FP), R2
4 
5  ADD R0, R2, R3
6  BIC $7, R2, R4
7  CBZ R4, _loop1
8  ADD R0, R4, R4
9 
10  ORR R1<<8, R1
11  ORR R1<<16, R1
12  ORR R1<<32, R1
13 
14 _loop8:
15  MOV R1, (R0)8!
16  CMP R4, R0
17  BNE _loop8
18 
19 _loop1:
20  CMP R3, R0
21  BEQ _done
22 
23  MOVBU R1, (R0)1!
24  B _loop1
25 
26 _done:
27  RETURN