Path: blob/main/contrib/arm-optimized-routines/string/aarch64/experimental/memcmp-sve.S
39507 views
/*1* memcmp - compare memory2*3* Copyright (c) 2018-2022, Arm Limited.4* SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception5*/67#include "asmdefs.h"89.arch armv8-a+sve1011/* Assumptions:12*13* ARMv8-a, AArch6414* SVE Available.15*/1617ENTRY (__memcmp_aarch64_sve)18mov x3, 0 /* initialize off */19200: whilelo p0.b, x3, x2 /* while off < max */21b.none 9f2223ld1b z0.b, p0/z, [x0, x3] /* read vectors bounded by max. */24ld1b z1.b, p0/z, [x1, x3]2526/* Increment for a whole vector, even if we've only read a partial.27This is significantly cheaper than INCP, and since OFF is not28used after the loop it is ok to increment OFF past MAX. */29incb x33031cmpne p1.b, p0/z, z0.b, z1.b /* while no inequalities */32b.none 0b3334/* Found inequality. */351: brkb p1.b, p0/z, p1.b /* find first such */36lasta w0, p1, z0.b /* extract each byte */37lasta w1, p1, z1.b38sub x0, x0, x1 /* return comparison */39ret4041/* Found end-of-count. */429: mov x0, 0 /* return equality */43ret4445END (__memcmp_aarch64_sve)464748