2 * Accelerated CRC32(C) using AArch64 CRC instructions
4 * Copyright (C) 2016 - 2018 Linaro Ltd <ard.biesheuvel@linaro.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/linkage.h>
12 #include <asm/alternative.h>
13 #include <asm/assembler.h>
19 b.lt 8f // less than 16 bytes
23 cbz x7, 32f // multiple of 32 bytes
36 crc32\c\()x w8, w0, x3
41 crc32\c\()w w8, w0, w3
46 crc32\c\()h w8, w0, w3
50 crc32\c\()b w8, w0, w3
53 crc32\c\()x w8, w0, x5
54 crc32\c\()x w8, w8, x6
58 32: ldp x3, x4, [x1], #32
60 ldp x5, x6, [x1, #-16]
65 crc32\c\()x w0, w0, x3
66 crc32\c\()x w0, w0, x4
67 crc32\c\()x w0, w0, x5
68 crc32\c\()x w0, w0, x6
75 crc32\c\()x w0, w0, x3
79 crc32\c\()w w0, w0, w3
82 CPU_BE( rev16 w3, w3 )
83 crc32\c\()h w0, w0, w3
86 crc32\c\()b w0, w0, w3
92 alternative_if_not ARM64_HAS_CRC32
94 alternative_else_nop_endif
100 alternative_if_not ARM64_HAS_CRC32
102 alternative_else_nop_endif