2 * memset - fill memory with a constant byte
4 * Copyright (c) 2012-2022, Arm Limited.
5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
10 * ARMv8-a, AArch64, Advanced SIMD, unaligned accesses.
14 #if (defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED))
15 /* See memset-stub.c */
32 add dstend, dstin, count
40 /* Set 0..15 bytes. */
48 str valw, [dstend, -4]
53 strh valw, [dstend, -2]
56 /* Set 17..96 bytes. */
59 tbnz count, 6, L(set96)
67 /* Set 64..96 bytes. Write 64 bytes from the start and
68 32 bytes from the end. */
71 stp q0, q0, [dstin, 32]
72 stp q0, q0, [dstend, -32]
84 #ifndef SKIP_ZVA_CHECK
85 mrs zva_val, dczid_el0
86 and zva_val, zva_val, 31
87 cmp zva_val, 4 /* ZVA size is 64 bytes. */
93 sub count, dstend, dst /* Count is now 64 too large. */
94 sub count, count, 128 /* Adjust count and bias for loop. */
100 subs count, count, 64
102 stp q0, q0, [dstend, -64]
103 stp q0, q0, [dstend, -32]
107 sub count, dstend, dst /* Count is 16 too large. */
108 sub dst, dst, 16 /* Dst is biased by -32. */
109 sub count, count, 64 + 16 /* Adjust count and bias for loop. */
111 stp q0, q0, [dst, 32]
112 stp q0, q0, [dst, 64]!
113 subs count, count, 64
115 stp q0, q0, [dstend, -64]
116 stp q0, q0, [dstend, -32]