On 9/13/24 5:06 AM, Mariam Arutunian wrote:
This patch introduces two new expanders for the aarch64 backend,
dedicated to generate optimized code for CRC computations.
The new expanders are designed to leverage specific hardware capabilities to achieve faster CRC calculations, particularly using the crc32, crc32c and pmull instructions when supported by the target architecture.

Expander 1: Bit-Forward CRC (crc<ALLI:mode><ALLX:mode>4)
For targets that support pmul instruction (TARGET_AES),
the expander will generate code that uses the pmull (crypto_pmulldi) instruction for CRC computation.

Expander 2: Bit-Reversed CRC (crc_rev<ALLI:mode><ALLX:mode>4)
The expander first checks if the target supports the CRC32* instruction set (TARGET_CRC32) and the polynomial in use is 0x1EDC6F41 (iSCSI) or 0x04C11DB7 (HDLC). If the conditions are met, it emits calls to the corresponding crc32* instruction (depending on the data size and the polynomial). If the target does not support crc32* but supports pmull, it then uses the pmull (crypto_pmulldi) instruction for bit-reversed CRC computation.
Otherwise table-based CRC is generated.

   gcc/config/aarch64/

    * aarch64-protos.h (aarch64_expand_crc_using_pmull): New extern function declaration.
     (aarch64_expand_reversed_crc_using_pmull):  Likewise.
     * aarch64.cc (aarch64_expand_crc_using_pmull): New function.
     (aarch64_expand_reversed_crc_using_pmull):  Likewise.
    * aarch64.md (crc_rev<ALLI:mode><ALLX:mode>4): New expander for reversed CRC.
     (crc<ALLI:mode><ALLX:mode>4): New expander for bit-forward CRC.
     * iterators.md (crc_data_type): New mode attribute.

   gcc/testsuite/gcc.target/aarch64/

     * crc-1-pmul.c: New test.
     * crc-10-pmul.c: Likewise.
     * crc-12-pmul.c: Likewise.
     * crc-13-pmul.c: Likewise.
     * crc-14-pmul.c: Likewise.
     * crc-17-pmul.c: Likewise.
     * crc-18-pmul.c: Likewise.
     * crc-21-pmul.c: Likewise.
     * crc-22-pmul.c: Likewise.
     * crc-23-pmul.c: Likewise.
     * crc-4-pmul.c: Likewise.
     * crc-5-pmul.c: Likewise.
     * crc-6-pmul.c: Likewise.
     * crc-7-pmul.c: Likewise.
     * crc-8-pmul.c: Likewise.
     * crc-9-pmul.c: Likewise.
     * crc-CCIT-data16-pmul.c: Likewise.
     * crc-CCIT-data8-pmul.c: Likewise.
     * crc-coremark-16bitdata-pmul.c: Likewise.
     * crc-crc32-data16.c: Likewise.
     * crc-crc32-data32.c: Likewise.
     * crc-crc32-data8.c: Likewise.
     * crc-crc32c-data16.c: Likewise.
     * crc-crc32c-data32.c: Likewise.
     * crc-crc32c-data8.c: Likewise.
I believe you and Richard S have iterated on this. So assuming all prior issues Richard raised have been addressed, this is OK.
jeff

Reply via email to