arcv: CRC32 for RV32 using clmulr - #311
Open
exur00 wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
https://lkml.org/lkml/2024/6/21/204 the linux kernel also has this in assembly performance goes from +- 17 cycles/byte to +- 1 cycle per byte for RHX100 |
exur00
force-pushed
the
loeka/crc
branch
4 times, most recently
from
August 4, 2026 09:26
dbc47a5 to
8644a1a
Compare
Contributor
Author
|
I think the same could work for crc64 on rv64, but I am not a crc expert, and I can't immediately find a source about it. So I'll leave it for this, don't want to make any mistakes in checksums. |
Contributor
Author
|
let's wait to merge this for the first jenkins run on the gcc16 arc-2026.09 |
luismgsilva
approved these changes
Aug 4, 2026
As shown in the code snippet in the RISC-V bitmanip spec v0.93 in section 2.8. It is not present in the ratified spec, but the clmulr definition has not changed between them. This significantly improves performance for rv32 processors that have the zbc extension. __builtin_rev_crc32_data32 (crc, data, poly) on rv32_zbc now generates: li a4,-150925312 xor a0,a0,a1 addi a4,a4,1601 li a5,-306675712 clmul a0,a0,a4 addi a5,a5,800 clmulr a0,a0,a5 which is more compact and faster than the previous approach which generates more than 300 lines of assembly and table data. Signed-off-by: Loeka Rogge <loeka.rogge@globalfoundries.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As shown in the code snippet in the RISC-V bitmanip spec v0.93 in section 2.8. It is not present in the ratified spec, but the clmulr definition has not changed between them.
This significantly improves performance for rv32 processors that have the zbc extension.
__builtin_rev_crc32_data32 (crc, data, poly) on rv32_zbc now generates:
li a4,-150925312
xor a0,a0,a1
addi a4,a4,1601
li a5,-306675712
clmul a0,a0,a4
addi a5,a5,800
clmulr a0,a0,a5
which is more compact and faster than the previous approach which generates more than 300 lines of assembly and table data.