https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127984
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jeff Law <[email protected]>: https://gcc.gnu.org/g:f97104c61a6cf4770f4d397f91a6e78426720e28 commit r17-6511-gf97104c61a6cf4770f4d397f91a6e78426720e28 Author: Shreesh Adiga <[email protected]> Date: Fri Nov 20 16:56:37 2026 -0700 [PATCH v2] middle-end: Fix CRC computation for 24-iteration loops [PR127984] For 24-iteration CRC loops, the CRC pass builds a 24-bit data type whose mode is SImode. The table based expanders derived the data size from the mode, so it processed 4 bytes instead of 3 and computed wrong result. Modified the last argument of crc table expanders to take data_bit_size instead of mode and passed the TYPE_PRECISION of data argument which is already built using build_nonstandard_integer_type correctly. PR middle-end/127984 gcc/ChangeLog: * builtins.cc (expand_builtin_crc_table_based): Update call to pass bit size instead of mode. * config/aarch64/aarch64.md (crc_rev<ALLI:mode><ALLX:mode>4): Likewise. * config/i386/i386.md (crc_rev<SWI1248x:mode><SWI248x:mode>4): Likewise. * config/loongarch/loongarch.md (crc_rev<mode>si4): Likewise. * config/riscv/bitmanip.md (crc_rev<ANY1:mode><ANYI:mode>4): Likewise. * expr.cc (calculate_table_based_CRC): Modified API to take bit size instead of mode. (calculate_table_based_reversed_CRC): Likewise. (expand_crc_table_based): Likewise. (expand_reversed_crc_table_based): Likewise. * expr.h (expand_crc_table_based): Update function declaration. (expand_reversed_crc_table_based): Likewise. * internal-fn.cc (expand_crc_optab_fn): Update call to pass bit size instead of mode. gcc/testsuite/ChangeLog: * gcc.dg/pr127984.c: New test. Signed-off-by: Shreesh Adiga <[email protected]>
