The current design pattern for choosing CRC32 implementations has not scaled well to four architectures (x86, arm64, ppc64le, s390x).
- The code to choose the implementation at compile time is fragile, and confusing.
- It is difficult to understand why arm64 maps to X86_HOST since this label does not reflect that it also has a software implementation.
Here is the current list of files:
One proposal is to refactor based on features + architecture instead of just architecture:
In this scenario, the newer architectures (ppc64 and s390x) which only use hardware implementations, can continue to only use their respective hardware implementations. ARM64 can simply use the software version. On x86, both X86_CRC32 and SOFTWARE_CRC32 would be enabled since not all x86 machines have SSE 4.1.