[PATCH v3 03/19] Add add_ssaaaa and sub_ssaaaa to gmp-arch.h

Collin Funk collin.funk1@gmail.com
Sat Nov 1 18:22:41 GMT 2025


Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:

> To enable “longlong.h” removal, add_ssaaaa and sub_ssaaaa are moved to
> gmp-arch.h.  The generic implementation now uses a static inline.  This
> provides better type checking than the GNU extension, which casts the
> asm constraint. It also works better with clang.
>
> Most architectures use the generic implementation.  This is expanded
> from a macro.  Exceptions are arc, arm, hppa, x86, m68k, powerpc, and
> sparc.  I kept only the x86 optimization, as there is no easy way to
> emit add{q}. For all others, the compiler generates good enough code.
>
> The strongly typed implementation required some changes.  I adjusted
> _FP_W_TYPE, _FP_WS_TYPE, and _FP_I_TYPE to use the same type as
> mp_limb_t on aarch64, powerpc64le, x86_64, and riscv64.  This basically
> means using “long” instead of “long long.”
> ---
>  sysdeps/aarch64/sfp-machine.h                 |  4 +-
>  sysdeps/generic/gmp-arch.h                    | 35 ++++++++++++-
>  sysdeps/loongarch/sfp-machine.h               |  6 +--
>  .../powerpc/powerpc64/le/fpu/sfp-machine.h    |  6 +--
>  sysdeps/riscv/sfp-machine.h                   |  6 +--
>  sysdeps/x86/fpu/sfp-machine.h                 | 18 ++++---
>  sysdeps/x86/gmp-arch.h                        | 52 +++++++++++++++++++
>  7 files changed, 109 insertions(+), 18 deletions(-)

Tested on x86_64 and cross-compiled for hppa.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>

Collin


More information about the Libc-alpha mailing list