On Thu, Sep 10, 2026 at 05:17:01AM -0500, Manjunath S Matti wrote:
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/bitint-alignments-powerpc.c
> @@ -0,0 +1,70 @@
> +/* { dg-do run { target bitint } } */
> +/* { dg-additional-options "-std=c23 -O2" } */
> +
> +/* Test _BitInt alignment for PowerPC (uniform DImode ABI).
> +   _BitInt(33..N) uses DImode (8-byte) limbs on ppc64 and SImode
> +   (4-byte) limbs on ppc32.  All multi-limb types are 8-byte aligned
> +   on ppc64 and 4-byte aligned on ppc32, regardless of endianness.  */
> +
> +int main(void)
> +{
> +  /* Test basic alignments */
> +  if (__alignof__(_BitInt(8)) != 1)
> +    __builtin_abort();
> +
> +  if (__alignof__(_BitInt(16)) != 2)
> +    __builtin_abort();
> +
> +  if (__alignof__(_BitInt(32)) != 4)
> +    __builtin_abort();

I think it would be simpler to
#ifdef __powerpc64__
#define LIMB_ALIGNMENT 8
#else
#define LIMB_ALIGNMENT 4
#endif
and make the rest of the test unconditional just using that constant.

> +#ifdef __powerpc64__
> +/* Widths above the abi_limb_mode threshold should use the by-reference ABI. 
> */
> +_BitInt(129) add_bitint129(_BitInt(129) a, _BitInt(129) b)

Why is this conditional?  Even -m32 should handle that...

> +#ifdef __powerpc64__
> +  /* Test 128-bit arithmetic (64-bit mode only) */

Again.

> +#ifdef __powerpc64__
> +  /* Test 128-bit comparisons (64-bit mode only).  */

And again.  &c.

Otherwise LGTM, but I'll defer the approval to Mike.

        Jakub

Reply via email to