1/*
2 * memcmp - compare memory
3 *
4 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 * See https://llvm.org/LICENSE.txt for license information.
6 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 */
8
9#if __ARM_FEATURE_SVE
10/* Assumptions:
11 *
12 * ARMv8-a, AArch64
13 * SVE Available.
14 */
15
16 .arch armv8-a+sve
17 .text
18
19 .globl __memcmp_aarch64_sve
20 .type __memcmp_aarch64_sve, %function
21 .p2align 4
22__memcmp_aarch64_sve:
23 mov x3, 0 /* initialize off */
24
250: whilelo p0.b, x3, x2 /* while off < max */
26 b.none 9f
27
28 ld1b z0.b, p0/z, [x0, x3] /* read vectors bounded by max. */
29 ld1b z1.b, p0/z, [x1, x3]
30
31 /* Increment for a whole vector, even if we've only read a partial.
32 This is significantly cheaper than INCP, and since OFF is not
33 used after the loop it is ok to increment OFF past MAX. */
34 incb x3
35
36 cmpne p1.b, p0/z, z0.b, z1.b /* while no inequalities */
37 b.none 0b
38
39 /* Found inequality. */
401: brkb p1.b, p0/z, p1.b /* find first such */
41 lasta w0, p1, z0.b /* extract each byte */
42 lasta w1, p1, z1.b
43 sub x0, x0, x1 /* return comparison */
44 ret
45
46 /* Found end-of-count. */
479: mov x0, 0 /* return equality */
48 ret
49
50 .size __memcmp_aarch64_sve, . - __memcmp_aarch64_sve
51#endif
52

source code of libc/AOR_v20.02/string/aarch64/memcmp-sve.S