Middle-end: Fix CRC builtins polynomial type to prevent truncation.
CRC builtins now use specific unsigned integer types for polynomials, preventing truncation and related warnings.
This commit corrects an issue where CRC built-in functions used CONST_SIZE for their polynomial argument, leading to truncation to 32 bits on 32-bit platforms. This caused -Woverflow warnings and incorrect calculations. The fix replaces CONST_SIZE with specific unsigned integer types (e.g., UINT8, UINT64) corresponding to the CRC function’s bit-width, aligning with documentation and resolving the truncation problem.
In Details
Modifies gcc/builtin-types.def and gcc/builtins.def to use specific unsigned integer types (e.g., UINT8, UINT64) for the polynomial argument in CRC builtins, replacing the generic CONST_SIZE. This addresses PR target/128105 by preventing truncation on 32-bit targets and aligning with the documented behavior for CRC functions like CRC64.
- CRC builtins
- Compiler intrinsics that provide efficient implementations of Cyclic Redundancy Check (CRC) algorithms. These functions often take data and a polynomial as arguments.
- CONST_SIZE
- A generic type in GCC's builtin type system that was used for arguments whose size was expected to be known at compile time, but lacked specific type information.
- UINT64
- An unsigned 64-bit integer type.
- Truncation
- The loss of data when a value is converted to a type that cannot represent its full range, typically by discarding the most significant bits.
- Middle-end
- The part of the compiler that performs optimizations and transformations on the intermediate representation (IR) of the code, after the front-end has parsed the source code and before the back-end generates machine code.