1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Taken from Linux arch/riscv/lib/strncmp.S
6 #include <linux/linkage.h>
15 * a0 - comparison result, like strncmp
20 * a2 - number of characters to compare
23 * t0, t1, t2, t3, t4, t5, t6
32 /* Adjust limit for fast-path. */
35 /* Main loop for aligned string. */
50 * Words don't match, and no null byte in the first
51 * word. Get bytes in big-endian order and compare.
53 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
58 /* Synthesize (t0 >= t1) ? 1 : -1 in a branchless sequence. */
67 * If words don't match, fall back to simple loop.
71 /* Otherwise, strings are equal. */
75 /* Simple loop for misaligned strings. */