https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117599

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by LuluCheng <chengl...@gcc.gnu.org>:

https://gcc.gnu.org/g:8079e96eb767851e8e061a13ecfb21aa1a2362de

commit r16-3176-g8079e96eb767851e8e061a13ecfb21aa1a2362de
Author: Yang Yujie <yangyu...@loongson.cn>
Date:   Sat Aug 2 17:16:23 2025 +0800

    LoongArch: Add support for _BitInt [PR117599]

    This patch adds support for C23's _BitInt for LoongArch.

    From the LoongArch psABI[1]:

    > _BitInt(N) objects are stored in little-endian order in memory
    > and are signed by default.
    >
    > For N ⤠64, a _BitInt(N) object have the same size and alignment
    > of the smallest fundamental integral type that can contain it.
    > The unused high-order bits within this containing type are filled
    > with sign or zero extension of the N-bit value, depending on whether
    > the _BitInt(N) object is signed or unsigned. The _BitInt(N) object
    > propagates its signedness to the containing type and is laid out
    > in a register or memory as an object of this type.
    >
    > For N > 64, _BitInt(N) objects are implemented as structs of 64-bit
    > integer chunks. The number of chunks is the smallest even integer M
    > so that M * 64 ⥠N. These objects are of the same size of the struct
    > containing the chunks, but always have 16-byte alignment. If there
    > are unused bits in the highest-ordered chunk that contains used
    > bits, they are defined as the sign- or zero- extension of the used
    > bits depending on whether the _BitInt(N) object is signed or
    > unsigned. If an entire chunk is unused, its bits are undefined.

    [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.

Reply via email to