Hi. Thank you. I'll add. Best regards, Mariam
On Thu, Aug 3, 2023, 23:56 Andrew Pinski <pins...@gmail.com> wrote: > On Thu, Aug 3, 2023 at 12:38 PM Mariam Harutyunyan via Gcc-patches > <gcc-patches@gcc.gnu.org> wrote: > > > > This patch adds CRC support for the RISC-V architecture. It adds internal > > functions and built-ins specifically designed to handle CRC computations > > efficiently. > > > > If the target is ZBC, the clmul instruction is used for the CRC code > > generation; otherwise, table-based CRC is generated. A table with 256 > > elements is used to store precomputed CRCs. > > > > These CRC calculation algorithms have higher performance than the naive > CRC > > calculation algorithm. > > A few things about this patch: > You created a generic (non-target specific) builtin but didn't > document it in doc/extend.texi . > You created a generic builtin with no fallback in libgcc. > You created a new named (RTL) pattern, crc, and didn't document it in > the `Standard Names` section of doc/md.texi . > > Thanks, > Andrew Pinski > > > > > gcc/ChangeLog: > > *builtin-types.def (BT_FN_UINT8_UINT8_UINT8_CONST_SIZE): > Define. > > (BT_FN_UINT16_UINT16_UINT8_CONST_SIZE): Likewise. > > (BT_FN_UINT16_UINT16_UINT16_CONST_SIZE): Likewise. > > (BT_FN_UINT32_UINT32_UINT8_CONST_SIZE): Likewise. > > (BT_FN_UINT32_UINT32_UINT16_CONST_SIZE): Likewise. > > (BT_FN_UINT32_UINT32_UINT32_CONST_SIZE): Likewise. > > (BT_FN_UINT64_UINT64_UINT8_CONST_SIZE): Likewise. > > (BT_FN_UINT64_UINT64_UINT16_CONST_SIZE): Likewise. > > (BT_FN_UINT64_UINT64_UINT32_CONST_SIZE): Likewise. > > (BT_FN_UINT64_UINT64_UINT32_CONST_SIZE): Likewise. > > * builtins.cc (associated_internal_fn): Handle > > BUILT_IN_CRC8_DATA8, > > BUILT_IN_CRC16_DATA8, BUILT_IN_CRC16_DATA16, > > BUILT_IN_CRC32_DATA8, BUILT_IN_CRC32_DATA16, > > BUILT_IN_CRC32_DATA32, > > BUILT_IN_CRC64_DATA8, BUILT_IN_CRC64_DATA16, > > BUILT_IN_CRC64_DATA32, > > BUILT_IN_CRC64_DATA64. > > * builtins.def (BUILT_IN_CRC8_DATA8): New builtin. > > (BUILT_IN_CRC16_DATA8): Likewise. > > (BUILT_IN_CRC16_DATA16): Likewise. > > (BUILT_IN_CRC32_DATA8): Likewise. > > (BUILT_IN_CRC32_DATA16): Likewise. > > (BUILT_IN_CRC32_DATA32): Likewise. > > (BUILT_IN_CRC64_DATA8): Likewise. > > (BUILT_IN_CRC64_DATA16): Likewise. > > (BUILT_IN_CRC64_DATA32): Likewise. > > (BUILT_IN_CRC64_DATA64): Likewise. > > * config/riscv/bitmanip.md (crc<ANYI2:mode><ANYI:mode>4): New > > expander. > > * config/riscv/riscv-protos.h (expand_crc_table_based): > Declare. > > (expand_crc_using_clmul): Likewise. > > * config/riscv/riscv.cc (gf2n_poly_long_div_quotient): New > > function. > > (generate_crc): Likewise. > > (generate_crc_table): Likewise. > > (expand_crc_table_based): Likewise. > > (expand_crc_using_clmul): Likewise. > > * config/riscv/riscv.md (UNSPEC_CRC): New unspec for CRC. > > * internal-fn.cc (crc_direct): Define. > > (expand_crc_optab_fn): New function. > > (direct_crc_optab_supported_p): Define. > > * internal-fn.def (CRC): New internal optab function. > > * optabs.def (crc_optab): New optab. > > > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/crc-builtin-table-target32.c: New test. > > * gcc.target/riscv/crc-builtin-table-target64.c: New test. > > * gcc.target/riscv/crc-builtin-zbc32.c: New test. > > * gcc.target/riscv/crc-builtin-zbc64.c: New test. >