Landing: e91f79891fc6
Project / Subsystem
gcc / risc-v
Date
2026-09-13
Author
Michiel Derhaeg
Commit
e91f79891fc657d48310f82da0da61eb4a0587ed
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- risc-v
- patch_id
- —
- commit_hash
- e91f79891fc657d48310f82da0da61eb4a0587ed
- source_type
- github
- headline
- RISC-V RV32 uses CLMULR for reversed CRC32, improving performance.
- tldr
- Optimizes reversed CRC32 calculation on RISC-V RV32 by using the CLMULR instruction, avoiding a slower table-based fallback.
- author
- Michiel Derhaeg
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • risc-v
- • optimization
- • compiler
- • crc32
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-09-13T00:00:00.000Z
This commit enhances the CRC32 calculation for the RISC-V 32-bit architecture (rv32) by utilizing the CLMULR instruction. Previously, calculating a reflected polynomial for 32-bit CRC required an operand that was 33 bits wide, exceeding register capacity and forcing a fallback to a less efficient table-based method. By leveraging the CLMULR instruction’s property to produce specific bits of a carry-less product, the compiler can now use the unshifted 32-bit reflected polynomial, resulting in a performance improvement for CRC32 operations on RV32 systems with the Zbc extension.