public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFC/RFA] [PATCH 01/12] Implement internal functions for efficient CRC computation
@ 2024-05-24  8:41 Mariam Arutunian
  2024-05-25 17:40 ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Mariam Arutunian @ 2024-05-24  8:41 UTC (permalink / raw)
  To: GCC Patches


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

Add two new internal functions (IFN_CRC, IFN_CRC_REV), to provide faster
CRC generation.
One performs bit-forward and the other bit-reversed CRC computation.
If CRC optabs are supported, they are used for the CRC computation.
Otherwise, table-based CRC is generated.
The supported data and CRC sizes are 8, 16, 32, and 64 bits.
The polynomial is without the leading 1.
A table with 256 elements is used to store precomputed CRCs.
For the reflection of inputs and the output, a simple algorithm involving
SHIFT, AND, and OR operations is used.

Co-authored-by: Joern Rennecke <joern.rennecke@embecosm.com>

gcc/

   * doc/md.texi (crc@var{m}@var{n}4,
   crc_rev@var{m}@var{n}4): Document.
   * expr.cc (generate_crc_table): New function.
   (calculate_table_based_CRC): Likewise.
   (expand_crc_table_based): Likewise.
   (gen_common_operation_to_reflect): Likewise.
   (reflect_64_bit_value): Likewise.
   (reflect_32_bit_value): Likewise.
   (reflect_16_bit_value): Likewise.
   (reflect_8_bit_value): Likewise.
   (generate_reflecting_code_standard): Likewise.
   (expand_reversed_crc_table_based): Likewise.
   * expr.h (generate_reflecting_code_standard): New function declaration.
   (expand_crc_table_based): Likewise.
   (expand_reversed_crc_table_based): Likewise.
   * internal-fn.cc: (crc_direct): Define.
   (direct_crc_optab_supported_p): Likewise.
   (expand_crc_optab_fn): New function
   * internal-fn.def (CRC, CRC_REV): New internal functions.
   * optabs.def (crc_optab, crc_rev_optab): New optabs.

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

[-- Attachment #2: 0001-Implement-internal-functions-for-efficient-CRC-compu.patch --]
[-- Type: application/x-patch, Size: 18695 bytes --]

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

end of thread, other threads:[~2024-06-08 21:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-24  8:41 [RFC/RFA] [PATCH 01/12] Implement internal functions for efficient CRC computation Mariam Arutunian
2024-05-25 17:40 ` Jeff Law
2024-05-27 13:51   ` Mariam Arutunian
2024-06-08 21:50     ` Jeff Law

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).