implement hardware CRC32 on ARM

Issue #330 resolved
Former user created an issue

Looks like 64-bit ARM can do hardware CRC32 and maybe hardware CRC32C: https://main.lv/writeup/arm64_assembly_crc32.md K.O.

Comments (3)

  1. Stefan Ritt

    I implemented this now for Apple M1 Arm processor. The code might also work on the Raspberry Pi, but I haven’t tried it. Might need an extra -march flag during compilation. Once tested, this issue can be closed.

  2. Ben Smith

    As Stefan predicted, the default build on my Pi 4B did not include CRC32 hardware support (so you get a compile-time warning that it isn’t available, but everything still compiles and runs okay).

    If I force CRC support with cmake -D CMAKE_CXX_FLAGS="-march=armv8-a+crc" .. then hardware support is included, and the following examples report the same hashes for HW and SW versions.

    $ echo "hello" | bin/crc32c_sum
    353dd8be
    $ echo "hello" | bin/crc32c_sum sw
    353dd8be
    $ cat src/midas.cxx | bin/crc32c_sum
    a637074b
    $ cat src/midas.cxx | bin/crc32c_sum sw
    a637074b
    

  3. Log in to comment