mbox series

[00/13] Use GCC builtins for some math functions if desired.

Message ID 1575297977-2589-1-git-send-email-stli@linux.ibm.com
Headers show
Series Use GCC builtins for some math functions if desired. | expand

Message

Stefan Liebler Dec. 2, 2019, 2:46 p.m. UTC
Hi,

this patch-series moves the nearbyint, rint, floor, ceil, trunc and round implementation from sysdeps/ieee754/dbl-64/wordsize-64 to sysdeps/ieee754/dbl-64/ as proposed by Adhemerval:
ttps://www.sourceware.org/ml/libc-alpha/2019-11/msg00085.html

It also introduces the math-use-builtins.h header with __USE_<SYMBOL>_BUILTIN macros which allows to just use GCC __builtin_<SYMBOL> instead of the current common-code implementation.  There is a float, double, long double and _Float128 version of this macro for each <SYMBOL>.

The generic math-use-builtins.h header is defining all those macros to 0 in order to use the current common-code implenetation.  If an architecture wants to use the builtins, an architecture specific math-use-builtins.h needs to be created (e.g. done for s390) where those macros are defined to 1.

Bye,
Stefan

Stefan Liebler (13):
  Always use wordsize-64 version of s_nearbyint.c.
  Always use wordsize-64 version of s_rint.c.
  Always use wordsize-64 version of s_floor.c.
  Always use wordsize-64 version of s_ceil.c.
  Always use wordsize-64 version of s_trunc.c.
  Always use wordsize-64 version of s_round.c.
  Use GCC builtins for nearbyint functions if desired.
  Use GCC builtins for rint functions if desired.
  Use GCC builtins for floor functions if desired.
  Use GCC builtins for ceil functions if desired.
  Use GCC builtins for trunc functions if desired.
  Use GCC builtins for round functions if desired.
  Use GCC builtins for copysign functions if desired.

 sysdeps/generic/math-use-builtins.h           | 59 +++++++++++
 sysdeps/ieee754/dbl-64/s_ceil.c               | 64 +++++-------
 sysdeps/ieee754/dbl-64/s_copysign.c           |  8 +-
 sysdeps/ieee754/dbl-64/s_floor.c              | 98 +++++++++----------
 sysdeps/ieee754/dbl-64/s_nearbyint.c          | 46 ++++-----
 sysdeps/ieee754/dbl-64/s_rint.c               | 39 +++++---
 sysdeps/ieee754/dbl-64/s_round.c              | 45 ++++-----
 sysdeps/ieee754/dbl-64/s_trunc.c              | 31 +++---
 sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c   | 52 ----------
 sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c  | 72 --------------
 .../ieee754/dbl-64/wordsize-64/s_nearbyint.c  | 65 ------------
 sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c   | 58 -----------
 sysdeps/ieee754/dbl-64/wordsize-64/s_round.c  | 66 -------------
 sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c  | 55 -----------
 sysdeps/ieee754/float128/float128_private.h   | 22 +++++
 sysdeps/ieee754/flt-32/s_ceilf.c              | 60 +++++++-----
 sysdeps/ieee754/flt-32/s_copysignf.c          | 21 ++--
 sysdeps/ieee754/flt-32/s_floorf.c             | 60 +++++++-----
 sysdeps/ieee754/flt-32/s_nearbyintf.c         | 74 ++++++++------
 sysdeps/ieee754/flt-32/s_rintf.c              | 57 ++++++-----
 sysdeps/ieee754/flt-32/s_roundf.c             |  6 +-
 sysdeps/ieee754/flt-32/s_truncf.c             |  6 +-
 sysdeps/ieee754/ldbl-128/s_ceill.c            | 97 ++++++++++++------
 sysdeps/ieee754/ldbl-128/s_copysignl.c        | 23 +++--
 sysdeps/ieee754/ldbl-128/s_floorl.c           | 97 +++++++++++-------
 sysdeps/ieee754/ldbl-128/s_nearbyintl.c       | 76 ++++++++------
 sysdeps/ieee754/ldbl-128/s_rintl.c            | 63 +++++++-----
 sysdeps/ieee754/ldbl-128/s_roundl.c           |  6 +-
 sysdeps/ieee754/ldbl-128/s_truncl.c           |  6 +-
 sysdeps/s390/fpu/math-use-builtins.h          | 84 ++++++++++++++++
 .../sparc64/fpu/multiarch/s_ceil-generic.c    |  2 +-
 .../sparc/sparc64/fpu/multiarch/s_ceil-vis3.c |  2 +-
 .../sparc64/fpu/multiarch/s_floor-generic.c   |  2 +-
 .../sparc64/fpu/multiarch/s_floor-vis3.c      |  2 +-
 .../sparc64/fpu/multiarch/s_trunc-generic.c   |  2 +-
 .../sparc64/fpu/multiarch/s_trunc-vis3.c      |  2 +-
 sysdeps/x86_64/fpu/multiarch/s_ceil-c.c       |  2 +-
 sysdeps/x86_64/fpu/multiarch/s_floor-c.c      |  2 +-
 sysdeps/x86_64/fpu/multiarch/s_nearbyint-c.c  |  2 +-
 sysdeps/x86_64/fpu/multiarch/s_rint-c.c       |  2 +-
 sysdeps/x86_64/fpu/multiarch/s_trunc-c.c      |  2 +-
 41 files changed, 750 insertions(+), 788 deletions(-)
 create mode 100644 sysdeps/generic/math-use-builtins.h
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_round.c
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c
 create mode 100644 sysdeps/s390/fpu/math-use-builtins.h

Comments

Stefan Liebler Dec. 9, 2019, 12:57 p.m. UTC | #1
On 12/2/19 3:46 PM, Stefan Liebler wrote:
> Hi,
> 
> this patch-series moves the nearbyint, rint, floor, ceil, trunc and round implementation from sysdeps/ieee754/dbl-64/wordsize-64 to sysdeps/ieee754/dbl-64/ as proposed by Adhemerval:
> ttps://www.sourceware.org/ml/libc-alpha/2019-11/msg00085.html
> 
> It also introduces the math-use-builtins.h header with __USE_<SYMBOL>_BUILTIN macros which allows to just use GCC __builtin_<SYMBOL> instead of the current common-code implementation.  There is a float, double, long double and _Float128 version of this macro for each <SYMBOL>.
> 
> The generic math-use-builtins.h header is defining all those macros to 0 in order to use the current common-code implenetation.  If an architecture wants to use the builtins, an architecture specific math-use-builtins.h needs to be created (e.g. done for s390) where those macros are defined to 1.
> 
> Bye,
> Stefan
> 

Hi,

thanks for the review so far.
I've sent a new version v2 with changes due to Adhemervals comments.
See "[PATCH v2 00/18] Use GCC builtins for some math functions if desired."
https://www.sourceware.org/ml/libc-alpha/2019-12/msg00258.html

Can you have a final look, please?

Bye,
Stefan