2 * memcmp - compare memory
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
19 .globl __memcmp_aarch64_sve
20 .type __memcmp_aarch64_sve, %function
23 mov x3, 0 /* initialize off */
25 0: whilelo p0.b, x3, x2 /* while off < max */
28 ld1b z0.b, p0/z, [x0, x3] /* read vectors bounded by max. */
29 ld1b z1.b, p0/z, [x1, x3]
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. */
36 cmpne p1.b, p0/z, z0.b, z1.b /* while no inequalities */
39 /* Found inequality. */
40 1: brkb p1.b, p0/z, p1.b /* find first such */
41 lasta w0, p1, z0.b /* extract each byte */
43 sub x0, x0, x1 /* return comparison */
46 /* Found end-of-count. */
47 9: mov x0, 0 /* return equality */
50 .size __memcmp_aarch64_sve, . - __memcmp_aarch64_sve