On Tue, May 20, 2025 at 11:29:12AM +0800, Yang Yujie wrote:
> This patch adds support for C23's _BitInt for LoongArch.
>
> Though there's not an official psABI definition, our plan
> is to have 16-byte alignment for N > 64 and the padding bits
> sign/zero-extended when passed between procedures.
>
> One exception would be "unsigned _BitInt(32)". To match the
> behavior of "unsigned int" in the current LP64 ABIs, it is
> sign-extended when stored in a 64-bit GPR as a function
> argument or return value.
>
> 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.
8 spaces instead of tab.
> (loongarch_bitint_type_info): New function.
> (TARGET_C_BITINT_TYPE_INFO): Declare.
>
> libgcc/ChangeLog:
>
> * config/loongarch/t-softfp-tf: Enable _BitInt helper functions.
You also need to arrange to export the _BitInt support routines from
libgcc_s.so.1. Before r16-758-g35fd4abd3b9631 some of them would be
exported at GCC_14.0.0 symbol version which is incorrect, GCC 14 nor
15 didn't support _BitInt on loongarch. And the tf related mode
ones weren't exported anyway. Please export all the new ones
at GCC_16.0.0.
BTW, does loongarch have HFmode or BFmode support?
If yes, those should be enabled for _BitInt too.
Jakub