https://gcc.gnu.org/g:8380b4ad87edff73dd14ae47dc79b85c332a06c3
commit r17-4039-g8380b4ad87edff73dd14ae47dc79b85c332a06c3 Author: Léo Hardt <[email protected]> Date: Wed Sep 9 10:52:11 2026 -0600 [PATCH] clean(crc32): Remove dead code. Remove functions to calculate crc32 which are not used anymore. generate_reflecting_code_standard and its dependencies are not used since 7034f85fb. Note the comments on that PR: > [...] eliminating the need for explicit bit reflection > before and after the CRC computation [...] This patch should be easily verifiable: nothing was done except deleting functions that don't have any callers. gcc/ChangeLog: * expr.cc (gen_common_operation_to_reflect): Remove. (reflect_64_bit_value): Remove. (reflect_32_bit_value): Remove. (reflect_16_bit_value): Remove. (reflect_8_bit_value): Remove. (generate_reflecting_code_standard): Remove. * expr.h (generate_reflecting_code_standard): Remove. Signed-off-by: Léo Hardt <[email protected]> Diff: --- gcc/expr.cc | 102 ------------------------------------------------------------ gcc/expr.h | 1 - 2 files changed, 103 deletions(-) diff --git a/gcc/expr.cc b/gcc/expr.cc index e09dab959531..95dd87242449 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -14851,108 +14851,6 @@ expand_crc_table_based (rtx op0, rtx op1, rtx op2, rtx op3, convert_move (op0, crc, 0); } -/* Generate the common operation for reflecting values: - *OP = (*OP & AND1_VALUE) << SHIFT_VAL | (*OP & AND2_VALUE) >> SHIFT_VAL; */ - -void -gen_common_operation_to_reflect (rtx *op, - unsigned HOST_WIDE_INT and1_value, - unsigned HOST_WIDE_INT and2_value, - unsigned shift_val) -{ - rtx op1 = expand_and (GET_MODE (*op), *op, - gen_int_mode (and1_value, GET_MODE (*op)), NULL_RTX); - op1 = expand_shift (LSHIFT_EXPR, GET_MODE (*op), op1, shift_val, op1, 0); - rtx op2 = expand_and (GET_MODE (*op), *op, - gen_int_mode (and2_value, GET_MODE (*op)), NULL_RTX); - op2 = expand_shift (RSHIFT_EXPR, GET_MODE (*op), op2, shift_val, op2, 1); - *op = expand_binop (GET_MODE (*op), ior_optab, op1, - op2, *op, 0, OPTAB_LIB_WIDEN); -} - -/* Reflect 64-bit value for the 64-bit target. */ - -void -reflect_64_bit_value (rtx *op) -{ - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x00000000FFFFFFFF), - HOST_WIDE_INT_C (0xFFFFFFFF00000000), 32); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x0000FFFF0000FFFF), - HOST_WIDE_INT_C (0xFFFF0000FFFF0000), 16); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x00FF00FF00FF00FF), - HOST_WIDE_INT_C (0xFF00FF00FF00FF00), 8); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x0F0F0F0F0F0F0F0F), - HOST_WIDE_INT_C (0xF0F0F0F0F0F0F0F0), 4); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x3333333333333333), - HOST_WIDE_INT_C (0xCCCCCCCCCCCCCCCC), 2); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x5555555555555555), - HOST_WIDE_INT_C (0xAAAAAAAAAAAAAAAA), 1); -} - -/* Reflect 32-bit value for the 32-bit target. */ - -void -reflect_32_bit_value (rtx *op) -{ - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x0000FFFF), - HOST_WIDE_INT_C (0xFFFF0000), 16); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x00FF00FF), - HOST_WIDE_INT_C (0xFF00FF00), 8); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x0F0F0F0F), - HOST_WIDE_INT_C (0xF0F0F0F0), 4); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x33333333), - HOST_WIDE_INT_C (0xCCCCCCCC), 2); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x55555555), - HOST_WIDE_INT_C (0xAAAAAAAA), 1); -} - -/* Reflect 16-bit value for the 16-bit target. */ - -void -reflect_16_bit_value (rtx *op) -{ - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x00FF), - HOST_WIDE_INT_C (0xFF00), 8); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x0F0F), - HOST_WIDE_INT_C (0xF0F0), 4); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x3333), - HOST_WIDE_INT_C (0xCCCC), 2); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x5555), - HOST_WIDE_INT_C (0xAAAA), 1); -} - -/* Reflect 8-bit value for the 8-bit target. */ - -void -reflect_8_bit_value (rtx *op) -{ - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x0F), - HOST_WIDE_INT_C (0xF0), 4); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x33), - HOST_WIDE_INT_C (0xCC), 2); - gen_common_operation_to_reflect (op, HOST_WIDE_INT_C (0x55), - HOST_WIDE_INT_C (0xAA), 1); -} - -/* Generate instruction sequence which reflects the value of the OP - using shift, and, or operations. OP's mode may be less than word_mode. */ - -void -generate_reflecting_code_standard (rtx *op) -{ - gcc_assert (GET_MODE_BITSIZE (GET_MODE (*op)).to_constant () >= 8 - && GET_MODE_BITSIZE (GET_MODE (*op)).to_constant () <= 64); - - if (GET_MODE_BITSIZE (GET_MODE (*op)).to_constant () == 64) - reflect_64_bit_value (op); - else if (GET_MODE_BITSIZE (GET_MODE (*op)).to_constant () == 32) - reflect_32_bit_value (op); - else if (GET_MODE_BITSIZE (GET_MODE (*op)).to_constant () == 16) - reflect_16_bit_value (op); - else - reflect_8_bit_value (op); -} - /* Generate table-based reversed CRC code for the given CRC, INPUT_DATA and the POLYNOMIAL (without leading 1). diff --git a/gcc/expr.h b/gcc/expr.h index a54984ea2f89..55d72cb95100 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -402,7 +402,6 @@ extern unsigned HOST_WIDE_INT gf2n_poly_long_div_quotient (unsigned HOST_WIDE_INT, unsigned short); /* Generate table-based CRC. */ -extern void generate_reflecting_code_standard (rtx *); extern void expand_crc_table_based (rtx, rtx, rtx, rtx, machine_mode); extern void expand_reversed_crc_table_based (rtx, rtx, rtx, rtx, machine_mode);
