[PATCH v2] int128: Check BITS_PER_MP_LIMB == 32 instead of __WORDSIZE == 32
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Wed Dec 3 12:46:08 GMT 2025
On 01/12/25 21:33, H.J. Lu wrote:
> commit 8cd6efca5b3796193ef3ff60d9dbf6e5572b2b73
> Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> Date: Thu Nov 20 15:30:06 2025 -0300
>
> Add add_ssaaaa and sub_ssaaaa to gmp-arch.h
>
> checks __WORDSIZE == 32 to decide if int128 should be used, which breaks
> x32 which has int128 and __WORDSIZE == 32. Check BITS_PER_MP_LIMB == 32,
> instead of __WORDSIZE == 32. This fixes BZ #33677.
>
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> sysdeps/generic/gmp-arch.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/sysdeps/generic/gmp-arch.h b/sysdeps/generic/gmp-arch.h
> index b3004c90ed..547620da49 100644
> --- a/sysdeps/generic/gmp-arch.h
> +++ b/sysdeps/generic/gmp-arch.h
> @@ -43,7 +43,7 @@ ll_highpart (mp_limb_t t)
> static __always_inline void
> umul_ppmm_generic (mp_limb_t *w1, mp_limb_t *w0, mp_limb_t u, mp_limb_t v)
> {
> -#if __WORDSIZE == 32
> +#if BITS_PER_MP_LIMB == 32
> uint64_t t0 = (uint64_t)u * v;
> *w1 = t0 >> 32;
> *w0 = t0;
> @@ -131,7 +131,7 @@ static __always_inline void
> add_ssaaaa_generic (mp_limb_t *sh, mp_limb_t *sl, mp_limb_t ah,
> mp_limb_t al, mp_limb_t bh, mp_limb_t bl)
> {
> -#if __WORDSIZE == 32
> +#if BITS_PER_MP_LIMB == 32
> uint64_t a = (uint64_t)ah << 32 | al;
> uint64_t b = (uint64_t)bh << 32 | bl;
> uint64_t r = a + b;
> @@ -157,7 +157,7 @@ static __always_inline void
> sub_ddmmss_generic (mp_limb_t *sh, mp_limb_t *sl, mp_limb_t ah,
> mp_limb_t al, mp_limb_t bh, mp_limb_t bl)
> {
> -#if __WORDSIZE == 32
> +#if BITS_PER_MP_LIMB == 32
> uint64_t a = (uint64_t)ah << 32 | al;
> uint64_t b = (uint64_t)bh << 32 | bl;
> uint64_t r = a - b;
> --
> 2.52.0
More information about the Libc-alpha
mailing list