Rs6000 adds ABI and libgcc support for C23 _BitInt.
Rs6000 now supports C23 _BitInt types by adding target hooks and libgcc runtime support.
Support for C23’s _BitInt type has been added to the rs6000 (PowerPC) architecture. This includes implementing the necessary target hooks and libgcc runtime support that were previously missing. The changes define how _BitInt types are represented using machine modes, how they are passed and returned by reference for larger sizes, and ensure correct integration with existing integer promotion rules.
In Details
This patch introduces TARGET_C_BITINT_TYPE_INFO implementation for rs6000, enabling C23 _BitInt support. rs6000_bitint_type_info selects limb modes (QImode, HImode, SImode, DImode) based on bit precision. The ABI limb mode mirrors the internal mode, with multi-word _BitInts treated as arrays of limbs. Large _BitInts (over 16 bytes for ELFv2, 8 bytes otherwise) are passed/returned by reference, controlled by rs6000_bitint_large_p. rs6000_function_value prevents sub-word promotion for _BitInt return values to match middle-end computations.
- C23
- A future revision of the C programming language standard, which includes features like
_BitIntfor arbitrary-precision integers. - _BitInt
- A C23 integer type that allows programmers to specify integers of arbitrary bit width, providing more precise control over data representation compared to fixed-size types like
intorlong long. - ABI (Application Binary Interface)
- Defines how low-level code on a particular platform is written. It specifies conventions for function calling, data layout, and system calls, ensuring interoperability between compiled code from different sources.
- libgcc
- A runtime library providing essential low-level functions for GCC, such as support for integer division, floating-point operations, and language-specific features like arbitrary-precision integers.
- machine mode
- A representation of data types and sizes within the compiler's intermediate representation, corresponding to hardware registers or memory access sizes (e.g., QImode for 8-bit, HImode for 16-bit, SImode for 32-bit, DImode for 64-bit).