On Fri, Jun 27, 2025 at 03:33:39PM +0800, Yang Yujie wrote:
> [1] https://github.com/loongson/la-abi-specs
>
> PR target/117599
>
> gcc/ChangeLog:
>
> * config/loongarch/loongarch.h: Define a PROMOTE_MODE case for
> small _BitInts.
> * config/loongarch/loongarch.cc (loongarch_promote_function_mode):
> Same.
> (loongarch_bitint_type_info): New function.
> (TARGET_C_BITINT_TYPE_INFO): Declare.
>
> libgcc/ChangeLog:
>
> * config/loongarch/t-softfp-tf: Enable _BitInt helper functions.
> * config/loongarch/t-loongarch: Same.
> * config/loongarch/libgcc-loongarch.ver: New file.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/loongarch/bitint-alignments.c: New test.
> * gcc.target/loongarch/bitint-args.c: New test.
> * gcc.target/loongarch/bitint-sizes.c: New test.
This needs to be reviewed by LoongArch maintainers.
> @@ -11214,6 +11214,34 @@ loongarch_c_mode_for_suffix (char suffix)
> return VOIDmode;
> }
>
> +/* Implement TARGET_C_BITINT_TYPE_INFO.
> + Return true if _BitInt(N) is supported and fill its details into *INFO.
> */
> +bool
> +loongarch_bitint_type_info (int n, struct bitint_info *info)
> +{
> + if (n <= 8)
> + info->limb_mode = QImode;
> + else if (n <= 16)
> + info->limb_mode = HImode;
> + else if (n <= 32)
> + info->limb_mode = SImode;
> + else if (n <= 64)
> + info->limb_mode = DImode;
> + else if (n <= 128)
> + info->limb_mode = TImode;
> + else
> + info->limb_mode = DImode;
> +
> + info->abi_limb_mode = info->limb_mode;
> +
> + if (n > 64)
> + info->abi_limb_mode = TImode;
> +
> + info->big_endian = false;
> + info->extended = true;
> + return true;
> +}
>From my POV this is ok.
> +GCC_16.0.0 {
> + __mulbitint3
> + __divmodbitint4
> + __fixsfbitint
> + __fixdfbitint
> + __floatbitintsf
> + __floatbitintdf
> +}
> --- a/libgcc/config/loongarch/t-softfp-tf
> +++ b/libgcc/config/loongarch/t-softfp-tf
> @@ -1,3 +1,4 @@
> softfp_float_modes += tf
> softfp_extensions += sftf dftf
> softfp_truncations += tfsf tfdf
> +softfp_extras += floatbitinttf fixtfbitint
Given the tf stuff here, shouldn't
__fixtfbitint and __floatbitinttf be in the export list next to sf/df?
Jakub