[PATCH 0/7] Simplify and optimize modf/modff

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Tue Jun 10 13:07:51 GMT 2025


Ping.

On 28/05/25 14:59, Adhemerval Zanella wrote:
> The patchset uses the powerpc implementation idea to make it generic and
> leverage rounding instruction on newer chips. The PowerPC implementation
> is also suboptimal, where a trunc operation can replace the floor/ceil
> operation.
> 
> The optimized implementation is gated through USE_TRUNCF_BUILTIN, since
> libc exports modf/modff, and making it generic would add a lot of
> complexity (since trunc will need to be pulled) and not all ABIs have
> rounding instruction in the base ABI.
> 
> Adhemerval Zanella (7):
>   benchtests: Add modff benchtest
>   benchtests: Improve modf benchtest
>   math: Simplify and optimize modff implementation
>   math: Simplify and optimize modf implementation
>   powerpc: Remove modff optimization
>   powerpc: Remove modf optimization
>   x86_64: Optimize modf/modff for x86_64-v2
> 
>  benchtests/Makefile                           |    1 +
>  benchtests/modf-inputs                        | 4013 ++++++++-
>  benchtests/modff-inputs                       | 8011 +++++++++++++++++
>  sysdeps/ieee754/dbl-64/math_config.h          |   13 +
>  sysdeps/ieee754/dbl-64/s_modf.c               |  109 +-
>  sysdeps/ieee754/flt-32/math_config.h          |   13 +
>  sysdeps/ieee754/flt-32/s_modff.c              |  103 +-
>  sysdeps/powerpc/fpu/math-use-builtins-trunc.h |    9 +
>  sysdeps/powerpc/fpu/s_modf.c                  |   59 -
>  sysdeps/powerpc/fpu/s_modff.c                 |   55 -
>  .../power4/fpu/multiarch/s_modf-power5+.c     |    2 +-
>  .../power4/fpu/multiarch/s_modff-power5+.c    |    2 +-
>  .../be/fpu/multiarch/s_modf-power5+.c         |    2 +-
>  .../be/fpu/multiarch/s_modff-power5+.c        |    2 +-
>  sysdeps/x86_64/fpu/math-use-builtins-trunc.h  |    9 +
>  15 files changed, 12186 insertions(+), 217 deletions(-)
>  create mode 100644 benchtests/modff-inputs
>  create mode 100644 sysdeps/powerpc/fpu/math-use-builtins-trunc.h
>  delete mode 100644 sysdeps/powerpc/fpu/s_modf.c
>  delete mode 100644 sysdeps/powerpc/fpu/s_modff.c
>  create mode 100644 sysdeps/x86_64/fpu/math-use-builtins-trunc.h
> 



More information about the Libc-alpha mailing list