1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Accelerated CRC32(C) using AArch64 CRC instructions
5 * Copyright (C) 2016 - 2018 Linaro Ltd <ard.biesheuvel@linaro.org>
8 #include <linux/linkage.h>
9 #include <asm/alternative.h>
10 #include <asm/assembler.h>
16 b.lt 8f // less than 16 bytes
20 cbz x7, 32f // multiple of 32 bytes
33 crc32\c\()x w8, w0, x3
38 crc32\c\()w w8, w0, w3
43 crc32\c\()h w8, w0, w3
47 crc32\c\()b w8, w0, w3
50 crc32\c\()x w8, w0, x5
51 crc32\c\()x w8, w8, x6
55 32: ldp x3, x4, [x1], #32
57 ldp x5, x6, [x1, #-16]
62 crc32\c\()x w0, w0, x3
63 crc32\c\()x w0, w0, x4
64 crc32\c\()x w0, w0, x5
65 crc32\c\()x w0, w0, x6
72 crc32\c\()x w0, w0, x3
76 crc32\c\()w w0, w0, w3
79 CPU_BE( rev16 w3, w3 )
80 crc32\c\()h w0, w0, w3
83 crc32\c\()b w0, w0, w3
88 SYM_FUNC_START(crc32_le)
89 alternative_if_not ARM64_HAS_CRC32
91 alternative_else_nop_endif
93 SYM_FUNC_END(crc32_le)
96 SYM_FUNC_START(__crc32c_le)
97 alternative_if_not ARM64_HAS_CRC32
99 alternative_else_nop_endif
101 SYM_FUNC_END(__crc32c_le)