]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
int128: Check BITS_PER_MP_LIMB == 32 instead of __WORDSIZE == 32 master
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 29 Nov 2025 03:33:56 +0000 (11:33 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 3 Dec 2025 23:46:20 +0000 (07:46 +0800)
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.

Tested on x32, x86-64 and i686.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
sysdeps/generic/gmp-arch.h

index b3004c90edec490af519c11441eed53265d76ae3..547620da4930cdf9728c48a6c04a9899834e7b09 100644 (file)
@@ -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;