diff options
author | Yang Yujie <yangyujie@loongson.cn> | 2025-08-02 17:16:23 +0800 |
---|---|---|
committer | Lulu Cheng <chenglulu@loongson.cn> | 2025-08-13 11:01:55 +0800 |
commit | 8079e96eb767851e8e061a13ecfb21aa1a2362de (patch) | |
tree | 02fee192423bdee21c8d8edc7f798a2342fc850e /libjava/classpath/resource/java | |
parent | 8a7a433e86f32871f56095434cc85eb2da1b550b (diff) | |
download | gcc-8079e96eb767851e8e061a13ecfb21aa1a2362de.zip gcc-8079e96eb767851e8e061a13ecfb21aa1a2362de.tar.gz gcc-8079e96eb767851e8e061a13ecfb21aa1a2362de.tar.bz2 |
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.
Diffstat (limited to 'libjava/classpath/resource/java')
0 files changed, 0 insertions, 0 deletions