2 * memset - fill memory with a constant byte
4 * Copyright (c) 2012-2020, Arm Limited.
5 * SPDX-License-Identifier: MIT
10 * ARMv8-a, AArch64, Advanced SIMD, unaligned accesses.
23 .type memset,%function
27 add dstend, dstin, count
35 /* Set 0..15 bytes. */
43 str valw, [dstend, -4]
48 strh valw, [dstend, -2]
51 /* Set 17..96 bytes. */
54 tbnz count, 6, .Lset96
62 /* Set 64..96 bytes. Write 64 bytes from the start and
63 32 bytes from the end. */
66 stp q0, q0, [dstin, 32]
67 stp q0, q0, [dstend, -32]
79 #ifndef SKIP_ZVA_CHECK
80 mrs zva_val, dczid_el0
81 and zva_val, zva_val, 31
82 cmp zva_val, 4 /* ZVA size is 64 bytes. */
88 sub count, dstend, dst /* Count is now 64 too large. */
89 sub count, count, 128 /* Adjust count and bias for loop. */
97 stp q0, q0, [dstend, -64]
98 stp q0, q0, [dstend, -32]
102 sub count, dstend, dst /* Count is 16 too large. */
103 sub dst, dst, 16 /* Dst is biased by -32. */
104 sub count, count, 64 + 16 /* Adjust count and bias for loop. */
106 stp q0, q0, [dst, 32]
107 stp q0, q0, [dst, 64]!
108 subs count, count, 64
110 stp q0, q0, [dstend, -64]
111 stp q0, q0, [dstend, -32]
114 .size memset,.-memset