On 11/18/26 9:38 AM, Shreesh Adiga wrote:
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]>
THanks. I've pushed this to the trunk.
jeff