On Fri, Jun 27, 2025 at 03:33:36PM +0800, Yang Yujie wrote:
> In LoongArch psABI, large _BitInt(N) (N > 64) objects are only
> extended to fill the highest 8-byte chunk that contains any used bit,
> but the size of such a large _BitInt type is a multiple of their
> 16-byte alignment.  So there may be an entire unused 8-byte
> chunk that is not filled by extension, and this chunk shouldn't be
> checked when testing if the object is properly extended.
> 
> The original bitintext.h assumed that all bits within
> sizeof(_BitInt(N)) beyond used bits are filled by extension.
> This patch changes that for LoongArch and possibly
> any future ports with a similar behavior.
> 
> P.S. For encoding this test as well as type-generic programming,
> it would be nice to have a builtin function to obtain "N" at
> compile time from _BitInt(N)-typed expressions.  But here
> we stick to existing ones (__builtin_clrsbg / __builtin_clzg).
> 
> gcc/testsuite/ChangeLog:
> 
>       * gcc.dg/bitintext.h: Generalize BEXTC to only check extension
>       within PROMOTED_SIZE bits.

Ok for trunk.

        Jakub

Reply via email to