Use optabs infrastructure for _BitInt to float conversions
Compiler handles conversions between _BitInt and floating-point types using a unified optab infrastructure.
This change integrates the conversion of _BitInt types to and from various floating-point types into GCC’s existing optab (operator table) infrastructure. This allows for more efficient handling and potential caching of these conversions, especially when multiple conversions occur. Previously, these conversions were often generated manually, leading to less optimized code and difficulties in overriding specific library function names. The new approach uses dedicated optabs for these conversions, improving consistency and maintainability.
In Details
The GCC optabs infrastructure is extended to manage conversions between _BitInt types and floating-point types. New optabs, bitinttofp_optab and bitintfromfp_optab, are introduced in optabs.def. The optabs-libfuncs.cc now includes a gen_bitint_fp_libfunc to construct these library calls. The internal functions expand_FLOATTOBITINT and expand_BITINTTOFLOAT in internal-fn.cc are modified to utilize these new optabs, replacing manual libcall name construction. This change ensures these conversions can be overridden (e.g., on rs6000.cc) and efficiently cached, addressing limit…
- _BitInt
- A GCC extension for arbitrary-precision integers, allowing integers of any specified bit width.
- optabs
- Operator tables in GCC that map high-level operations (like addition or type conversion) to specific machine instructions or library calls.
- libfuncs
- Library functions. In this context, it refers to functions from GCC's compiler support library (libgcc) that are called for operations not directly supported by hardware instructions, such as complex type conversions.
- floating-point
- A numerical format representing real numbers using a fixed number of digits, with a separate exponent part. Examples include float, double, and long double.