public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFC/RFA] [PATCH 06/12] aarch64: Implement new expander for efficient CRC computation
@ 2024-05-24  8:42 Mariam Arutunian
  2024-06-08 11:41 ` Richard Sandiford
  0 siblings, 1 reply; 3+ messages in thread
From: Mariam Arutunian @ 2024-05-24  8:42 UTC (permalink / raw)
  To: GCC Patches


[-- Attachment #1.1: Type: text/plain, Size: 2437 bytes --]

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 pmul or crc32 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 pmul (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). If the conditions are met,
it emits calls to the corresponding crc32 instruction (crc32b, crc32h,
crc32w, or crc32x depending on the data size).
If the target does not support crc32 but supports pmul, it then uses the
pmul (crypto_pmulldi) instruction for bit-reversed CRC computation.

Otherwise table-based CRC is generated.

  gcc/config/aarch64/

    * aarch64-protos.h (aarch64_expand_crc_using_clmul): New extern
function declaration.
    (aarch64_expand_reversed_crc_using_clmul):  Likewise.
    * aarch64.cc (aarch64_expand_crc_using_clmul): New function.
    (aarch64_expand_reversed_crc_using_clmul):  Likewise.
    * aarch64.md (UNSPEC_CRC, UNSPEC_CRC_REV):  New unspecs.
    (crc_rev<ALLI:mode><ALLX:mode>4): New expander for reversed CRC.
    (crc<ALLI:mode><ALLX:mode>4): New expander for reversed CRC.
    * iterators.md (crc_data_type): New mode attribute.

  gcc/testsuite/gcc.target/aarch64/

    * crc-1-pmul.c: Likewise.
    * 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: New test.
    * crc-crc32-data32.c: Likewise.
    * crc-crc32-data8.c: Likewise.

Signed-off-by: Mariam Arutunian <mariamarutunian@gmail.com

[-- Attachment #2: 0006-aarch64-Implement-new-expander-for-efficient-CRC-com.patch --]
[-- Type: application/x-patch, Size: 25626 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-19 15:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-24  8:42 [RFC/RFA] [PATCH 06/12] aarch64: Implement new expander for efficient CRC computation Mariam Arutunian
2024-06-08 11:41 ` Richard Sandiford
2024-06-19 15:20   ` Mariam Arutunian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).