[PATCH 00/28] powerpc floating-point optimization refactor

classic Classic list List threaded Threaded
54 messages Options
123
Reply | Threaded
Open this post in threaded view
|

[PATCH 00/28] powerpc floating-point optimization refactor

Adhemerval Zanella-2
This is a powerpc fpu refactor and simplification which consolidate
some assembly optimization in C implementation (which similar
performance result), remove some bloat optimizations which only
add code complexity, refactor IFUNC selection to disable unnecessary
selection on powercpc64le, and also optimize some symbols for
powerpc64le ISA 2.07+.

The idea is also to remove some build variation with different
--with-cpu selection, more especially in implementation selection.
The powerpc sysdeps selection is currently quite convoluted and
complex, with many variations due --with-cpu, and with the three
main ABIs sharing some rules. Worse, new chips/ISA only tend to
make it worse and some chip-specific optimizations might not be
beneficial for a newer version.

My idea is to move powerpc64, or at least powerpc64le, more in
the direction of x86_64 and s390x are moving: a baseline build
without --with-cpu selection and IFUNC variation enable/disable
based on compiler flags (indicate through pre-processor defines).

This will simplify new chips addition (no more the need to add
multiple implies folders), build baseline will have fewer sysdeps
folder, and less possible variations that might be tested.

Although I focused on optimizing it for powerpc64le, both powerpc
and powerpc64 baselines builds results simplified code with
optimized results.  It also results in some binary size reduction
for libm:

$ size powerpc64-linux-gnu-master/math/libm.so
   text    data     bss     dec     hex filename
 803010   18044     576  821630   c897e powerpc64-linux-gnu-master/math/libm.so
$ size powerpc64-linux-gnu/math/libm.so
   text    data     bss     dec     hex filename
 796094   17284     504  813882   c6b3a powerpc64-linux-gnu/math/libm.so

$ size powerpc64le-linux-gnu-master/math/libm.so
   text    data     bss     dec     hex filename
1061284    2904     288 1064476  103e1c powerpc64le-linux-gnu-master/math/libm.so
$ size powerpc64le-linux-gnu/math/libm.so
   text    data     bss     dec     hex filename
1048772    2512     264 1051548  100b9c powerpc64le-linux-gnu/math/libm.so

For testing I tried to cover to different build option and optimization
which the code might result in different code generation:

  - powerpc-linux-gnu
  - powerpc-linux-gnu and --with-cpu=power4
  - powerpc-linux-gnu and --with-cpu=power5+
  - powerpc-linux-gnu and --with-cpu=power7
  - powerpc-linux-gnu and --with-cpu=power4 and --disable-arch
  - powerpc-linux-gnu and --with-cpu=power5+ and --disable-arch
  - powerpc-linux-gnu and --with-cpu=power7 and --disable-arch
  - powerpc64-linux-gnu
  - powerpc64le-linux-gnu
  - powerpc64le-linux-gnu and --disable-arch
  - powerpc64le-linux-gnu --with-cpu=power8

The compilers used are the one resulted from build-many-glibcs, which optimizes
for default minumum cpus.

Adhemerval Zanella (28):
  powerpc: Use generic fabs{f} implementations
  powerpc: fma using builtins
  powerpc: Remove power4 mpa optimization
  powerpc: ceil/ceilf refactor
  powerpc: floor/floorf refactor
  powerpc: round/roundf refactor
  powerpc: trunc/truncf refactor
  powerpc: generic nearbyint/nearbyintf
  powerpc: consolidate rint
  powerpc: copysign cleanup
  benchtests: Add isnan/isinf/isfinite benchmark
  math: Use wordsize-64 version for isnan
  powerpc: Remove optimized isnan
  math: Use wordsize-64 version for isinf
  powerpc: Remove optimized isinf
  math: Use wordsize-64 version for finite
  powerpc: Remove optimized finite
  powerpc: refactor powerpc64 lrint/lrintf/llrint/llrintf
  powerpc: Refactor powerpc32 lrint/lrintf/llrint/llrintf
  powerpc: Refactor powerpc64 lround/lroundf/llround/llroundf
  powerpc: Refactor powerpc32 lround/lroundf/llround/llroundf
  powerpc: Use generic e_expf
  benchtests: hypot benchmark
  powerpc: hypot refactor and optimization
  powerpc: Refactor modf{f}
  benchtests: Add logb{f} benchmark
  math: Use wordsize-64 version for s_logb
  powerpc: refactor logb{f,l}

 benchtests/Makefile                           |   5 +-
 benchtests/hypot-inputs                       |  16 +
 benchtests/isfinite-inputs                    |  21 ++
 benchtests/isinf-inputs                       |  21 ++
 benchtests/isnan-inputs                       |  21 ++
 benchtests/logb-inputs                        |  11 +
 benchtests/logbf-inputs                       |  11 +
 sysdeps/ieee754/dbl-64/s_finite.c             |  22 +-
 sysdeps/ieee754/dbl-64/s_isinf.c              |  15 +-
 sysdeps/ieee754/dbl-64/s_isnan.c              |  17 +-
 sysdeps/ieee754/dbl-64/s_logb.c               |  61 ++--
 sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c |  43 ---
 sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c  |  34 --
 sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c  |  40 ---
 sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c   |  47 ---
 sysdeps/powerpc/fpu/e_hypot.c                 |  96 ++----
 sysdeps/powerpc/fpu/fenv_libc.h               |   8 +
 sysdeps/powerpc/fpu/round_to_integer.h        | 154 +++++++++
 sysdeps/powerpc/fpu/s_ceil.c                  |  35 ++
 sysdeps/powerpc/fpu/s_ceilf.c                 |  35 ++
 sysdeps/powerpc/fpu/s_copysign.c              |  32 ++
 sysdeps/powerpc/fpu/s_copysignf.c             |  28 ++
 sysdeps/powerpc/fpu/s_fabs.S                  |  33 --
 sysdeps/powerpc/fpu/s_fabsf.S                 |   1 -
 sysdeps/powerpc/fpu/s_floor.c                 |  35 ++
 sysdeps/powerpc/fpu/s_floorf.c                |  35 ++
 sysdeps/powerpc/fpu/{s_fma.S => s_fma.c}      |  12 +-
 sysdeps/powerpc/fpu/{s_fmaf.S => s_fmaf.c}    |  12 +-
 sysdeps/powerpc/fpu/s_isnan.c                 |  62 ----
 sysdeps/powerpc/fpu/s_isnanf.S                |   1 -
 sysdeps/powerpc/{power7 => }/fpu/s_logb.c     |  64 ++--
 sysdeps/powerpc/{power7 => }/fpu/s_logbf.c    |  44 ++-
 sysdeps/powerpc/{power7 => }/fpu/s_logbl.c    |  47 ++-
 sysdeps/powerpc/fpu/s_lrintf.S                |   1 -
 sysdeps/powerpc/fpu/s_lrintf.c                |   1 +
 sysdeps/powerpc/{power5+ => }/fpu/s_modf.c    |  17 +-
 sysdeps/powerpc/{power5+ => }/fpu/s_modff.c   |  13 +-
 sysdeps/powerpc/fpu/s_nearbyint.c             |  30 ++
 sysdeps/powerpc/fpu/s_nearbyintf.c            |  30 ++
 sysdeps/powerpc/fpu/s_rint.c                  |  19 +-
 sysdeps/powerpc/fpu/s_rintf.c                 |  19 +-
 sysdeps/powerpc/fpu/s_round.c                 |  35 ++
 sysdeps/powerpc/fpu/s_roundf.c                |  35 ++
 sysdeps/powerpc/fpu/s_trunc.c                 |  35 ++
 sysdeps/powerpc/fpu/s_truncf.c                |  35 ++
 sysdeps/powerpc/power4/fpu/Makefile           |   5 -
 sysdeps/powerpc/power4/fpu/mpa-arch.h         |  56 ----
 sysdeps/powerpc/power4/fpu/mpa.c              | 214 -------------
 sysdeps/powerpc/powerpc32/fpu/Makefile        |   7 +
 sysdeps/powerpc/powerpc32/fpu/s_ceil.S        |  76 -----
 sysdeps/powerpc/powerpc32/fpu/s_ceilf.S       |  76 -----
 sysdeps/powerpc/powerpc32/fpu/s_copysign.S    |  53 ---
 sysdeps/powerpc/powerpc32/fpu/s_copysignf.S   |   1 -
 sysdeps/powerpc/powerpc32/fpu/s_floor.S       |  76 -----
 sysdeps/powerpc/powerpc32/fpu/s_floorf.S      |  76 -----
 sysdeps/powerpc/powerpc32/fpu/s_isnan.S       |  57 ----
 sysdeps/powerpc/powerpc32/fpu/s_llrint.c      |   9 +
 sysdeps/powerpc/powerpc32/fpu/s_llrintf.c     |   7 +
 sysdeps/powerpc/powerpc32/fpu/s_llround.c     |  51 ++-
 sysdeps/powerpc/powerpc32/fpu/s_lrint.S       |  40 ---
 sysdeps/powerpc/powerpc32/fpu/s_lrint.c       |  40 +++
 sysdeps/powerpc/powerpc32/fpu/s_lround.S      | 123 -------
 sysdeps/powerpc/powerpc32/fpu/s_lround.c      |  77 +++++
 sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S   |  80 -----
 sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S  |  79 -----
 sysdeps/powerpc/powerpc32/fpu/s_rint.S        |  69 ----
 sysdeps/powerpc/powerpc32/fpu/s_rintf.S       |  66 ----
 sysdeps/powerpc/powerpc32/fpu/s_round.S       |  97 ------
 sysdeps/powerpc/powerpc32/fpu/s_roundf.S      |  96 ------
 sysdeps/powerpc/powerpc32/fpu/s_trunc.S       |  83 -----
 sysdeps/powerpc/powerpc32/fpu/s_truncf.S      |  83 -----
 .../powerpc32/power4/fpu/multiarch/Makefile   |  26 +-
 .../power4/fpu/multiarch/s_ceil-power5+.S     |  33 --
 .../power4/fpu/multiarch/s_ceil-power5+.c     |   3 +
 .../power4/fpu/multiarch/s_ceil-ppc32.S       |  31 --
 .../power4/fpu/multiarch/s_ceil-ppc32.c       |   3 +
 .../power4/fpu/multiarch/s_ceilf-power5+.S    |  26 --
 .../power4/fpu/multiarch/s_ceilf-power5+.c    |   3 +
 .../power4/fpu/multiarch/s_ceilf-ppc32.S      |  27 --
 .../power4/fpu/multiarch/s_ceilf-ppc32.c      |   3 +
 .../power4/fpu/multiarch/s_copysign-power6.S  |  33 --
 .../power4/fpu/multiarch/s_copysign-ppc32.S   |  34 --
 .../power4/fpu/multiarch/s_copysign.c         |  45 ---
 .../power4/fpu/multiarch/s_copysignf.c        |  34 --
 .../power4/fpu/multiarch/s_finite-power7.S    |  33 --
 .../power4/fpu/multiarch/s_finite-ppc32.c     |  33 --
 .../powerpc32/power4/fpu/multiarch/s_finite.c |  57 ----
 .../power4/fpu/multiarch/s_finitef-ppc32.c    |  31 --
 .../power4/fpu/multiarch/s_finitef.c          |  34 --
 .../power4/fpu/multiarch/s_floor-power5+.S    |  33 --
 .../power4/fpu/multiarch/s_floor-power5+.c    |   3 +
 .../power4/fpu/multiarch/s_floor-ppc32.S      |  31 --
 .../power4/fpu/multiarch/s_floor-ppc32.c      |   3 +
 .../power4/fpu/multiarch/s_floorf-power5+.S   |  26 --
 .../power4/fpu/multiarch/s_floorf-power5+.c   |   3 +
 .../power4/fpu/multiarch/s_floorf-ppc32.S     |  27 --
 .../power4/fpu/multiarch/s_floorf-ppc32.c     |   3 +
 .../power4/fpu/multiarch/s_isinf-power7.S     |  33 --
 .../power4/fpu/multiarch/s_isinf-ppc32.c      |  33 --
 .../powerpc32/power4/fpu/multiarch/s_isinf.c  |  50 ---
 .../power4/fpu/multiarch/s_isinff-ppc32.c     |  31 --
 .../powerpc32/power4/fpu/multiarch/s_isinff.c |  35 --
 .../power4/fpu/multiarch/s_isnan-power5.S     |  33 --
 .../power4/fpu/multiarch/s_isnan-power6.S     |  33 --
 .../power4/fpu/multiarch/s_isnan-power7.S     |  33 --
 .../power4/fpu/multiarch/s_isnan-ppc32.S      |  32 --
 .../powerpc32/power4/fpu/multiarch/s_isnan.c  |  56 ----
 .../power4/fpu/multiarch/s_isnanf-power5.S    |  28 --
 .../power4/fpu/multiarch/s_isnanf-power6.S    |  28 --
 .../powerpc32/power4/fpu/multiarch/s_isnanf.c |  39 ---
 .../power4/fpu/multiarch/s_llrint-power6.S    |  31 --
 .../power4/fpu/multiarch/s_llrint-power6.c    |   2 +
 .../power4/fpu/multiarch/s_llrint-ppc32.S     |  31 --
 .../power4/fpu/multiarch/s_llrint-ppc32.c     |   2 +
 .../power4/fpu/multiarch/s_llrintf-power6.S   |  26 --
 .../power4/fpu/multiarch/s_llrintf-power6.c   |   2 +
 .../power4/fpu/multiarch/s_llrintf-ppc32.S    |  26 --
 .../power4/fpu/multiarch/s_llrintf-ppc32.c    |   2 +
 .../power4/fpu/multiarch/s_llround-power5+.S  |  31 --
 .../power4/fpu/multiarch/s_llround-power5+.c  |   2 +
 .../power4/fpu/multiarch/s_llround-power6.S   |  31 --
 .../power4/fpu/multiarch/s_llround-power6.c   |   2 +
 .../power4/fpu/multiarch/s_llround-ppc32.S    |  31 --
 .../power4/fpu/multiarch/s_llround-ppc32.c    |   2 +
 .../power4/fpu/multiarch/s_logb-power7.c      |  13 +-
 .../power4/fpu/multiarch/s_logbf-power7.c     |   8 +-
 .../power4/fpu/multiarch/s_logbl-power7.c     |   3 +-
 .../power4/fpu/multiarch/s_lrint-ppc32.S      |  31 --
 .../power4/fpu/multiarch/s_lrint-ppc32.c      |   2 +
 .../power4/fpu/multiarch/s_lround-power5+.S   |  33 --
 .../power4/fpu/multiarch/s_lround-power5+.c   |   2 +
 .../power4/fpu/multiarch/s_lround-ppc32.S     |  31 --
 .../power4/fpu/multiarch/s_lround-ppc32.c     |   2 +
 .../power4/fpu/multiarch/s_modf-power5+.c     |  13 +-
 .../power4/fpu/multiarch/s_modff-power5+.c    |   9 +-
 .../power4/fpu/multiarch/s_round-power5+.S    |  33 --
 .../power4/fpu/multiarch/s_round-power5+.c    |   3 +
 .../power4/fpu/multiarch/s_round-ppc32.S      |  31 --
 .../power4/fpu/multiarch/s_round-ppc32.c      |   3 +
 .../power4/fpu/multiarch/s_roundf-power5+.S   |  26 --
 .../power4/fpu/multiarch/s_roundf-power5+.c   |   3 +
 .../power4/fpu/multiarch/s_roundf-ppc32.S     |  27 --
 .../power4/fpu/multiarch/s_roundf-ppc32.c     |   3 +
 .../power4/fpu/multiarch/s_trunc-power5+.S    |  33 --
 .../power4/fpu/multiarch/s_trunc-power5+.c    |   3 +
 .../power4/fpu/multiarch/s_trunc-ppc32.S      |  31 --
 .../power4/fpu/multiarch/s_trunc-ppc32.c      |   3 +
 .../power4/fpu/multiarch/s_truncf-power5+.S   |  26 --
 .../power4/fpu/multiarch/s_truncf-power5+.c   |   3 +
 .../power4/fpu/multiarch/s_truncf-ppc32.S     |  27 --
 .../power4/fpu/multiarch/s_truncf-ppc32.c     |   3 +
 .../powerpc/powerpc32/power4/fpu/s_llrint.S   |  39 ---
 .../powerpc/powerpc32/power4/fpu/s_llrintf.S  |  39 ---
 .../powerpc/powerpc32/power4/fpu/s_llround.S  | 105 ------
 .../powerpc/powerpc32/power4/fpu/s_llroundf.S |   1 -
 .../powerpc/powerpc32/power5+/fpu/s_ceil.S    |  29 --
 .../powerpc/powerpc32/power5+/fpu/s_ceilf.S   |  30 --
 .../powerpc/powerpc32/power5+/fpu/s_floor.S   |  29 --
 .../powerpc/powerpc32/power5+/fpu/s_floorf.S  |  30 --
 .../powerpc/powerpc32/power5+/fpu/s_llround.S |  53 ---
 .../powerpc32/power5+/fpu/s_llroundf.S        |   1 -
 .../powerpc/powerpc32/power5+/fpu/s_lround.S  |  51 ---
 .../powerpc/powerpc32/power5+/fpu/s_round.S   |  29 --
 .../powerpc/powerpc32/power5+/fpu/s_roundf.S  |  30 --
 .../powerpc/powerpc32/power5+/fpu/s_trunc.S   |  29 --
 .../powerpc/powerpc32/power5+/fpu/s_truncf.S  |  30 --
 .../powerpc/powerpc32/power5/fpu/s_isnan.S    |  61 ----
 .../powerpc/powerpc32/power5/fpu/s_isnanf.S   |  45 ---
 .../powerpc/powerpc32/power6/fpu/s_copysign.S |  49 ---
 .../powerpc32/power6/fpu/s_copysignf.S        |   1 -
 .../powerpc/powerpc32/power6/fpu/s_isnan.S    |  61 ----
 .../powerpc/powerpc32/power6/fpu/s_isnanf.S   |  44 ---
 .../powerpc/powerpc32/power6/fpu/s_llrint.S   |  39 ---
 .../powerpc/powerpc32/power6/fpu/s_llrintf.S  |  39 ---
 .../powerpc/powerpc32/power6/fpu/s_llround.S  |  53 ---
 .../powerpc/powerpc32/power6/fpu/s_llroundf.S |   1 -
 .../powerpc/powerpc32/power7/fpu/s_finite.S   |  93 ------
 .../powerpc/powerpc32/power7/fpu/s_finitef.S  |   1 -
 .../powerpc/powerpc32/power7/fpu/s_isinf.S    |  85 -----
 .../powerpc/powerpc32/power7/fpu/s_isinff.S   |   1 -
 .../powerpc/powerpc32/power7/fpu/s_isnan.S    |  90 ------
 .../powerpc/powerpc32/power7/fpu/s_isnanf.S   |   1 -
 .../powerpc64/be/fpu/multiarch/Makefile       |  65 ++++
 .../be/fpu/multiarch/s_ceil-power5+.c         |   3 +
 .../powerpc64/be/fpu/multiarch/s_ceil-ppc64.c |   3 +
 .../powerpc64/{ => be}/fpu/multiarch/s_ceil.c |   4 +-
 .../be/fpu/multiarch/s_ceilf-power5+.c        |   3 +
 .../be/fpu/multiarch/s_ceilf-ppc64.c          |   3 +
 .../{ => be}/fpu/multiarch/s_ceilf.c          |   4 +-
 .../be/fpu/multiarch/s_floor-power5+.c        |   3 +
 .../be/fpu/multiarch/s_floor-ppc64.c          |   3 +
 .../{ => be}/fpu/multiarch/s_floor.c          |   0
 .../be/fpu/multiarch/s_floorf-power5+.c       |   3 +
 .../be/fpu/multiarch/s_floorf-ppc64.c         |   3 +
 .../{ => be}/fpu/multiarch/s_floorf.c         |   0
 .../be/fpu/multiarch/s_llrint-power6x.c       |   2 +
 .../be/fpu/multiarch/s_llrint-power8.c        |   2 +
 .../be/fpu/multiarch/s_llrint-ppc64.c         |   2 +
 .../{ => be}/fpu/multiarch/s_llrint.c         |   0
 .../{ => be}/fpu/multiarch/s_llrintf.c        |   0
 .../be/fpu/multiarch/s_llround-power5+.c      |   2 +
 .../be/fpu/multiarch/s_llround-power6x.c      |   2 +
 .../be/fpu/multiarch/s_llround-power8.c       |   2 +
 .../be/fpu/multiarch/s_llround-ppc64.c        |   2 +
 .../{ => be}/fpu/multiarch/s_llround.c        |   0
 .../be/fpu/multiarch/s_llroundf-ppc64.c       |   2 +
 .../{ => be}/fpu/multiarch/s_llroundf.c       |   0
 .../{ => be}/fpu/multiarch/s_logb-power7.c    |   3 +-
 .../{ => be}/fpu/multiarch/s_logb-ppc64.c     |   0
 .../powerpc64/{ => be}/fpu/multiarch/s_logb.c |   0
 .../{ => be}/fpu/multiarch/s_logbf-power7.c   |   3 +-
 .../{ => be}/fpu/multiarch/s_logbf-ppc64.c    |   0
 .../{ => be}/fpu/multiarch/s_logbf.c          |   0
 .../{ => be}/fpu/multiarch/s_logbl-power7.c   |   3 +-
 .../{ => be}/fpu/multiarch/s_logbl-ppc64.c    |   0
 .../{ => be}/fpu/multiarch/s_logbl.c          |   0
 .../{ => be}/fpu/multiarch/s_lrint.c          |   0
 .../{ => be}/fpu/multiarch/s_lround.c         |   0
 .../{ => be}/fpu/multiarch/s_modf-power5+.c   |   3 +-
 .../{ => be}/fpu/multiarch/s_modf-ppc64.c     |   0
 .../powerpc64/{ => be}/fpu/multiarch/s_modf.c |   0
 .../{ => be}/fpu/multiarch/s_modff-power5+.c  |   3 +-
 .../{ => be}/fpu/multiarch/s_modff-ppc64.c    |   0
 .../{ => be}/fpu/multiarch/s_modff.c          |   0
 .../be/fpu/multiarch/s_round-power5+.c        |   3 +
 .../be/fpu/multiarch/s_round-ppc64.c          |   3 +
 .../{ => be}/fpu/multiarch/s_round.c          |   0
 .../be/fpu/multiarch/s_roundf-power5+.c       |   3 +
 .../be/fpu/multiarch/s_roundf-ppc64.c         |   3 +
 .../{ => be}/fpu/multiarch/s_roundf.c         |   2 -
 .../be/fpu/multiarch/s_trunc-power5+.c        |   3 +
 .../be/fpu/multiarch/s_trunc-ppc64.c          |   3 +
 .../{ => be}/fpu/multiarch/s_trunc.c          |   0
 .../be/fpu/multiarch/s_truncf-power5+.c       |   3 +
 .../be/fpu/multiarch/s_truncf-ppc64.c         |   3 +
 .../{ => be}/fpu/multiarch/s_truncf.c         |   2 -
 sysdeps/powerpc/powerpc64/fpu/Makefile        |   7 +
 .../powerpc/powerpc64/fpu/multiarch/Makefile  |  44 ---
 .../powerpc64/fpu/multiarch/e_expf-power8.S   |  24 --
 .../powerpc64/fpu/multiarch/e_expf-ppc64.c    |  21 --
 .../powerpc/powerpc64/fpu/multiarch/e_expf.c  |  32 --
 .../powerpc64/fpu/multiarch/e_hypot-power7.c  |  19 --
 .../powerpc64/fpu/multiarch/e_hypot-ppc64.c   |  26 --
 .../powerpc/powerpc64/fpu/multiarch/e_hypot.c |  33 --
 .../powerpc64/fpu/multiarch/e_hypotf-power7.c |  19 --
 .../powerpc64/fpu/multiarch/e_hypotf-ppc64.c  |  26 --
 .../powerpc64/fpu/multiarch/e_hypotf.c        |  33 --
 .../powerpc64/fpu/multiarch/s_ceil-power5+.S  |  30 --
 .../powerpc64/fpu/multiarch/s_ceil-ppc64.S    |  30 --
 .../powerpc64/fpu/multiarch/s_ceilf-power5+.S |  24 --
 .../powerpc64/fpu/multiarch/s_ceilf-ppc64.S   |  24 --
 .../fpu/multiarch/s_copysign-power6.S         |  32 --
 .../fpu/multiarch/s_copysign-ppc64.S          |  34 --
 .../powerpc64/fpu/multiarch/s_copysign.c      |  45 ---
 .../powerpc64/fpu/multiarch/s_copysignf.c     |  34 --
 .../powerpc64/fpu/multiarch/s_finite-power7.S |  32 --
 .../powerpc64/fpu/multiarch/s_finite-power8.S |  32 --
 .../powerpc64/fpu/multiarch/s_finite-ppc64.c  |  34 --
 .../powerpc64/fpu/multiarch/s_finite.c        |  69 ----
 .../powerpc64/fpu/multiarch/s_finitef-ppc64.c |  32 --
 .../powerpc64/fpu/multiarch/s_finitef.c       |  37 ---
 .../powerpc64/fpu/multiarch/s_floor-power5+.S |  30 --
 .../powerpc64/fpu/multiarch/s_floor-ppc64.S   |  30 --
 .../fpu/multiarch/s_floorf-power5+.S          |  24 --
 .../powerpc64/fpu/multiarch/s_floorf-ppc64.S  |  24 --
 .../powerpc64/fpu/multiarch/s_isinf-power7.S  |  32 --
 .../powerpc64/fpu/multiarch/s_isinf-power8.S  |  32 --
 .../powerpc64/fpu/multiarch/s_isinf-ppc64.c   |  33 --
 .../powerpc/powerpc64/fpu/multiarch/s_isinf.c |  62 ----
 .../powerpc64/fpu/multiarch/s_isinff-ppc64.c  |  31 --
 .../powerpc64/fpu/multiarch/s_isinff.c        |  38 ---
 .../powerpc64/fpu/multiarch/s_isnan-power5.S  |  32 --
 .../powerpc64/fpu/multiarch/s_isnan-power6.S  |  32 --
 .../powerpc64/fpu/multiarch/s_isnan-power6x.S |  32 --
 .../powerpc64/fpu/multiarch/s_isnan-power7.S  |  32 --
 .../powerpc64/fpu/multiarch/s_isnan-power8.S  |  32 --
 .../powerpc64/fpu/multiarch/s_isnan-ppc64.S   |  36 ---
 .../powerpc/powerpc64/fpu/multiarch/s_isnan.c |  71 ----
 .../powerpc64/fpu/multiarch/s_isnanf.c        |  44 ---
 .../fpu/multiarch/s_llrint-power6x.S          |  30 --
 .../powerpc64/fpu/multiarch/s_llrint-power8.S |  30 --
 .../powerpc64/fpu/multiarch/s_llrint-ppc64.S  |  30 --
 .../fpu/multiarch/s_llround-power5+.S         |  31 --
 .../fpu/multiarch/s_llround-power6x.S         |  31 --
 .../fpu/multiarch/s_llround-power8.S          |  30 --
 .../powerpc64/fpu/multiarch/s_llround-ppc64.S |  27 --
 .../fpu/multiarch/s_llroundf-ppc64.S          |  31 --
 .../powerpc64/fpu/multiarch/s_round-power5+.S |  30 --
 .../powerpc64/fpu/multiarch/s_round-ppc64.S   |  30 --
 .../fpu/multiarch/s_roundf-power5+.S          |  24 --
 .../powerpc64/fpu/multiarch/s_roundf-ppc64.S  |  24 --
 .../powerpc64/fpu/multiarch/s_trunc-power5+.S |  30 --
 .../powerpc64/fpu/multiarch/s_trunc-ppc64.S   |  30 --
 .../fpu/multiarch/s_truncf-power5+.S          |  24 --
 .../powerpc64/fpu/multiarch/s_truncf-ppc64.S  |  24 --
 .../powerpc/powerpc64/fpu/multiarch/w_expf.c  |   1 -
 sysdeps/powerpc/powerpc64/fpu/s_ceil.S        |  65 ----
 sysdeps/powerpc/powerpc64/fpu/s_ceilf.S       |  67 ----
 sysdeps/powerpc/powerpc64/fpu/s_copysign.S    |  53 ---
 sysdeps/powerpc/powerpc64/fpu/s_copysignf.S   |   1 -
 sysdeps/powerpc/powerpc64/fpu/s_floor.S       |  65 ----
 sysdeps/powerpc/powerpc64/fpu/s_floorf.S      |  67 ----
 sysdeps/powerpc/powerpc64/fpu/s_isnan.S       |  56 ----
 sysdeps/powerpc/powerpc64/fpu/s_llrint.S      |  45 ---
 sysdeps/powerpc/powerpc64/fpu/s_llrint.c      |  55 ++++
 sysdeps/powerpc/powerpc64/fpu/s_llrintf.S     |   1 -
 sysdeps/powerpc/powerpc64/fpu/s_llrintf.c     |   1 +
 sysdeps/powerpc/powerpc64/fpu/s_llround.S     |  86 -----
 sysdeps/powerpc/powerpc64/fpu/s_llround.c     |  83 +++++
 sysdeps/powerpc/powerpc64/fpu/s_llroundf.S    |  89 -----
 sysdeps/powerpc/powerpc64/fpu/s_llroundf.c    |  83 +++++
 sysdeps/powerpc/powerpc64/fpu/s_lrint.S       |   1 -
 sysdeps/powerpc/powerpc64/fpu/s_lrint.c       |   1 +
 sysdeps/powerpc/powerpc64/fpu/s_lround.S      |   1 -
 sysdeps/powerpc/powerpc64/fpu/s_lround.c      |   1 +
 sysdeps/powerpc/powerpc64/fpu/s_lroundf.S     |   1 -
 sysdeps/powerpc/powerpc64/fpu/s_lroundf.c     |   1 +
 sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S   |  68 ----
 sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S  |  69 ----
 sysdeps/powerpc/powerpc64/fpu/s_rint.S        |  58 ----
 sysdeps/powerpc/powerpc64/fpu/s_rintf.S       |  57 ----
 sysdeps/powerpc/powerpc64/fpu/s_round.S       |  80 -----
 sysdeps/powerpc/powerpc64/fpu/s_roundf.S      |  82 -----
 sysdeps/powerpc/powerpc64/fpu/s_trunc.S       |  72 -----
 sysdeps/powerpc/powerpc64/fpu/s_truncf.S      |  74 -----
 .../powerpc/powerpc64/power5+/fpu/s_ceil.S    |  30 --
 .../powerpc/powerpc64/power5+/fpu/s_ceilf.S   |  31 --
 .../powerpc/powerpc64/power5+/fpu/s_floor.S   |  30 --
 .../powerpc/powerpc64/power5+/fpu/s_floorf.S  |  31 --
 .../powerpc/powerpc64/power5+/fpu/s_llround.S |  56 ----
 .../powerpc64/power5+/fpu/s_llroundf.S        |   1 -
 .../powerpc/powerpc64/power5+/fpu/s_round.S   |  30 --
 .../powerpc/powerpc64/power5+/fpu/s_roundf.S  |  31 --
 .../powerpc/powerpc64/power5+/fpu/s_trunc.S   |  30 --
 .../powerpc/powerpc64/power5+/fpu/s_truncf.S  |  31 --
 .../powerpc/powerpc64/power5/fpu/s_isnan.S    |  60 ----
 .../powerpc/powerpc64/power6/fpu/s_copysign.S |  49 ---
 .../powerpc64/power6/fpu/s_copysignf.S        |   1 -
 .../powerpc/powerpc64/power6/fpu/s_isnan.S    |  59 ----
 .../powerpc/powerpc64/power6x/fpu/s_isnan.S   |  58 ----
 .../powerpc/powerpc64/power6x/fpu/s_llrint.S  |  42 ---
 .../powerpc/powerpc64/power6x/fpu/s_llround.S |  52 ---
 .../powerpc64/power6x/fpu/s_llroundf.S        |   1 -
 .../powerpc/powerpc64/power7/fpu/s_finite.S   |  70 ----
 .../powerpc/powerpc64/power7/fpu/s_finitef.S  |   1 -
 .../powerpc/powerpc64/power7/fpu/s_isinf.S    |  69 ----
 .../powerpc/powerpc64/power7/fpu/s_isinff.S   |   1 -
 .../powerpc/powerpc64/power7/fpu/s_isnan.S    |  68 ----
 .../powerpc/powerpc64/power7/fpu/s_isnanf.S   |   1 -
 sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c |   1 -
 .../powerpc/powerpc64/power7/fpu/s_logbf.c    |   1 -
 .../powerpc/powerpc64/power7/fpu/s_logbl.c    |   1 -
 sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S | 303 ------------------
 .../powerpc/powerpc64/power8/fpu/s_finite.S   |  56 ----
 .../powerpc/powerpc64/power8/fpu/s_finitef.S  |   1 -
 .../powerpc/powerpc64/power8/fpu/s_isinf.S    |  61 ----
 .../powerpc/powerpc64/power8/fpu/s_isinff.S   |   1 -
 .../powerpc/powerpc64/power8/fpu/s_isnan.S    |  56 ----
 .../powerpc/powerpc64/power8/fpu/s_isnanf.S   |   1 -
 .../powerpc/powerpc64/power8/fpu/s_llrint.S   |  43 ---
 .../powerpc/powerpc64/power8/fpu/s_llround.S  |  46 ---
 .../powerpc/powerpc64/power8/fpu/s_llroundf.S |   1 -
 sysdeps/powerpc/powerpc64/power8/fpu/w_expf.c |   1 -
 363 files changed, 1494 insertions(+), 9311 deletions(-)
 create mode 100644 benchtests/hypot-inputs
 create mode 100644 benchtests/isfinite-inputs
 create mode 100644 benchtests/isinf-inputs
 create mode 100644 benchtests/isnan-inputs
 create mode 100644 benchtests/logb-inputs
 create mode 100644 benchtests/logbf-inputs
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
 create mode 100644 sysdeps/powerpc/fpu/round_to_integer.h
 create mode 100644 sysdeps/powerpc/fpu/s_ceil.c
 create mode 100644 sysdeps/powerpc/fpu/s_ceilf.c
 create mode 100644 sysdeps/powerpc/fpu/s_copysign.c
 create mode 100644 sysdeps/powerpc/fpu/s_copysignf.c
 delete mode 100644 sysdeps/powerpc/fpu/s_fabs.S
 delete mode 100644 sysdeps/powerpc/fpu/s_fabsf.S
 create mode 100644 sysdeps/powerpc/fpu/s_floor.c
 create mode 100644 sysdeps/powerpc/fpu/s_floorf.c
 rename sysdeps/powerpc/fpu/{s_fma.S => s_fma.c} (82%)
 rename sysdeps/powerpc/fpu/{s_fmaf.S => s_fmaf.c} (82%)
 delete mode 100644 sysdeps/powerpc/fpu/s_isnan.c
 delete mode 100644 sysdeps/powerpc/fpu/s_isnanf.S
 rename sysdeps/powerpc/{power7 => }/fpu/s_logb.c (56%)
 rename sysdeps/powerpc/{power7 => }/fpu/s_logbf.c (67%)
 rename sysdeps/powerpc/{power7 => }/fpu/s_logbl.c (72%)
 delete mode 100644 sysdeps/powerpc/fpu/s_lrintf.S
 create mode 100644 sysdeps/powerpc/fpu/s_lrintf.c
 rename sysdeps/powerpc/{power5+ => }/fpu/s_modf.c (74%)
 rename sysdeps/powerpc/{power5+ => }/fpu/s_modff.c (77%)
 create mode 100644 sysdeps/powerpc/fpu/s_nearbyint.c
 create mode 100644 sysdeps/powerpc/fpu/s_nearbyintf.c
 create mode 100644 sysdeps/powerpc/fpu/s_round.c
 create mode 100644 sysdeps/powerpc/fpu/s_roundf.c
 create mode 100644 sysdeps/powerpc/fpu/s_trunc.c
 create mode 100644 sysdeps/powerpc/fpu/s_truncf.c
 delete mode 100644 sysdeps/powerpc/power4/fpu/Makefile
 delete mode 100644 sysdeps/powerpc/power4/fpu/mpa-arch.h
 delete mode 100644 sysdeps/powerpc/power4/fpu/mpa.c
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_ceil.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_copysign.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_copysignf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_floor.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_floorf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_lrint.S
 create mode 100644 sysdeps/powerpc/powerpc32/fpu/s_lrint.c
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_lround.S
 create mode 100644 sysdeps/powerpc/powerpc32/fpu/s_lround.c
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_rint.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_rintf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_round.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_roundf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_trunc.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_truncf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llroundf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_llroundf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llroundf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_ceil.c (95%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_ceilf.c (95%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_floor.c (100%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_floorf.c (100%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llrint.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llrintf.c (100%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power6x.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power8.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llround.c (100%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llroundf.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logb-power7.c (91%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logb-ppc64.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logb.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbf-power7.c (91%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbf-ppc64.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbf.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbl-power7.c (91%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbl-ppc64.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_logbl.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_lrint.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_lround.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modf-power5+.c (91%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modf-ppc64.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modf.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modff-power5+.c (91%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modff-ppc64.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_modff.c (100%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_round.c (100%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_roundf.c (95%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_trunc.c (100%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_truncf.c (95%)
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/Makefile
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-power8.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-power7.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypot.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-power7.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/e_hypotf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/w_expf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_ceil.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_copysign.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_copysignf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_floor.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_floorf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrint.S
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrint.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrintf.S
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrintf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llround.S
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llround.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llroundf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lrint.S
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lrint.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lround.S
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lround.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lroundf.S
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lroundf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_rint.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_rintf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_round.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_roundf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_trunc.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_truncf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_llroundf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power6x/fpu/s_llroundf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_llroundf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/w_expf.c

--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 01/28] powerpc: Use generic fabs{f} implementations

Adhemerval Zanella-2
Since be2e25bbd78f9fdf the generic ieee754 implementation uses
compiler builtin which generates fabs{f} for all supported targets.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/fpu/s_fabs.S: Remove file.
        * sysdeps/powerpc/fpu/s_fabsf.S: Likewise.
---
 sysdeps/powerpc/fpu/s_fabs.S  | 33 ---------------------------------
 sysdeps/powerpc/fpu/s_fabsf.S |  1 -
 2 files changed, 34 deletions(-)
 delete mode 100644 sysdeps/powerpc/fpu/s_fabs.S
 delete mode 100644 sysdeps/powerpc/fpu/s_fabsf.S

diff --git a/sysdeps/powerpc/fpu/s_fabs.S b/sysdeps/powerpc/fpu/s_fabs.S
deleted file mode 100644
index 7147f6b4a2..0000000000
--- a/sysdeps/powerpc/fpu/s_fabs.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Floating-point absolute value.  PowerPC version.
-   Copyright (C) 1997-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
-ENTRY(__fabs)
-/* double [f1] fabs (double [f1] x); */
- fabs fp1,fp1
- blr
-END(__fabs)
-
-libm_alias_double (__fabs, fabs)
-
-/* It turns out that it's safe to use this code even for single-precision.  */
-strong_alias(__fabs,__fabsf)
-libm_alias_float (__fabs, fabs)
diff --git a/sysdeps/powerpc/fpu/s_fabsf.S b/sysdeps/powerpc/fpu/s_fabsf.S
deleted file mode 100644
index 877c710ce8..0000000000
--- a/sysdeps/powerpc/fpu/s_fabsf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* __fabsf is in s_fabs.S  */
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 02/28] powerpc: fma using builtins

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patch just refactor the assembly implementation to use compiler
builtins instead.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/fpu/s_fma.S: Remove file.
        * sysdeps/powerpc/fpu/s_fmaf.S: Likewise.
        * sysdeps/powerpc/fpu/s_fma.c: New file.
        * sysdeps/powerpc/fpu/s_fmaf.c: Likewise.
---
 sysdeps/powerpc/fpu/{s_fma.S => s_fma.c}   | 12 +++++-------
 sysdeps/powerpc/fpu/{s_fmaf.S => s_fmaf.c} | 12 +++++-------
 2 files changed, 10 insertions(+), 14 deletions(-)
 rename sysdeps/powerpc/fpu/{s_fma.S => s_fma.c} (82%)
 rename sysdeps/powerpc/fpu/{s_fmaf.S => s_fmaf.c} (82%)

diff --git a/sysdeps/powerpc/fpu/s_fma.S b/sysdeps/powerpc/fpu/s_fma.c
similarity index 82%
rename from sysdeps/powerpc/fpu/s_fma.S
rename to sysdeps/powerpc/fpu/s_fma.c
index 92e08eb583..688f9badf5 100644
--- a/sysdeps/powerpc/fpu/s_fma.S
+++ b/sysdeps/powerpc/fpu/s_fma.c
@@ -1,5 +1,5 @@
 /* Compute x * y + z as ternary operation.  PowerPC version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
+   Copyright (C) 2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,10 +19,8 @@
 #include <sysdep.h>
 #include <libm-alias-double.h>
 
-ENTRY_TOCLESS(__fma)
-/* double [f1] fma (double [f1] x, double [f2] y, double [f3] z); */
- fmadd fp1,fp1,fp2,fp3
- blr
-END(__fma)
-
+double __fma (double x, double y, double z)
+{
+  return __builtin_fma (x, y, z);
+}
 libm_alias_double (__fma, fma)
diff --git a/sysdeps/powerpc/fpu/s_fmaf.S b/sysdeps/powerpc/fpu/s_fmaf.c
similarity index 82%
rename from sysdeps/powerpc/fpu/s_fmaf.S
rename to sysdeps/powerpc/fpu/s_fmaf.c
index 9579e9492e..38b59e1f2f 100644
--- a/sysdeps/powerpc/fpu/s_fmaf.S
+++ b/sysdeps/powerpc/fpu/s_fmaf.c
@@ -1,5 +1,5 @@
 /* Compute x * y + z as ternary operation.  PowerPC version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
+   Copyright (C) 2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,10 +19,8 @@
 #include <sysdep.h>
 #include <libm-alias-float.h>
 
-ENTRY_TOCLESS(__fmaf)
-/* float [f1] fmaf (float [f1] x, float [f2] y, float [f3] z); */
- fmadds fp1,fp1,fp2,fp3
- blr
-END(__fmaf)
-
+float __fmaf (float x, float y, float z)
+{
+  return __builtin_fmaf (x, y, z);
+}
 libm_alias_float (__fma, fma)
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 03/28] powerpc: Remove power4 mpa optimization

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patch removes the POWER4 optimized mpa optimization used for power4+
build.  For newer chips, GCC generates *worse* code than generic
implementation as benchmaks result below.  One possibilty would to add
IFUNC variants for the mpa routines (as x86_64), but it will add complexity
only for older chips (and one would need to check if power5, power5+, and
power6 do benefict from this optimization), and only for specific
implementation (since most used ones such as sin, cos, exp, pow already
avoid calling the slow multiprecision path).

  * POWER9 patched
    "atan": {
     "": {
      "duration": 5.12565e+09,
      "iterations": 1.552e+08,
      "max": 100.552,
      "min": 7.799,
      "mean": 33.0261
     },
     "144bits": {
      "duration": 5.12745e+09,
      "iterations": 825000,
      "max": 7517.17,
      "min": 6186.3,
      "mean": 6215.09
     }
    }
    "acos": {
     "": {
      "duration": 5.21741e+09,
      "iterations": 1.269e+08,
      "max": 191.738,
      "min": 7.931,
      "mean": 41.1144
     },
     "slow": {
      "duration": 5.25999e+09,
      "iterations": 198000,
      "max": 26681.7,
      "min": 26463.6,
      "mean": 26565.6
     }
    }

  * POWER9 master
    "atan": {
     "": {
      "duration": 5.12815e+09,
      "iterations": 1.552e+08,
      "max": 134.788,
      "min": 7.803,
      "mean": 33.0422
     },
     "144bits": {
      "duration": 5.1209e+09,
      "iterations": 447000,
      "max": 11615.8,
      "min": 11301.8,
      "mean": 11456.2
     }
    }
    "acos": {
     "": {
      "duration": 5.22272e+09,
      "iterations": 1.269e+08,
      "max": 115.981,
      "min": 7.931,
      "mean": 41.1562
     },
     "slow": {
      "duration": 5.28723e+09,
      "iterations": 96000,
      "max": 55434.1,
      "min": 54820.6,
      "mean": 55075.3
     }
    }

  * POWER8 patched
    "acos": {
     "": {
      "duration": 5.16398e+09,
      "iterations": 9.99e+07,
      "max": 174.408,
      "min": 8.645,
      "mean": 51.6915
     },
     "slow": {
      "duration": 5.16982e+09,
      "iterations": 96000,
      "max": 54830.5,
      "min": 53703.8,
      "mean": 53852.3
     }
    }
  * POWER8 master
    "acos": {
     "": {
      "duration": 5.17019e+09,
      "iterations": 9.99e+07,
      "max": 186.127,
      "min": 8.633,
      "mean": 51.7537
     },
     "slow": {
      "duration": 5.34225e+09,
      "iterations": 90000,
      "max": 60353.2,
      "min": 59155.3,
      "mean": 59358.4
     }
    }

  * POWER7 patched
    "asin": {
     "": {
      "duration": 5.15559e+09,
      "iterations": 6.5e+07,
      "max": 193.335,
      "min": 12.227,
      "mean": 79.3168
     },
     "slow": {
      "duration": 5.20538e+09,
      "iterations": 80000,
      "max": 65705.2,
      "min": 64299.4,
      "mean": 65067.3
     }
    }
  * POWER7 master
    "asin": {
     "": {
      "duration": 5.15446e+09,
      "iterations": 6.5e+07,
      "max": 184.575,
      "min": 12.226,
      "mean": 79.2994
     },
     "slow": {
      "duration": 5.20616e+09,
      "iterations": 80000,
      "max": 65705.1,
      "min": 64336.6,
      "mean": 65076.9
     }
    }

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/power4/fpu/Makefile: Remove file.
        * sysdeps/powerpc/power4/fpu/mpa-arch.h: Likewise.
        * sysdeps/powerpc/power4/fpu/mpa.c: Likewise.
---
 sysdeps/powerpc/power4/fpu/Makefile   |   5 -
 sysdeps/powerpc/power4/fpu/mpa-arch.h |  56 -------
 sysdeps/powerpc/power4/fpu/mpa.c      | 214 --------------------------
 3 files changed, 275 deletions(-)
 delete mode 100644 sysdeps/powerpc/power4/fpu/Makefile
 delete mode 100644 sysdeps/powerpc/power4/fpu/mpa-arch.h
 delete mode 100644 sysdeps/powerpc/power4/fpu/mpa.c

diff --git a/sysdeps/powerpc/power4/fpu/Makefile b/sysdeps/powerpc/power4/fpu/Makefile
deleted file mode 100644
index f487ed6014..0000000000
--- a/sysdeps/powerpc/power4/fpu/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# Makefile fragment for POWER4/5/5+ with FPU.
-
-ifeq ($(subdir),math)
-CFLAGS-mpa.c += --param max-unroll-times=4 -funroll-loops -fpeel-loops
-endif
diff --git a/sysdeps/powerpc/power4/fpu/mpa-arch.h b/sysdeps/powerpc/power4/fpu/mpa-arch.h
deleted file mode 100644
index 929c60b314..0000000000
--- a/sysdeps/powerpc/power4/fpu/mpa-arch.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Overridable constants and operations.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published by
-   the Free Software Foundation; either version 2.1 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
-
-typedef double mantissa_t;
-typedef double mantissa_store_t;
-
-#define TWOPOW(i) (0x1.0p##i)
-
-#define RADIX TWOPOW (24) /* 2^24    */
-#define CUTTER TWOPOW (76) /* 2^76    */
-#define RADIXI 0x1.0p-24 /* 2^-24 */
-#define TWO52 TWOPOW (52) /* 2^52 */
-
-/* Divide D by RADIX and put the remainder in R.  */
-#define DIV_RADIX(d,r) \
-  ({      \
-    double u = ((d) + CUTTER) - CUTTER;      \
-    if (u > (d))      \
-      u -= RADIX;      \
-    r = (d) - u;      \
-    (d) = u * RADIXI;      \
-  })
-
-/* Put the integer component of a double X in R and retain the fraction in
-   X.  */
-#define INTEGER_OF(x, r) \
-  ({      \
-    double u = ((x) + TWO52) - TWO52;      \
-    if (u > (x))      \
-      u -= 1;      \
-    (r) = u;      \
-    (x) -= u;      \
-  })
-
-/* Align IN down to a multiple of F, where F is a power of two.  */
-#define ALIGN_DOWN_TO(in, f) \
-  ({      \
-    double factor = f * TWO52;      \
-    double u = (in + factor) - factor;      \
-    if (u > in)      \
-      u -= f;      \
-    u;      \
-  })
diff --git a/sysdeps/powerpc/power4/fpu/mpa.c b/sysdeps/powerpc/power4/fpu/mpa.c
deleted file mode 100644
index 1be2e93cb7..0000000000
--- a/sysdeps/powerpc/power4/fpu/mpa.c
+++ /dev/null
@@ -1,214 +0,0 @@
-
-/*
- * IBM Accurate Mathematical Library
- * written by International Business Machines Corp.
- * Copyright (C) 2001-2019 Free Software Foundation, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/* Define __mul and __sqr and use the rest from generic code.  */
-#define NO__MUL
-#define NO__SQR
-
-#include <sysdeps/ieee754/dbl-64/mpa.c>
-
-/* Multiply *X and *Y and store result in *Z.  X and Y may overlap but not X
-   and Z or Y and Z.  For P in [1, 2, 3], the exact result is truncated to P
-   digits.  In case P > 3 the error is bounded by 1.001 ULP.  */
-void
-__mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
-{
-  long i, i1, i2, j, k, k2;
-  long p2 = p;
-  double u, zk, zk2;
-
-  /* Is z=0?  */
-  if (__glibc_unlikely (X[0] * Y[0] == 0))
-    {
-      Z[0] = 0;
-      return;
-    }
-
-  /* Multiply, add and carry */
-  k2 = (p2 < 3) ? p2 + p2 : p2 + 3;
-  zk = Z[k2] = 0;
-  for (k = k2; k > 1;)
-    {
-      if (k > p2)
- {
-  i1 = k - p2;
-  i2 = p2 + 1;
- }
-      else
- {
-  i1 = 1;
-  i2 = k;
- }
-#if 1
-      /* Rearrange this inner loop to allow the fmadd instructions to be
-         independent and execute in parallel on processors that have
-         dual symmetrical FP pipelines.  */
-      if (i1 < (i2 - 1))
- {
-  /* Make sure we have at least 2 iterations.  */
-  if (((i2 - i1) & 1L) == 1L)
-    {
-      /* Handle the odd iterations case.  */
-      zk2 = x->d[i2 - 1] * y->d[i1];
-    }
-  else
-    zk2 = 0.0;
-  /* Do two multiply/adds per loop iteration, using independent
-     accumulators; zk and zk2.  */
-  for (i = i1, j = i2 - 1; i < i2 - 1; i += 2, j -= 2)
-    {
-      zk += x->d[i] * y->d[j];
-      zk2 += x->d[i + 1] * y->d[j - 1];
-    }
-  zk += zk2; /* Final sum.  */
- }
-      else
- {
-  /* Special case when iterations is 1.  */
-  zk += x->d[i1] * y->d[i1];
- }
-#else
-      /* The original code.  */
-      for (i = i1, j = i2 - 1; i < i2; i++, j--)
- zk += X[i] * Y[j];
-#endif
-
-      u = (zk + CUTTER) - CUTTER;
-      if (u > zk)
- u -= RADIX;
-      Z[k] = zk - u;
-      zk = u * RADIXI;
-      --k;
-    }
-  Z[k] = zk;
-
-  int e = EX + EY;
-  /* Is there a carry beyond the most significant digit?  */
-  if (Z[1] == 0)
-    {
-      for (i = 1; i <= p2; i++)
- Z[i] = Z[i + 1];
-      e--;
-    }
-
-  EZ = e;
-  Z[0] = X[0] * Y[0];
-}
-
-/* Square *X and store result in *Y.  X and Y may not overlap.  For P in
-   [1, 2, 3], the exact result is truncated to P digits.  In case P > 3 the
-   error is bounded by 1.001 ULP.  This is a faster special case of
-   multiplication.  */
-void
-__sqr (const mp_no *x, mp_no *y, int p)
-{
-  long i, j, k, ip;
-  double u, yk;
-
-  /* Is z=0?  */
-  if (__glibc_unlikely (X[0] == 0))
-    {
-      Y[0] = 0;
-      return;
-    }
-
-  /* We need not iterate through all X's since it's pointless to
-     multiply zeroes.  */
-  for (ip = p; ip > 0; ip--)
-    if (X[ip] != 0)
-      break;
-
-  k = (__glibc_unlikely (p < 3)) ? p + p : p + 3;
-
-  while (k > 2 * ip + 1)
-    Y[k--] = 0;
-
-  yk = 0;
-
-  while (k > p)
-    {
-      double yk2 = 0.0;
-      long lim = k / 2;
-
-      if (k % 2 == 0)
-        {
-  yk += X[lim] * X[lim];
-  lim--;
- }
-
-      /* In __mul, this loop (and the one within the next while loop) run
-         between a range to calculate the mantissa as follows:
-
-         Z[k] = X[k] * Y[n] + X[k+1] * Y[n-1] ... + X[n-1] * Y[k+1]
- + X[n] * Y[k]
-
-         For X == Y, we can get away with summing halfway and doubling the
- result.  For cases where the range size is even, the mid-point needs
- to be added separately (above).  */
-      for (i = k - p, j = p; i <= lim; i++, j--)
- yk2 += X[i] * X[j];
-
-      yk += 2.0 * yk2;
-
-      u = (yk + CUTTER) - CUTTER;
-      if (u > yk)
- u -= RADIX;
-      Y[k--] = yk - u;
-      yk = u * RADIXI;
-    }
-
-  while (k > 1)
-    {
-      double yk2 = 0.0;
-      long lim = k / 2;
-
-      if (k % 2 == 0)
-        {
-  yk += X[lim] * X[lim];
-  lim--;
- }
-
-      /* Likewise for this loop.  */
-      for (i = 1, j = k - 1; i <= lim; i++, j--)
- yk2 += X[i] * X[j];
-
-      yk += 2.0 * yk2;
-
-      u = (yk + CUTTER) - CUTTER;
-      if (u > yk)
- u -= RADIX;
-      Y[k--] = yk - u;
-      yk = u * RADIXI;
-    }
-  Y[k] = yk;
-
-  /* Squares are always positive.  */
-  Y[0] = 1.0;
-
-  int e = EX * 2;
-  /* Is there a carry beyond the most significant digit?  */
-  if (__glibc_unlikely (Y[1] == 0))
-    {
-      for (i = 1; i <= p; i++)
- Y[i] = Y[i + 1];
-      e--;
-    }
-  EY = e;
-}
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 04/28] powerpc: ceil/ceilf refactor

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patches consolidates all the powerpc ceil{f} implementations on
the generic sysdeps/powerpc/fpu/s_ceil{f}.  The generic implementation
uses either the compiler builts for ISA 2.03+ (which generates the frip
instruction) or a generic implementation which uses FP only operations.

It adds a generic implementation (round_to_integer.h) which is shared
with other rounding to integer routines.  The resulting code should be
similar performance-wise to previous assembly one.

The IFUNC organization for powerpc64 is also change to be enabled only
for powerpc64 and not for powerpc64le.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/fpu/fenv_libc.h (__fesetround_inline_nocheck): New
        macro.
        * sysdeps/powerpc/fpu/round_to_integer.h: New file.
        * sysdeps/powerpc/fpu/s_ceil.c: Likewise.
        * sysdeps/powerpc/fpu/s_ceilf.c: Likewise.
        * sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Remove file.
        * sysdeps/powerpc/powerpc32/fpu/s_ceilf.S: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
        (CFLAGS-s_ceil-power5+.c, CFLAGS-s_ceilf-power5+.c): New rule.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S:
        Remove file.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c:
        New file.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S: Remove file.
        * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S: Likewise.
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile: New file.
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c:
        Likewise.
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c: Move to ...
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c: ... here.
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c: New
        file.
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c: Move to ...
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c: ...
        * here.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
        (libm-sysdep_routines): Remove s_ceil-power5+, s_ceil-ppc64,
        s_ceilf-power5+, and s_ceilf-ppc64.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S: Remove
        file.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise.
        * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise.
        * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise.
---
 sysdeps/powerpc/fpu/fenv_libc.h               |   8 ++
 sysdeps/powerpc/fpu/round_to_integer.h        | 109 ++++++++++++++++++
 sysdeps/powerpc/fpu/s_ceil.c                  |  35 ++++++
 sysdeps/powerpc/fpu/s_ceilf.c                 |  35 ++++++
 sysdeps/powerpc/powerpc32/fpu/s_ceil.S        |  76 ------------
 sysdeps/powerpc/powerpc32/fpu/s_ceilf.S       |  76 ------------
 .../powerpc32/power4/fpu/multiarch/Makefile   |   2 +
 .../power4/fpu/multiarch/s_ceil-power5+.S     |  33 ------
 .../power4/fpu/multiarch/s_ceil-power5+.c     |   3 +
 .../power4/fpu/multiarch/s_ceil-ppc32.S       |  31 -----
 .../power4/fpu/multiarch/s_ceil-ppc32.c       |   3 +
 .../power4/fpu/multiarch/s_ceilf-power5+.S    |  26 -----
 .../power4/fpu/multiarch/s_ceilf-power5+.c    |   3 +
 .../power4/fpu/multiarch/s_ceilf-ppc32.S      |  27 -----
 .../power4/fpu/multiarch/s_ceilf-ppc32.c      |   3 +
 .../powerpc/powerpc32/power5+/fpu/s_ceil.S    |  29 -----
 .../powerpc/powerpc32/power5+/fpu/s_ceilf.S   |  30 -----
 .../powerpc64/be/fpu/multiarch/Makefile       |   9 ++
 .../be/fpu/multiarch/s_ceil-power5+.c         |   3 +
 .../powerpc64/be/fpu/multiarch/s_ceil-ppc64.c |   3 +
 .../powerpc64/{ => be}/fpu/multiarch/s_ceil.c |   4 +-
 .../be/fpu/multiarch/s_ceilf-power5+.c        |   3 +
 .../be/fpu/multiarch/s_ceilf-ppc64.c          |   3 +
 .../{ => be}/fpu/multiarch/s_ceilf.c          |   4 +-
 .../powerpc/powerpc64/fpu/multiarch/Makefile  |   3 +-
 .../powerpc64/fpu/multiarch/s_ceil-power5+.S  |  30 -----
 .../powerpc64/fpu/multiarch/s_ceil-ppc64.S    |  30 -----
 .../powerpc64/fpu/multiarch/s_ceilf-power5+.S |  24 ----
 .../powerpc64/fpu/multiarch/s_ceilf-ppc64.S   |  24 ----
 sysdeps/powerpc/powerpc64/fpu/s_ceil.S        |  65 -----------
 sysdeps/powerpc/powerpc64/fpu/s_ceilf.S       |  67 -----------
 .../powerpc/powerpc64/power5+/fpu/s_ceil.S    |  30 -----
 .../powerpc/powerpc64/power5+/fpu/s_ceilf.S   |  31 -----
 33 files changed, 225 insertions(+), 637 deletions(-)
 create mode 100644 sysdeps/powerpc/fpu/round_to_integer.h
 create mode 100644 sysdeps/powerpc/fpu/s_ceil.c
 create mode 100644 sysdeps/powerpc/fpu/s_ceilf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_ceil.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_ceil.c (95%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_ceilf.c (95%)
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_ceil.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S

diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h
index 67a9c9a51a..01dccb15a8 100644
--- a/sysdeps/powerpc/fpu/fenv_libc.h
+++ b/sysdeps/powerpc/fpu/fenv_libc.h
@@ -98,6 +98,14 @@ __fesetround_inline (int round)
   return 0;
 }
 
+/* Same as __fesetround_inline, however without runtime check to use DFP
+   mtfsfi syntax or if round is valid.  */
+static inline void
+__fesetround_inline_nocheck (const int round)
+{
+  asm volatile ("mtfsfi 7,%0" : : "i" (round));
+}
+
 /* Definitions of all the FPSCR bit numbers */
 enum {
   FPSCR_FX = 0,    /* exception summary */
diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h
new file mode 100644
index 0000000000..417aae6242
--- /dev/null
+++ b/sysdeps/powerpc/fpu/round_to_integer.h
@@ -0,0 +1,109 @@
+/* Round to integer generic implementation.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _ROUND_TO_INTEGER_H
+#define _ROUND_TO_INTEGER_H
+
+#include <fenv_private.h>
+
+enum round_mode
+{
+  CEIL,
+  FLOOR,
+  ROUND,
+  TRUNC,
+  NEARBYINT,
+};
+
+static inline void
+set_fenv_mode (enum round_mode mode)
+{
+  int rmode;
+  switch (mode)
+  {
+  case CEIL:  rmode = FE_UPWARD; break;
+  default:    rmode = FE_TONEAREST; break;
+  }
+  __fesetround_inline_nocheck (rmode);
+}
+
+static inline float
+round_to_integer_float (enum round_mode mode, float x)
+{
+  /* Ensure sNaN input is converted to qNaN.  */
+  if (__glibc_unlikely (isnan (x)))
+    return x + x;
+
+  if (fabs (x) > 0x1p+23)
+    return x;
+
+  float r = x;
+
+  /* Save current FPU rounding mode and inexact state.  */
+  fenv_t fe = fegetenv_register ();
+  set_fenv_mode (mode);
+  if (x > 0.0)
+    {
+      r += 0x1p+23;
+      r -= 0x1p+23;
+      r = fabs (r);
+    }
+  else if (x < 0.0)
+    {
+      r -= 0x1p+23;
+      r += 0x1p+23;
+      r = -fabs (r);
+    }
+  __builtin_mtfsf (0xff, fe);
+
+  return r;
+}
+
+static inline double
+round_to_integer_double (enum round_mode mode, double x)
+{
+  /* Ensure sNaN input is converted to qNaN.  */
+  if (__glibc_unlikely (isnan (x)))
+    return x + x;
+
+  if (fabs (x) > 0x1p+52)
+    return x;
+
+  double r = x;
+
+  /* Save current FPU rounding mode and inexact state.  */
+  fenv_t fe = fegetenv_register ();
+  set_fenv_mode (mode);
+  if (x > 0.0)
+    {
+      r += 0x1p+52;
+      r -= 0x1p+52;
+      r = fabs (r);
+    }
+  else if (x < 0.0)
+    {
+      r -= 0x1p+52;
+      r += 0x1p+52;
+      r = -fabs (r);
+    }
+  __builtin_mtfsf (0xff, fe);
+
+  return r;
+}
+
+#endif
diff --git a/sysdeps/powerpc/fpu/s_ceil.c b/sysdeps/powerpc/fpu/s_ceil.c
new file mode 100644
index 0000000000..49008c7af8
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_ceil.c
@@ -0,0 +1,35 @@
+/* Smallest integral value not less than argument.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-double.h>
+#include <round_to_integer.h>
+
+double
+__ceil (double x)
+{
+#ifdef _ARCH_PWR5X
+  return __builtin_ceil (x);
+#else
+  return round_to_integer_double (CEIL, x);
+#endif
+}
+#ifndef __ceil
+libm_alias_double (__ceil, ceil)
+#endif
diff --git a/sysdeps/powerpc/fpu/s_ceilf.c b/sysdeps/powerpc/fpu/s_ceilf.c
new file mode 100644
index 0000000000..8c86bf30a3
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_ceilf.c
@@ -0,0 +1,35 @@
+/* Smallest integral value not less than argument.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-float.h>
+#include <round_to_integer.h>
+
+float
+__ceilf (float x)
+{
+#ifdef _ARCH_PWR5X
+  return __builtin_ceilf (x);
+#else
+  return round_to_integer_float (CEIL, x);
+#endif
+}
+#ifndef __ceilf
+libm_alias_float (__ceil, ceil)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
deleted file mode 100644
index 4d0fdad2c1..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* ceil function.  PowerPC32 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0: /* 2**52 */
- .long 0x59800000
-
- .section ".text"
-ENTRY (__ceil)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfs fp13,.LC0-got_label@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,2 /* Set rounding mode toward +inf.  */
- ble- cr6,.L4
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__ceil)
-
-libm_alias_double (__ceil, ceil)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
deleted file mode 100644
index c32044afa6..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* float ceil function.  PowerPC32 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0: /* 2**23 */
- .long 0x4b000000
-
- .section ".text"
-ENTRY (__ceilf)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfs fp13,.LC0-got_label@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,2 /* Set rounding mode toward +inf.  */
- ble- cr6,.L4
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__ceilf)
-
-libm_alias_float (__ceil, ceil)
-
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
index 4e85021d50..cf38e347f2 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
@@ -26,6 +26,8 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \
  s_logbf-power7 s_logbf-ppc32 e_hypot-power7 \
  e_hypot-ppc32 e_hypotf-power7 e_hypotf-ppc32
 
+CFLAGS-s_ceil-power5+.c = -mcpu=power5+
+CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
 CFLAGS-s_modf-power5+.c = -mcpu=power5+
 CFLAGS-s_modff-power5+.c = -mcpu=power5+
 CFLAGS-s_logbl-power7.c = -mcpu=power7
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S
deleted file mode 100644
index b13a56667e..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* ceil function.  PowerPC32/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __ceil __ceil_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c
new file mode 100644
index 0000000000..87bc66cdb0
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __ceil __ceil_power5plus
+#include <sysdeps/powerpc/fpu/s_ceil.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S
deleted file mode 100644
index 899dc140c6..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* ceil function.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __ceil __ceil_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_ceil.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c
new file mode 100644
index 0000000000..93c098476b
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __ceil __ceil_ppc32
+#include <sysdeps/powerpc/fpu/s_ceil.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S
deleted file mode 100644
index 6279638031..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/* ceilf function.  PowerPC32/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-#undef weak_alias
-#define weak_alias(name, alias)
-
-#define __ceilf __ceilf_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c
new file mode 100644
index 0000000000..a5bfa98535
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __ceilf __ceilf_power5plus
+#include <sysdeps/powerpc/fpu/s_ceilf.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S
deleted file mode 100644
index a84edf7a5b..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/* ceilf function.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __ceilf __ceilf_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_ceilf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c
new file mode 100644
index 0000000000..a4dcdcb406
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __ceilf __ceilf_ppc32
+#include <sysdeps/powerpc/fpu/s_ceilf.c>
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S
deleted file mode 100644
index 7dab4023f7..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/* ceil function.  PowerPC32/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .machine "power5"
-EALIGN (__ceil, 4, 0)
- frip fp1, fp1
- blr
- END (__ceil)
-
-libm_alias_double (__ceil, ceil)
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S
deleted file mode 100644
index 15a6f27d28..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* ceilf function.  PowerPC32/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .machine "power5"
-EALIGN (__ceilf, 4, 0)
- frip fp1, fp1 /* The rounding instructions are double.  */
- frsp fp1, fp1 /* But we need to set ooverflow for float.  */
- blr
- END (__ceilf)
-
-libm_alias_float (__ceil, ceil)
-
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
new file mode 100644
index 0000000000..932c3c7e6c
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
@@ -0,0 +1,9 @@
+ifeq ($(subdir),math)
+libm-sysdep_routines += s_ceil-power5+ \
+ s_ceil-ppc64 \
+ s_ceilf-power5+ \
+ s_ceilf-ppc64
+
+CFLAGS-s_ceil-power5+.c = -mcpu=power5+
+CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
+endif
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c
new file mode 100644
index 0000000000..87bc66cdb0
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __ceil __ceil_power5plus
+#include <sysdeps/powerpc/fpu/s_ceil.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c
new file mode 100644
index 0000000000..8711ff3229
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __ceil __ceil_ppc64
+#include <sysdeps/powerpc/fpu/s_ceil.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c
similarity index 95%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c
index b72f4b1cc0..36976a0404 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c
@@ -18,10 +18,8 @@
 
 #define NO_MATH_REDIRECT
 #include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
 #include <libm-alias-double.h>
+#include "init-arch.h"
 
 extern __typeof (__ceil) __ceil_ppc64 attribute_hidden;
 extern __typeof (__ceil) __ceil_power5plus attribute_hidden;
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c
new file mode 100644
index 0000000000..a5bfa98535
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __ceilf __ceilf_power5plus
+#include <sysdeps/powerpc/fpu/s_ceilf.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c
new file mode 100644
index 0000000000..086251dc09
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __ceilf __ceilf_ppc64
+#include <sysdeps/powerpc/fpu/s_ceilf.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c
similarity index 95%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c
index 707f07c0bb..34811330d5 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c
@@ -18,10 +18,8 @@
 
 #define NO_MATH_REDIRECT
 #include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
 #include <libm-alias-float.h>
+#include "init-arch.h"
 
 extern __typeof (__ceilf) __ceilf_ppc64 attribute_hidden;
 extern __typeof (__ceilf) __ceilf_power5plus attribute_hidden;
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index 39b557604c..ac6d162f91 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -14,8 +14,7 @@ sysdep_calls := s_copysign-power6 s_copysign-ppc64 \
 
 sysdep_routines += $(sysdep_calls)
 libm-sysdep_routines += s_llround-power6x \
- s_llround-power5+ s_llround-ppc64 s_ceil-power5+ \
- s_ceil-ppc64 s_ceilf-power5+ s_ceilf-ppc64 \
+ s_llround-power5+ s_llround-ppc64 \
  s_floor-power5+ s_floor-ppc64 s_floorf-power5+ \
  s_floorf-ppc64 s_round-power5+ s_round-ppc64 \
  s_roundf-power5+ s_roundf-ppc64 s_trunc-power5+ \
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S
deleted file mode 100644
index 8782e6378e..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* ceil function.  PowerPC64/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __ceil __ceil_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S
deleted file mode 100644
index 5d9b30d50d..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* ceil function.  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __ceil __ceil_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_ceil.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S
deleted file mode 100644
index 6c9d18880e..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* ceilf function.  PowerPC64/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __ceilf __ceilf_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S
deleted file mode 100644
index 2aaa8c4e4a..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* ceilf function.  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __ceilf __ceilf_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_ceilf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S b/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
deleted file mode 100644
index 3e0a968abe..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
+++ /dev/null
@@ -1,65 +0,0 @@
-/* ceil function.  PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section ".toc","aw"
-.LC0: /* 2**52 */
- .tc FD_43300000_0[TC],0x4330000000000000
- .section ".text"
-
-ENTRY (__ceil, 4)
- CALL_MCOUNT 0
- lfd fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,2 /* Set rounding mode toward +inf.  */
- ble- cr6,.L4
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__ceil)
-
-libm_alias_double (__ceil, ceil)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
deleted file mode 100644
index a189f9fd58..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
+++ /dev/null
@@ -1,67 +0,0 @@
-/* float ceil function.  PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section ".toc","aw"
- .p2align 3
-.LC0: /* 2**23 */
- .long 0x4b000000
- .long 0x0
- .section ".text"
-
-ENTRY (__ceilf, 4)
- CALL_MCOUNT 0
- lfs fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,2 /* Set rounding mode toward +inf.  */
- ble- cr6,.L4
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__ceilf)
-
-libm_alias_float (__ceil, ceil)
-
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S
deleted file mode 100644
index 8feb687697..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* ceil function.  PowerPC64/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__ceil, 4)
- CALL_MCOUNT 0
- frip fp1, fp1
- blr
- END (__ceil)
-
-libm_alias_double (__ceil, ceil)
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S
deleted file mode 100644
index 11d13abd11..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* ceilf function.  PowerPC64/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__ceilf, 4)
- CALL_MCOUNT 0
- frip fp1, fp1 /* The rounding instructions are double.  */
- frsp fp1, fp1 /* But we need to set ooverflow for float.  */
- blr
- END (__ceilf)
-
-libm_alias_float (__ceil, ceil)
-
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 05/28] powerpc: floor/floorf refactor

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patches consolidates all the powerpc floor{f} implementations on
the generic sysdeps/powerpc/fpu/s_floor{f}.  The generic implementation
uses either the compiler builts for ISA 2.03+ (which generates the
frim instruction) or a generic implementation which uses FP only
operations.

The IFUNC organization for powerpc64 is also change to be enabled only
for powerpc64 and not for powerpc64le.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/fpu/round_to_integer.h (set_rounding_mode):
        Add FLOOR option.
        * sysdeps/powerpc/fpu/s_floor.c: New file.
        * sysdeps/powerpc/fpu/s_floorf.c: Likewise.
        * sysdeps/powerpc/powerpc32/fpu/s_floor.S: Remove file.
        * sysdeps/powerpc/powerpc32/fpu/s_floorf.S: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.S:
        Remove file.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.S:
        Likewise
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.c:
        New file.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S: Remove file.
        * sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S: Remove file.
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
        (libm-sysdep_routines): Add s_floor-power5+, s_floor-ppc64,
        s_floorf-power5+, and s_floorf-ppc64.
        (CFLAGS-s_floor-power5+.c, CFLAGS-s_floorf-power5+.c): New rule.
        * sysdep/powerpc/powerpc64/be/fpu/multiarch/s_floor-power5+.c: New
        file.
        * sysdep/powerpc/powerpc64/be/fpu/multiarch/s_floor-ppc64.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c: Move to ...
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor.c: ... here.
        * sysdep/powerpc/powerpc64/be/fpu/multiarch/s_floorf-power5+.c: New
        file.
        * sysdep/powerpc/powerpc64/be/fpu/multiarch/s_floorf-ppc64.c:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf.c: Move to ...
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf.c: ... here.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
        (libm-sysdep_routines): Remove s_floor-power5+, s_floor-ppc64,
        s_floorf-power5+, and s_floorf-ppc64.
        * sysdep/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S: Remove
        file.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S: Remove
        file.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
        * sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Likewise.
        * sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Likewise.
---
 sysdeps/powerpc/fpu/round_to_integer.h        |  1 +
 sysdeps/powerpc/fpu/s_floor.c                 | 35 +++++++++
 sysdeps/powerpc/fpu/s_floorf.c                | 35 +++++++++
 sysdeps/powerpc/powerpc32/fpu/s_floor.S       | 76 -------------------
 sysdeps/powerpc/powerpc32/fpu/s_floorf.S      | 76 -------------------
 .../power4/fpu/multiarch/s_floor-power5+.S    | 33 --------
 .../power4/fpu/multiarch/s_floor-power5+.c    |  3 +
 .../power4/fpu/multiarch/s_floor-ppc32.S      | 31 --------
 .../power4/fpu/multiarch/s_floor-ppc32.c      |  3 +
 .../power4/fpu/multiarch/s_floorf-power5+.S   | 26 -------
 .../power4/fpu/multiarch/s_floorf-power5+.c   |  3 +
 .../power4/fpu/multiarch/s_floorf-ppc32.S     | 27 -------
 .../power4/fpu/multiarch/s_floorf-ppc32.c     |  3 +
 .../powerpc/powerpc32/power5+/fpu/s_floor.S   | 29 -------
 .../powerpc/powerpc32/power5+/fpu/s_floorf.S  | 30 --------
 .../powerpc64/be/fpu/multiarch/Makefile       |  8 +-
 .../be/fpu/multiarch/s_floor-power5+.c        |  3 +
 .../be/fpu/multiarch/s_floor-ppc64.c          |  3 +
 .../{ => be}/fpu/multiarch/s_floor.c          |  0
 .../be/fpu/multiarch/s_floorf-power5+.c       |  3 +
 .../be/fpu/multiarch/s_floorf-ppc64.c         |  3 +
 .../{ => be}/fpu/multiarch/s_floorf.c         |  0
 .../powerpc/powerpc64/fpu/multiarch/Makefile  |  3 +-
 .../powerpc64/fpu/multiarch/s_floor-power5+.S | 30 --------
 .../powerpc64/fpu/multiarch/s_floor-ppc64.S   | 30 --------
 .../fpu/multiarch/s_floorf-power5+.S          | 24 ------
 .../powerpc64/fpu/multiarch/s_floorf-ppc64.S  | 24 ------
 sysdeps/powerpc/powerpc64/fpu/s_floor.S       | 65 ----------------
 sysdeps/powerpc/powerpc64/fpu/s_floorf.S      | 67 ----------------
 .../powerpc/powerpc64/power5+/fpu/s_floor.S   | 30 --------
 .../powerpc/powerpc64/power5+/fpu/s_floorf.S  | 31 --------
 31 files changed, 103 insertions(+), 632 deletions(-)
 create mode 100644 sysdeps/powerpc/fpu/s_floor.c
 create mode 100644 sysdeps/powerpc/fpu/s_floorf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_floor.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_floorf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_floor.c (100%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_floorf.c (100%)
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_floor.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_floorf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S

diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h
index 417aae6242..77d9fc1f86 100644
--- a/sysdeps/powerpc/fpu/round_to_integer.h
+++ b/sysdeps/powerpc/fpu/round_to_integer.h
@@ -37,6 +37,7 @@ set_fenv_mode (enum round_mode mode)
   switch (mode)
   {
   case CEIL:  rmode = FE_UPWARD; break;
+  case FLOOR: rmode = FE_DOWNWARD; break;
   default:    rmode = FE_TONEAREST; break;
   }
   __fesetround_inline_nocheck (rmode);
diff --git a/sysdeps/powerpc/fpu/s_floor.c b/sysdeps/powerpc/fpu/s_floor.c
new file mode 100644
index 0000000000..fb8df97cca
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_floor.c
@@ -0,0 +1,35 @@
+/* Largest integral value not greater than argument.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-double.h>
+#include <round_to_integer.h>
+
+double
+__floor (double x)
+{
+#ifdef _ARCH_PWR5X
+  return __builtin_floor (x);
+#else
+  return round_to_integer_double (FLOOR, x);
+#endif
+}
+#ifndef __floor
+libm_alias_double (__floor, floor)
+#endif
diff --git a/sysdeps/powerpc/fpu/s_floorf.c b/sysdeps/powerpc/fpu/s_floorf.c
new file mode 100644
index 0000000000..ea4723bb69
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_floorf.c
@@ -0,0 +1,35 @@
+/* Smallest integral value not less than argument.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-float.h>
+#include <round_to_integer.h>
+
+float
+__floorf (float x)
+{
+#ifdef _ARCH_PWR5X
+  return __builtin_floorf (x);
+#else
+  return round_to_integer_float (FLOOR, x);
+#endif
+}
+#ifndef __floorf
+libm_alias_float (__floor, floor)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/fpu/s_floor.S
deleted file mode 100644
index 3b6492e242..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_floor.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Floor function.  PowerPC32 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0: /* 2**52 */
- .long 0x59800000
-
- .section ".text"
-ENTRY (__floor)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfs fp13,.LC0-got_label@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,3 /* Set rounding mode toward -inf.  */
- ble- cr6,.L4
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__floor)
-
-libm_alias_double (__floor, floor)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
deleted file mode 100644
index 907271e031..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* float Floor function.  PowerPC32 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0: /* 2**23 */
- .long 0x4b000000
-
- .section ".text"
-ENTRY (__floorf)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfs fp13,.LC0-got_label@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,3 /* Set rounding mode toward -inf.  */
- ble- cr6,.L4
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__floorf)
-
-libm_alias_float (__floor, floor)
-
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.S
deleted file mode 100644
index 03babf644c..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* floor function.  PowerPC32/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __floor __floor_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.c
new file mode 100644
index 0000000000..d3c2f52e57
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __floor __floor_power5plus
+#include <sysdeps/powerpc/fpu/s_floor.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.S
deleted file mode 100644
index 296646109b..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* floor function.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __floor __floor_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_floor.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.c
new file mode 100644
index 0000000000..9decd0faf8
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __floor __floor_ppc32
+#include <sysdeps/powerpc/fpu/s_floor.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.S
deleted file mode 100644
index 47a1a18d16..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/* floorf function.  PowerPC32/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-#undef weak_alias
-#define weak_alias(name, alias)
-
-#define __floorf __floorf_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.c
new file mode 100644
index 0000000000..ecc409580b
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __floorf __floorf_power5plus
+#include <sysdeps/powerpc/fpu/s_floorf.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.S
deleted file mode 100644
index bce86ab0d3..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/* floorf function.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __floorf __floorf_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_floorf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.c
new file mode 100644
index 0000000000..ba1d8f4d55
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __floorf __floorf_ppc32
+#include <sysdeps/powerpc/fpu/s_floorf.c>
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S
deleted file mode 100644
index 55d88e601a..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/* floor function.  PowerPC32/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .machine "power5"
-EALIGN (__floor, 4, 0)
- frim fp1, fp1
- blr
- END (__floor)
-
-libm_alias_double (__floor, floor)
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S
deleted file mode 100644
index e45c358cdd..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* floorf function.  PowerPC32/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .machine "power5"
-EALIGN (__floorf, 4, 0)
- frim fp1, fp1 /* The rounding instructions are double.  */
- frsp fp1, fp1 /* But we need to set ooverflow for float.  */
- blr
- END (__floorf)
-
-libm_alias_float (__floor, floor)
-
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
index 932c3c7e6c..8bb06e5cc0 100644
--- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
@@ -2,8 +2,14 @@ ifeq ($(subdir),math)
 libm-sysdep_routines += s_ceil-power5+ \
  s_ceil-ppc64 \
  s_ceilf-power5+ \
- s_ceilf-ppc64
+ s_ceilf-ppc64 \
+ s_floor-power5+ \
+ s_floor-ppc64 \
+ s_floorf-power5+ \
+ s_floorf-ppc64
 
 CFLAGS-s_ceil-power5+.c = -mcpu=power5+
 CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
+CFLAGS-s_floor-power5+.c = -mcpu=power5+
+CFLAGS-s_floorf-power5+.c = -mcpu=power5+
 endif
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-power5+.c
new file mode 100644
index 0000000000..d3c2f52e57
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __floor __floor_power5plus
+#include <sysdeps/powerpc/fpu/s_floor.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-ppc64.c
new file mode 100644
index 0000000000..92c072c886
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __floor __floor_ppc64
+#include <sysdeps/powerpc/fpu/s_floor.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor.c
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floor.c
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-power5+.c
new file mode 100644
index 0000000000..ecc409580b
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __floorf __floorf_power5plus
+#include <sysdeps/powerpc/fpu/s_floorf.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-ppc64.c
new file mode 100644
index 0000000000..ad657ecfc4
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __floorf __floorf_ppc64
+#include <sysdeps/powerpc/fpu/s_floorf.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf.c
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_floorf.c
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index ac6d162f91..8a73108e4c 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -15,8 +15,7 @@ sysdep_calls := s_copysign-power6 s_copysign-ppc64 \
 sysdep_routines += $(sysdep_calls)
 libm-sysdep_routines += s_llround-power6x \
  s_llround-power5+ s_llround-ppc64 \
- s_floor-power5+ s_floor-ppc64 s_floorf-power5+ \
- s_floorf-ppc64 s_round-power5+ s_round-ppc64 \
+ s_round-power5+ s_round-ppc64 \
  s_roundf-power5+ s_roundf-ppc64 s_trunc-power5+ \
  s_trunc-ppc64 s_truncf-power5+ s_truncf-ppc64 \
  s_llrint-power6x s_llrint-ppc64 \
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S
deleted file mode 100644
index f4917d5f57..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-power5+.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* floor function.  PowerPC64/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __floor __floor_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S
deleted file mode 100644
index 982d4a1b7f..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor-ppc64.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* floor function.  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __floor __floor_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_floor.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S
deleted file mode 100644
index 01a15e4e55..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-power5+.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* floorf function.  PowerPC64/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __floorf __floorf_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S
deleted file mode 100644
index 2b31a96c86..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf-ppc64.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* floorf function.  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __floorf __floorf_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_floorf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floor.S b/sysdeps/powerpc/powerpc64/fpu/s_floor.S
deleted file mode 100644
index 78cacd88ca..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_floor.S
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Floor function.  PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section ".toc","aw"
-.LC0: /* 2**52 */
- .tc FD_43300000_0[TC],0x4330000000000000
- .section ".text"
-
-ENTRY (__floor, 4)
- CALL_MCOUNT 0
- lfd fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,3 /* Set rounding mode toward -inf.  */
- ble- cr6,.L4
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__floor)
-
-libm_alias_double (__floor, floor)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floorf.S b/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
deleted file mode 100644
index ba2ba3b293..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
+++ /dev/null
@@ -1,67 +0,0 @@
-/* float Floor function.  PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section ".toc","aw"
- .p2align 3
-.LC0: /* 2**23 */
- .long 0x4b000000
- .long 0x0
- .section ".text"
-
-ENTRY (__floorf, 4)
- CALL_MCOUNT 0
- lfs fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,3 /* Set rounding mode toward -inf.  */
- ble- cr6,.L4
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__floorf)
-
-libm_alias_float (__floor, floor)
-
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S
deleted file mode 100644
index 6ddaf21862..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* floor function.  PowerPC64/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__floor, 4)
- CALL_MCOUNT 0
- frim fp1, fp1
- blr
- END (__floor)
-
-libm_alias_double (__floor, floor)
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S
deleted file mode 100644
index b43f7a27e6..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* floorf function.  PowerPC64/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__floorf, 4)
- CALL_MCOUNT 0
- frim fp1, fp1 /* The rounding instructions are double.  */
- frsp fp1, fp1 /* But we need to set ooverflow for float.  */
- blr
- END (__floorf)
-
-libm_alias_float (__floor, floor)
-
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 06/28] powerpc: round/roundf refactor

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patches consolidates all the powerpc round{f} implementations on
the generic sysdeps/powerpc/fpu/s_round{f}.  The generic implementation
uses either the compiler builts for ISA 2.03+ (which generates the
frim instruction) or a generic implementation which uses FP only
operations.

The IFUNC organization for powerpc64 is also change to be enabled only
for powerpc64 and not for powerpc64le.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/fpu/round_to_integer.h (set_rounding_mode): Add
        ROUND handling.
        (round_to_integer_float): Likewise.
        * sysdeps/powerpc/fpu/s_round.c: New file.
        * sysdeps/powerpc/fpu/s_roundf.c: New file.
        * sysdeps/powerpc/powerpc32/fpu/s_round.S: Remove file.
        * sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-power5+.S:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-ppc32.S:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-power5+.S:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-ppc32.S:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-power5+.c: New
        file.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_round-ppc32.c:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-power5+.c:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_roundf-ppc32.c:
        Likewise.
        * sysdep/powerpc/powerpc32/power5+/fpu/s_round.S: Remove file.
        * sysdep/powerpc/powerpc32/power5+/fpu/s_roundf.S: Likewise.
        * sysdep/powerpc/powerpc64/be/fpu/multiarch/Makefile
        (libm-sysdep_routines): Add s_round-power5+, s_round-ppc64,
        s_roundf-power5+, and s_roundf-ppc64.
        (CFLAGS-s_round-power5+.c, CFLAGS-s_roundf-power5+.c): New rule.
        * sysdep/powerpc/powercp64/be/fpu/multiarch/s_round-power5+.c: New
        file.
        * sysdep/powerpc/powercp64/be/fpu/multiarch/s_round-ppc64.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c: Move to ...
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round.c: ... here.
        * sysdep/powerpc/powercp64/be/fpu/multiarch/s_roundf-power5+.c: New
        file.
        * sysdep/powerpc/powercp64/be/fpu/multiarch/s_roundf-ppc64.c:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c: Move to ...
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c: ... here.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
        (libm-sysdep_routines): Remove s_round-power5+, s_round-ppc64,
        s_roundf-power5+, and s_roundf-ppc64.
        * sysdep/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S: Remove
        file.
        * sysdep/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S: Likewise.
        * sysdep/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S:
        Likewise.
        * sysdep/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
        * sysdep/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise.
        * sysdep/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise.
---
 sysdeps/powerpc/fpu/round_to_integer.h        | 17 ++++
 sysdeps/powerpc/fpu/s_round.c                 | 35 +++++++
 sysdeps/powerpc/fpu/s_roundf.c                | 35 +++++++
 sysdeps/powerpc/powerpc32/fpu/s_round.S       | 97 -------------------
 sysdeps/powerpc/powerpc32/fpu/s_roundf.S      | 96 ------------------
 .../power4/fpu/multiarch/s_round-power5+.S    | 33 -------
 .../power4/fpu/multiarch/s_round-power5+.c    |  3 +
 .../power4/fpu/multiarch/s_round-ppc32.S      | 31 ------
 .../power4/fpu/multiarch/s_round-ppc32.c      |  3 +
 .../power4/fpu/multiarch/s_roundf-power5+.S   | 26 -----
 .../power4/fpu/multiarch/s_roundf-power5+.c   |  3 +
 .../power4/fpu/multiarch/s_roundf-ppc32.S     | 27 ------
 .../power4/fpu/multiarch/s_roundf-ppc32.c     |  3 +
 .../powerpc/powerpc32/power5+/fpu/s_round.S   | 29 ------
 .../powerpc/powerpc32/power5+/fpu/s_roundf.S  | 30 ------
 .../powerpc64/be/fpu/multiarch/Makefile       |  8 +-
 .../be/fpu/multiarch/s_round-power5+.c        |  3 +
 .../be/fpu/multiarch/s_round-ppc64.c          |  3 +
 .../{ => be}/fpu/multiarch/s_round.c          |  0
 .../be/fpu/multiarch/s_roundf-power5+.c       |  3 +
 .../be/fpu/multiarch/s_roundf-ppc64.c         |  3 +
 .../{ => be}/fpu/multiarch/s_roundf.c         |  0
 .../powerpc/powerpc64/fpu/multiarch/Makefile  |  3 +-
 .../powerpc64/fpu/multiarch/s_round-power5+.S | 30 ------
 .../powerpc64/fpu/multiarch/s_round-ppc64.S   | 30 ------
 .../fpu/multiarch/s_roundf-power5+.S          | 24 -----
 .../powerpc64/fpu/multiarch/s_roundf-ppc64.S  | 24 -----
 sysdeps/powerpc/powerpc64/fpu/s_round.S       | 80 ---------------
 sysdeps/powerpc/powerpc64/fpu/s_roundf.S      | 82 ----------------
 .../powerpc/powerpc64/power5+/fpu/s_round.S   | 30 ------
 .../powerpc/powerpc64/power5+/fpu/s_roundf.S  | 31 ------
 31 files changed, 119 insertions(+), 703 deletions(-)
 create mode 100644 sysdeps/powerpc/fpu/s_round.c
 create mode 100644 sysdeps/powerpc/fpu/s_roundf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_round.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_roundf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_round.c (100%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_roundf.c (100%)
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_round.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_roundf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S

diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h
index 77d9fc1f86..3fa2b77b6d 100644
--- a/sysdeps/powerpc/fpu/round_to_integer.h
+++ b/sysdeps/powerpc/fpu/round_to_integer.h
@@ -38,6 +38,7 @@ set_fenv_mode (enum round_mode mode)
   {
   case CEIL:  rmode = FE_UPWARD; break;
   case FLOOR: rmode = FE_DOWNWARD; break;
+  case ROUND: rmode = FE_TOWARDZERO; break;
   default:    rmode = FE_TONEAREST; break;
   }
   __fesetround_inline_nocheck (rmode);
@@ -60,12 +61,24 @@ round_to_integer_float (enum round_mode mode, float x)
   set_fenv_mode (mode);
   if (x > 0.0)
     {
+      /* IEEE 1003.1 round function.  IEEE specifies "round to the nearest
+ integer value, rounding halfway cases away from zero, regardless of
+ the current rounding mode."  However PowerPC Architecture defines
+ "Round to Nearest" as "Choose the best approximation. In case of a
+ tie, choose the one that is even (least significant bit o).".
+ So we can't use the PowerPC "Round to Nearest" mode. Instead we set
+ "Round toward Zero" mode and round by adding +-0.5 before rounding
+ to the integer value.  */
+      if (mode == ROUND)
+ r += 0.5f;
       r += 0x1p+23;
       r -= 0x1p+23;
       r = fabs (r);
     }
   else if (x < 0.0)
     {
+      if (mode == ROUND)
+ r -= 0.5f;
       r -= 0x1p+23;
       r += 0x1p+23;
       r = -fabs (r);
@@ -92,12 +105,16 @@ round_to_integer_double (enum round_mode mode, double x)
   set_fenv_mode (mode);
   if (x > 0.0)
     {
+      if (mode == ROUND)
+ r += 0.5;
       r += 0x1p+52;
       r -= 0x1p+52;
       r = fabs (r);
     }
   else if (x < 0.0)
     {
+      if (mode == ROUND)
+ r -= 0.5;
       r -= 0x1p+52;
       r += 0x1p+52;
       r = -fabs (r);
diff --git a/sysdeps/powerpc/fpu/s_round.c b/sysdeps/powerpc/fpu/s_round.c
new file mode 100644
index 0000000000..cd105567ef
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_round.c
@@ -0,0 +1,35 @@
+/* Largest integral value not greater than argument.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-double.h>
+#include <round_to_integer.h>
+
+double
+__round (double x)
+{
+#ifdef _ARCH_PWR5X
+  return __builtin_round (x);
+#else
+  return round_to_integer_double (ROUND, x);
+#endif
+}
+#ifndef __round
+libm_alias_double (__round, round)
+#endif
diff --git a/sysdeps/powerpc/fpu/s_roundf.c b/sysdeps/powerpc/fpu/s_roundf.c
new file mode 100644
index 0000000000..418062adba
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_roundf.c
@@ -0,0 +1,35 @@
+/* Smallest integral value not less than argument.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-float.h>
+#include <round_to_integer.h>
+
+float
+__roundf (float x)
+{
+#ifdef _ARCH_PWR5X
+  return __builtin_roundf (x);
+#else
+  return round_to_integer_float (ROUND, x);
+#endif
+}
+#ifndef __roundf
+libm_alias_float (__round, round)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_round.S b/sysdeps/powerpc/powerpc32/fpu/s_round.S
deleted file mode 100644
index 26c7516458..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_round.S
+++ /dev/null
@@ -1,97 +0,0 @@
-/* round function.  PowerPC32 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section .rodata.cst8,"aM",@progbits,8
- .align 2
-.LC0: /* 2**52 */
- .long 0x59800000
-.LC1: /* 0.5 */
- .long 0x3f000000
-
-/* double [fp1] round (double x [fp1])
-   IEEE 1003.1 round function.  IEEE specifies "round to the nearest
-   integer value, rounding halfway cases away from zero, regardless of
-   the current rounding mode."  However PowerPC Architecture defines
-   "Round to Nearest" as "Choose the best approximation. In case of a
-   tie, choose the one that is even (least significant bit o).".
-   So we can't use the PowerPC "Round to Nearest" mode. Instead we set
-   "Round toward Zero" mode and round by adding +-0.5 before rounding
-   to the integer value.  */
-
- .section ".text"
-ENTRY (__round)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- addi r9,r9,.LC0-got_label@l
- mtlr r11
- cfi_same_value (lr)
- lfs fp13,0(r9)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding mode toward 0.  */
-#ifdef SHARED
- lfs fp10,.LC1-.LC0(r9)
-#else
- lis r9,.LC1@ha
- lfs fp10,.LC1@l(r9)
-#endif
- ble- cr6,.L4
- fadd fp1,fp1,fp10 /* x+= 0.5;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- fsub fp9,fp1,fp10 /* x+= 0.5;  */
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsub fp1,fp9,fp13 /* x-= TWO52;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__round)
-
-libm_alias_double (__round, round)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
deleted file mode 100644
index cb59a2ba51..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
+++ /dev/null
@@ -1,96 +0,0 @@
-/* roundf  function.  PowerPC32 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section .rodata.cst8,"aM",@progbits,8
- .align 3
-.LC0: /* 2**23 */
- .long 0x4b000000
-.LC1: /* 0.5 */
- .long 0x3f000000
-
-/* float [fp1] roundf  (float x [fp1])
-   IEEE 1003.1 round function.  IEEE specifies "round to the nearest
-   integer value, rounding halfway cases away from zero, regardless of
-   the current rounding mode."  However PowerPC Architecture defines
-   "Round to Nearest" as "Choose the best approximation. In case of a
-   tie, choose the one that is even (least significant bit o).".
-   So we can't use the PowerPC "Round to Nearest" mode. Instead we set
-   "Round toward Zero" mode and round by adding +-0.5 before rounding
-   to the integer value.  */
-
- .section ".text"
-ENTRY (__roundf )
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- addi r9,r9,.LC0-got_label@l
- mtlr r11
- cfi_same_value (lr)
- lfs fp13,0(r9)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding mode toward 0.  */
-#ifdef SHARED
- lfs fp10,.LC1-.LC0(r9)
-#else
- lfs fp10,.LC1@l(r9)
-#endif
- ble- cr6,.L4
- fadds fp1,fp1,fp10 /* x+= 0.5;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- fsubs fp9,fp1,fp10 /* x+= 0.5;  */
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsubs fp1,fp9,fp13 /* x-= TWO23;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__roundf)
-
-libm_alias_float (__round, round)
-
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S
deleted file mode 100644
index eab96dbba7..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* round function.  PowerPC32/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __round __round_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c
new file mode 100644
index 0000000000..3f6f87b4e2
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __round __round_power5plus
+#include <sysdeps/powerpc/fpu/s_round.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S
deleted file mode 100644
index c2208c18fe..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* round function.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __round __round_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_round.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c
new file mode 100644
index 0000000000..92fbadf789
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __round __round_ppc32
+#include <sysdeps/powerpc/fpu/s_round.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S
deleted file mode 100644
index ce4d89c669..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/* roundf function.  PowerPC32/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-#undef weak_alias
-#define weak_alias(name, alias)
-
-#define __roundf __roundf_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c
new file mode 100644
index 0000000000..b0cb5c5190
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __roundf __roundf_power5plus
+#include <sysdeps/powerpc/fpu/s_roundf.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S
deleted file mode 100644
index 30f4e3f7cd..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/* roundf function.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __roundf __roundf_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_roundf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c
new file mode 100644
index 0000000000..44023bbefd
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __roundf __roundf_ppc32
+#include <sysdeps/powerpc/fpu/s_roundf.c>
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S
deleted file mode 100644
index 327d970b02..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/* round function.  PowerPC32/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .machine "power5"
-EALIGN (__round, 4, 0)
- frin fp1, fp1
- blr
- END (__round)
-
-libm_alias_double (__round, round)
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S
deleted file mode 100644
index 59a21708f5..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* roundf function.  PowerPC32/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .machine "power5"
-EALIGN (__roundf, 4, 0)
- frin fp1, fp1 /* The rounding instructions are double.  */
- frsp fp1, fp1 /* But we need to set ooverflow for float.  */
- blr
- END (__roundf)
-
-libm_alias_float (__round, round)
-
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
index 8bb06e5cc0..722f974cfb 100644
--- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
@@ -6,10 +6,16 @@ libm-sysdep_routines += s_ceil-power5+ \
  s_floor-power5+ \
  s_floor-ppc64 \
  s_floorf-power5+ \
- s_floorf-ppc64
+ s_floorf-ppc64 \
+ s_round-power5+ \
+ s_round-ppc64 \
+ s_roundf-power5+ \
+ s_roundf-ppc64
 
 CFLAGS-s_ceil-power5+.c = -mcpu=power5+
 CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
 CFLAGS-s_floor-power5+.c = -mcpu=power5+
 CFLAGS-s_floorf-power5+.c = -mcpu=power5+
+CFLAGS-s_round-power5+.c = -mcpu=power5+
+CFLAGS-s_roundf-power5+.c = -mcpu=power5+
 endif
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c
new file mode 100644
index 0000000000..3f6f87b4e2
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __round __round_power5plus
+#include <sysdeps/powerpc/fpu/s_round.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c
new file mode 100644
index 0000000000..cb122e6afc
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __round __round_ppc64
+#include <sysdeps/powerpc/fpu/s_round.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round.c
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_round.c
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c
new file mode 100644
index 0000000000..b0cb5c5190
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __roundf __roundf_power5plus
+#include <sysdeps/powerpc/fpu/s_roundf.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c
new file mode 100644
index 0000000000..3e1de69147
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __roundf __roundf_ppc64
+#include <sysdeps/powerpc/fpu/s_roundf.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index 8a73108e4c..11c39f4b35 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -15,8 +15,7 @@ sysdep_calls := s_copysign-power6 s_copysign-ppc64 \
 sysdep_routines += $(sysdep_calls)
 libm-sysdep_routines += s_llround-power6x \
  s_llround-power5+ s_llround-ppc64 \
- s_round-power5+ s_round-ppc64 \
- s_roundf-power5+ s_roundf-ppc64 s_trunc-power5+ \
+ s_trunc-power5+ \
  s_trunc-ppc64 s_truncf-power5+ s_truncf-ppc64 \
  s_llrint-power6x s_llrint-ppc64 \
  s_logb-power7 s_logbf-power7 \
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S
deleted file mode 100644
index 8c38759d3f..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-power5+.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* round function.  PowerPC64/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __round __round_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S
deleted file mode 100644
index 5ea616d429..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round-ppc64.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* round function.  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __round __round_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_round.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S
deleted file mode 100644
index c29c31785e..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-power5+.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* roundf function.  PowerPC64/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __roundf __roundf_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S
deleted file mode 100644
index ced4241b2b..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf-ppc64.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* roundf function.  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __roundf __roundf_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_roundf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_round.S b/sysdeps/powerpc/powerpc64/fpu/s_round.S
deleted file mode 100644
index 0b06a52d09..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_round.S
+++ /dev/null
@@ -1,80 +0,0 @@
-/* round function.  PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section ".toc","aw"
-.LC0: /* 2**52 */
- .tc FD_43300000_0[TC],0x4330000000000000
-.LC1: /* 0.5 */
- .tc FD_3fe00000_0[TC],0x3fe0000000000000
- .section ".text"
-
-/* double [fp1] round (double x [fp1])
-   IEEE 1003.1 round function.  IEEE specifies "round to the nearest
-   integer value, rounding halfway cases away from zero, regardless of
-   the current rounding mode."  However PowerPC Architecture defines
-   "Round to Nearest" as "Choose the best approximation. In case of a
-   tie, choose the one that is even (least significant bit o).".
-   So we can't use the PowerPC "Round to Nearest" mode. Instead we set
-   "Round toward Zero" mode and round by adding +-0.5 before rounding
-   to the integer value.  */
-
-ENTRY (__round, 4)
- CALL_MCOUNT 0
- lfd fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding mode toward 0.  */
- lfd fp10,.LC1@toc(2)
- ble- cr6,.L4
- fadd fp1,fp1,fp10 /* x+= 0.5;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- fsub fp9,fp1,fp10 /* x+= 0.5;  */
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsub fp1,fp9,fp13 /* x-= TWO52;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__round)
-
-libm_alias_double (__round, round)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S b/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
deleted file mode 100644
index a9c32c5774..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
+++ /dev/null
@@ -1,82 +0,0 @@
-/* roundf  function.  PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section ".toc","aw"
- .p2align 3
-.LC0: /* 2**23 */
- .long 0x4b000000
-.LC1: /* 0.5 */
- .long 0x3f000000
-
- .section ".text"
-
-/* float [fp1] roundf  (float x [fp1])
-   IEEE 1003.1 round function.  IEEE specifies "round to the nearest
-   integer value, rounding halfway cases away from zero, regardless of
-   the current rounding mode."  However PowerPC Architecture defines
-   "Round to Nearest" as "Choose the best approximation. In case of a
-   tie, choose the one that is even (least significant bit o).".
-   So we can't use the PowerPC "Round to Nearest" mode. Instead we set
-   "Round toward Zero" mode and round by adding +-0.5 before rounding
-   to the integer value.  */
-
-ENTRY (__roundf, 4)
- CALL_MCOUNT 0
- lfs fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding mode toward 0.  */
- lfs fp10,.LC1@toc(2)
- ble- cr6,.L4
- fadds fp1,fp1,fp10 /* x+= 0.5;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- fsubs fp9,fp1,fp10 /* x+= 0.5;  */
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsubs fp1,fp9,fp13 /* x-= TWO23;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__roundf)
-
-libm_alias_float (__round, round)
-
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
deleted file mode 100644
index 45d010a919..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* round function.  PowerPC64/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__round, 4)
- CALL_MCOUNT 0
- frin fp1, fp1
- blr
- END (__round)
-
-libm_alias_double (__round, round)
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S
deleted file mode 100644
index 69fad1069f..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* roundf function.  PowerPC64/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__roundf, 4)
- CALL_MCOUNT 0
- frin fp1, fp1 /* The rounding instructions are double.  */
- frsp fp1, fp1 /* But we need to set ooverflow for float.  */
- blr
- END (__roundf)
-
-libm_alias_float (__round, round)
-
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 07/28] powerpc: trunc/truncf refactor

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patches consolidates all the powerpc trunc{f} implementations on
the generic sysdeps/powerpc/fpu/s_trunc{f}.  The generic implementation
uses either the compiler builts for ISA 2.03+ (which generates the
frim instruction) or a generic implementation which uses FP only
operations.

The IFUNC organization for powerpc64 is also change to be enabled only
for powerpc64 and not for powerpc64le.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/fpu/trunc_to_integer.h (set_truncing_mode): Add
         TRUNC handling.
        * sysdeps/powerpc/fpu/s_trunc.c: New file.
        * sysdeps/powerpc/fpu/s_truncf.c: New file.
        * sysdeps/powerpc/powerpc32/fpu/s_trunc.S: Remove file.
        * sysdeps/powerpc/powerpc32/fpu/s_truncf.S: Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_trunc-power5+.S:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_trunc-ppc32.S:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_truncf-power5+.S:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_truncf-ppc32.S:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_trunc-power5+.c: New
        file.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_trunc-ppc32.c:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_truncf-power5+.c:
        Likewise.
        * sysdep/powerpc/powepc32/power4/fpu/multiarch/s_truncf-ppc32.c:
        Likewise.
        * sysdep/powerpc/powerpc32/power5+/fpu/s_trunc.S: Remove file.
        * sysdep/powerpc/powerpc32/power5+/fpu/s_truncf.S: Likewise.
        * sysdep/powerpc/powerpc64/be/fpu/multiarch/Makefile
        (libm-sysdep_routines): Add s_trunc-power5+, s_trunc-ppc64,
        s_truncf-power5+, and s_truncf-ppc64.
        (CFLAGS-s_trunc-power5+.c, CFLAGS-s_truncf-power5+.c): New rule.
        * sysdep/powerpc/powercp64/be/fpu/multiarch/s_trunc-power5+.c: New
        file.
        * sysdep/powerpc/powercp64/be/fpu/multiarch/s_trunc-ppc64.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c: Move to ...
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc.c: ... here.
        * sysdep/powerpc/powercp64/be/fpu/multiarch/s_truncf-power5+.c: New
        file.
        * sysdep/powerpc/powercp64/be/fpu/multiarch/s_truncf-ppc64.c:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c: Move to ...
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf.c: ... here.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
        (libm-sysdep_routines): Remove s_trunc-power5+, s_trunc-ppc64,
        s_truncf-power5+, and s_truncf-ppc64.
        * sysdep/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S: Remove
        file.
        * sysdep/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S: Likewise.
        * sysdep/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S:
        Likewise.
        * sysdep/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
        * sysdep/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise.
        * sysdep/powerpc/powerpc64/power5+/fpu/s_truncf.S: Likewise.
---
 sysdeps/powerpc/fpu/round_to_integer.h        |  1 +
 sysdeps/powerpc/fpu/s_trunc.c                 | 35 ++++++++
 sysdeps/powerpc/fpu/s_truncf.c                | 35 ++++++++
 sysdeps/powerpc/powerpc32/fpu/s_trunc.S       | 83 -------------------
 sysdeps/powerpc/powerpc32/fpu/s_truncf.S      | 83 -------------------
 .../power4/fpu/multiarch/s_trunc-power5+.S    | 33 --------
 .../power4/fpu/multiarch/s_trunc-power5+.c    |  3 +
 .../power4/fpu/multiarch/s_trunc-ppc32.S      | 31 -------
 .../power4/fpu/multiarch/s_trunc-ppc32.c      |  3 +
 .../power4/fpu/multiarch/s_truncf-power5+.S   | 26 ------
 .../power4/fpu/multiarch/s_truncf-power5+.c   |  3 +
 .../power4/fpu/multiarch/s_truncf-ppc32.S     | 27 ------
 .../power4/fpu/multiarch/s_truncf-ppc32.c     |  3 +
 .../powerpc/powerpc32/power5+/fpu/s_trunc.S   | 29 -------
 .../powerpc/powerpc32/power5+/fpu/s_truncf.S  | 30 -------
 .../powerpc64/be/fpu/multiarch/Makefile       |  8 +-
 .../powerpc64/be/fpu/multiarch/s_roundf.c     |  2 -
 .../be/fpu/multiarch/s_trunc-power5+.c        |  3 +
 .../be/fpu/multiarch/s_trunc-ppc64.c          |  3 +
 .../{ => be}/fpu/multiarch/s_trunc.c          |  0
 .../be/fpu/multiarch/s_truncf-power5+.c       |  3 +
 .../be/fpu/multiarch/s_truncf-ppc64.c         |  3 +
 .../{ => be}/fpu/multiarch/s_truncf.c         |  2 -
 .../powerpc/powerpc64/fpu/multiarch/Makefile  |  2 -
 .../powerpc64/fpu/multiarch/s_trunc-power5+.S | 30 -------
 .../powerpc64/fpu/multiarch/s_trunc-ppc64.S   | 30 -------
 .../fpu/multiarch/s_truncf-power5+.S          | 24 ------
 .../powerpc64/fpu/multiarch/s_truncf-ppc64.S  | 24 ------
 sysdeps/powerpc/powerpc64/fpu/s_trunc.S       | 72 ----------------
 sysdeps/powerpc/powerpc64/fpu/s_truncf.S      | 74 -----------------
 .../powerpc/powerpc64/power5+/fpu/s_trunc.S   | 30 -------
 .../powerpc/powerpc64/power5+/fpu/s_truncf.S  | 31 -------
 32 files changed, 102 insertions(+), 664 deletions(-)
 create mode 100644 sysdeps/powerpc/fpu/s_trunc.c
 create mode 100644 sysdeps/powerpc/fpu/s_truncf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_trunc.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_truncf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_trunc.c (100%)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_truncf.c (95%)
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_trunc.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_truncf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S

diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h
index 3fa2b77b6d..ba2d355fb0 100644
--- a/sysdeps/powerpc/fpu/round_to_integer.h
+++ b/sysdeps/powerpc/fpu/round_to_integer.h
@@ -38,6 +38,7 @@ set_fenv_mode (enum round_mode mode)
   {
   case CEIL:  rmode = FE_UPWARD; break;
   case FLOOR: rmode = FE_DOWNWARD; break;
+  case TRUNC:
   case ROUND: rmode = FE_TOWARDZERO; break;
   default:    rmode = FE_TONEAREST; break;
   }
diff --git a/sysdeps/powerpc/fpu/s_trunc.c b/sysdeps/powerpc/fpu/s_trunc.c
new file mode 100644
index 0000000000..83caf6b9cc
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_trunc.c
@@ -0,0 +1,35 @@
+/* Largest integral value not greater than argument.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-double.h>
+#include <round_to_integer.h>
+
+double
+__trunc (double x)
+{
+#ifdef _ARCH_PWR5X
+  return __builtin_trunc (x);
+#else
+  return round_to_integer_double (TRUNC, x);
+#endif
+}
+#ifndef __trunc
+libm_alias_double (__trunc, trunc)
+#endif
diff --git a/sysdeps/powerpc/fpu/s_truncf.c b/sysdeps/powerpc/fpu/s_truncf.c
new file mode 100644
index 0000000000..c9f091cf2a
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_truncf.c
@@ -0,0 +1,35 @@
+/* Smallest integral value not less than argument.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-float.h>
+#include <round_to_integer.h>
+
+float
+__truncf (float x)
+{
+#ifdef _ARCH_PWR5X
+  return __builtin_truncf (x);
+#else
+  return round_to_integer_float (TRUNC, x);
+#endif
+}
+#ifndef __truncf
+libm_alias_float (__trunc, trunc)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
deleted file mode 100644
index 31daff161f..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
+++ /dev/null
@@ -1,83 +0,0 @@
-/* trunc function.  PowerPC32 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0: /* 2**52 */
- .long 0x59800000
-
-/* double [fp1] trunc (double x [fp1])
-   IEEE 1003.1 trunc function.  IEEE specifies "trunc to the integer
-   value, in floating format, nearest to but no larger in magnitude
-   then the argument."
-   We set "round toward Zero" mode and trunc by adding +-2**52 then
-   subtracting +-2**52.  */
-
- .section ".text"
-ENTRY (__trunc)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfs fp13,.LC0-got_label@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding toward 0 mode.  */
- ble- cr6,.L4
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__trunc)
-
-libm_alias_double (__trunc, trunc)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
deleted file mode 100644
index 630300c5dc..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
+++ /dev/null
@@ -1,83 +0,0 @@
-/* truncf function.  PowerPC32 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0: /* 2**23 */
- .long 0x4b000000
-
-/* float [fp1] truncf (float x [fp1])
-   IEEE 1003.1 trunc function.  IEEE specifies "trunc to the integer
-   value, in floating format, nearest to but no larger in magnitude
-   then the argument."
-   We set "round toward Zero" mode and trunc by adding +-2**23 then
-   subtracting +-2**23.  */
-
- .section ".text"
-ENTRY (__truncf)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfs fp13,.LC0-got_label@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding toward 0 mode.  */
- ble- cr6,.L4
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__truncf)
-
-libm_alias_float (__trunc, trunc)
-
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S
deleted file mode 100644
index 3ed99c3f7e..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* trunc function.  PowerPC32/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __trunc __trunc_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c
new file mode 100644
index 0000000000..47abda6810
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __trunc __trunc_power5plus
+#include <sysdeps/powerpc/fpu/s_trunc.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S
deleted file mode 100644
index 67b87c5db1..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* trunc function.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __trunc __trunc_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_trunc.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c
new file mode 100644
index 0000000000..5b9164295f
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __trunc __trunc_ppc32
+#include <sysdeps/powerpc/fpu/s_trunc.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S
deleted file mode 100644
index a18af562e6..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/* truncf function.  PowerPC32/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-#undef weak_alias
-#define weak_alias(name, alias)
-
-#define __truncf __truncf_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c
new file mode 100644
index 0000000000..b8e75d4e28
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __truncf __truncf_power5plus
+#include <sysdeps/powerpc/fpu/s_truncf.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S
deleted file mode 100644
index a7bf3943f2..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/* truncf function.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __truncf __truncf_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_truncf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c
new file mode 100644
index 0000000000..f20c82553a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __truncf __truncf_ppc32
+#include <sysdeps/powerpc/fpu/s_truncf.c>
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S
deleted file mode 100644
index 37a24104e7..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/* trunc function.  PowerPC32/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .machine "power5"
-EALIGN (__trunc, 4, 0)
- friz fp1, fp1
- blr
- END (__trunc)
-
-libm_alias_double (__trunc, trunc)
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S
deleted file mode 100644
index f24c1f6cda..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* truncf function.  PowerPC32/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .machine "power5"
-EALIGN (__truncf, 4, 0)
- friz fp1, fp1 /* The rounding instructions are double.  */
- frsp fp1, fp1 /* But we need to set ooverflow for float.  */
- blr
- END (__truncf)
-
-libm_alias_float (__trunc, trunc)
-
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
index 722f974cfb..53e600f5f6 100644
--- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
@@ -10,7 +10,11 @@ libm-sysdep_routines += s_ceil-power5+ \
  s_round-power5+ \
  s_round-ppc64 \
  s_roundf-power5+ \
- s_roundf-ppc64
+ s_roundf-ppc64 \
+ s_trunc-power5+ \
+ s_trunc-ppc64 \
+ s_truncf-power5+ \
+ s_truncf-ppc64
 
 CFLAGS-s_ceil-power5+.c = -mcpu=power5+
 CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
@@ -18,4 +22,6 @@ CFLAGS-s_floor-power5+.c = -mcpu=power5+
 CFLAGS-s_floorf-power5+.c = -mcpu=power5+
 CFLAGS-s_round-power5+.c = -mcpu=power5+
 CFLAGS-s_roundf-power5+.c = -mcpu=power5+
+CFLAGS-s_trunc-power5+.c = -mcpu=power5+
+CFLAGS-s_truncf-power5+.c = -mcpu=power5+
 endif
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c
index 640bca5a7a..db6a17c5b2 100644
--- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c
@@ -18,8 +18,6 @@
 
 #define NO_MATH_REDIRECT
 #include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
 #include "init-arch.h"
 #include <libm-alias-float.h>
 
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c
new file mode 100644
index 0000000000..47abda6810
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __trunc __trunc_power5plus
+#include <sysdeps/powerpc/fpu/s_trunc.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c
new file mode 100644
index 0000000000..21c47308fc
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __trunc __trunc_ppc64
+#include <sysdeps/powerpc/fpu/s_trunc.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc.c
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc.c
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c
new file mode 100644
index 0000000000..b8e75d4e28
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __truncf __truncf_power5plus
+#include <sysdeps/powerpc/fpu/s_truncf.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c
new file mode 100644
index 0000000000..aa6c6c1f98
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __truncf __truncf_ppc64
+#include <sysdeps/powerpc/fpu/s_truncf.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf.c
similarity index 95%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf.c
index be124b2023..b6c8260b69 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf.c
@@ -18,8 +18,6 @@
 
 #define NO_MATH_REDIRECT
 #include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
 #include "init-arch.h"
 #include <libm-alias-float.h>
 
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index 11c39f4b35..7d469d79af 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -15,8 +15,6 @@ sysdep_calls := s_copysign-power6 s_copysign-ppc64 \
 sysdep_routines += $(sysdep_calls)
 libm-sysdep_routines += s_llround-power6x \
  s_llround-power5+ s_llround-ppc64 \
- s_trunc-power5+ \
- s_trunc-ppc64 s_truncf-power5+ s_truncf-ppc64 \
  s_llrint-power6x s_llrint-ppc64 \
  s_logb-power7 s_logbf-power7 \
  s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S
deleted file mode 100644
index 9ce3db48e4..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* trunc function.  PowerPC64/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __trunc __trunc_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S
deleted file mode 100644
index ca9d831850..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* trunc function.  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __trunc __trunc_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_trunc.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S
deleted file mode 100644
index 4e651172af..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* truncf function.  PowerPC64/power5+ version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __truncf __truncf_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S
deleted file mode 100644
index 5420eb26c7..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* truncf function.  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __truncf __truncf_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_truncf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S b/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
deleted file mode 100644
index 628960dd27..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
+++ /dev/null
@@ -1,72 +0,0 @@
-/* trunc function.  PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section ".toc","aw"
-.LC0: /* 2**52 */
- .tc FD_43300000_0[TC],0x4330000000000000
- .section ".text"
-
-/* double [fp1] trunc (double x [fp1])
-   IEEE 1003.1 trunc function.  IEEE specifies "trunc to the integer
-   value, in floating format, nearest to but no larger in magnitude
-   then the argument."
-   We set "round toward Zero" mode and trunc by adding +-2**52 then
-   subtracting +-2**52.  */
-
-ENTRY (__trunc, 4)
- CALL_MCOUNT 0
- lfd fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding toward 0 mode.  */
- ble- cr6,.L4
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__trunc)
-
-libm_alias_double (__trunc, trunc)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S b/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
deleted file mode 100644
index 7b9294595a..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
+++ /dev/null
@@ -1,74 +0,0 @@
-/* truncf function.  PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section ".toc","aw"
- .p2align 3
-.LC0: /* 2**23 */
- .long 0x4b000000
- .long 0x0
- .section ".text"
-
-/* float [fp1] truncf (float x [fp1])
-   IEEE 1003.1 trunc function.  IEEE specifies "trunc to the integer
-   value, in floating format, nearest to but no larger in magnitude
-   then the argument."
-   We set "round toward Zero" mode and trunc by adding +-2**23 then
-   subtracting +-2**23.  */
-
-ENTRY (__truncf, 4)
- CALL_MCOUNT 0
- lfs fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23)  */
- mffs fp11 /* Save current FPU rounding mode and
-   "inexact" state.  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding toward 0 mode.  */
- ble- cr6,.L4
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0)  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
-   "inexact" state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__truncf)
-
-libm_alias_float (__trunc, trunc)
-
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
deleted file mode 100644
index fbd0c318ef..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* trunc function.  PowerPC64/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__trunc, 4)
- CALL_MCOUNT 0
- friz fp1, fp1
- blr
- END (__trunc)
-
-libm_alias_double (__trunc, trunc)
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S
deleted file mode 100644
index 91612aa4e9..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* truncf function.  PowerPC64/power5+ version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__truncf, 4)
- CALL_MCOUNT 0
- friz fp1, fp1 /* The rounding instructions are double.  */
- frsp fp1, fp1 /* But we need to set ooverflow for float.  */
- blr
- END (__truncf)
-
-libm_alias_float (__trunc, trunc)
-
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 08/28] powerpc: generic nearbyint/nearbyintf

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patches consolidates all the powerpc nearbyint{f} implementations
on the generic sysdeps/powerpc/fpu/s_nearbyint{f}.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/fpu/round_to_integer.h (set_fenv_mode): Add
        NEARBYINT handling.
        * sysdeps/powerpc/fpu/s_nearbyint.c: New file.
        * sysdeps/powerpc/fpu/s_nearbyintf.c: Likewise.
        * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: Remove file.
        * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
---
 sysdeps/powerpc/fpu/round_to_integer.h       | 19 +++--
 sysdeps/powerpc/fpu/s_nearbyint.c            | 30 ++++++++
 sysdeps/powerpc/fpu/s_nearbyintf.c           | 30 ++++++++
 sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S  | 80 --------------------
 sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S | 79 -------------------
 sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S  | 68 -----------------
 sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S | 69 -----------------
 7 files changed, 73 insertions(+), 302 deletions(-)
 create mode 100644 sysdeps/powerpc/fpu/s_nearbyint.c
 create mode 100644 sysdeps/powerpc/fpu/s_nearbyintf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S

diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h
index ba2d355fb0..5d4378063a 100644
--- a/sysdeps/powerpc/fpu/round_to_integer.h
+++ b/sysdeps/powerpc/fpu/round_to_integer.h
@@ -33,16 +33,23 @@ enum round_mode
 static inline void
 set_fenv_mode (enum round_mode mode)
 {
-  int rmode;
   switch (mode)
   {
-  case CEIL:  rmode = FE_UPWARD; break;
-  case FLOOR: rmode = FE_DOWNWARD; break;
+  case CEIL:
+    __fesetround_inline_nocheck (FE_UPWARD);
+    break;
+  case FLOOR:
+    __fesetround_inline_nocheck (FE_DOWNWARD);
+    break;
   case TRUNC:
-  case ROUND: rmode = FE_TOWARDZERO; break;
-  default:    rmode = FE_TONEAREST; break;
+  case ROUND:
+    __fesetround_inline_nocheck (FE_TOWARDZERO);
+    break;
+  case NEARBYINT:
+    /*  Disable FE_INEXACT exception  */
+    reset_fpscr_bit (FPSCR_XE);
+    break;
   }
-  __fesetround_inline_nocheck (rmode);
 }
 
 static inline float
diff --git a/sysdeps/powerpc/fpu/s_nearbyint.c b/sysdeps/powerpc/fpu/s_nearbyint.c
new file mode 100644
index 0000000000..48bcd86f04
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_nearbyint.c
@@ -0,0 +1,30 @@
+/* Largest integral value not greater than argument.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <fenv_private.h>
+#include <libm-alias-double.h>
+#include <round_to_integer.h>
+
+double
+__nearbyint (double x)
+{
+  return round_to_integer_double (NEARBYINT, x);
+}
+libm_alias_double (__nearbyint, nearbyint)
diff --git a/sysdeps/powerpc/fpu/s_nearbyintf.c b/sysdeps/powerpc/fpu/s_nearbyintf.c
new file mode 100644
index 0000000000..db8a3cdac7
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_nearbyintf.c
@@ -0,0 +1,30 @@
+/* Smallest integral value not less than argument.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <fenv_private.h>
+#include <libm-alias-float.h>
+#include <round_to_integer.h>
+
+float
+__nearbyintf (float x)
+{
+  return round_to_integer_float (NEARBYINT, x);
+}
+libm_alias_float (__nearbyint, nearbyint)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S b/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S
deleted file mode 100644
index 4ed5d702f1..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Round to int floating-point values.  PowerPC32 version.
-   Copyright (C) 2011-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Adhemerval Zanella <[hidden email]>, 2011
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* This has been coded in assembler because GCC makes such a mess of it
-   when it's coded in C.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
-
-/* double [fp1] nearbyint(double [fp1] x) */
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0: /* 2**52 */
- .long 0x59800000 /* TWO52: 2**52 */
-
- .section ".text"
-ENTRY (__nearbyint)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfs fp13,.LC0-1b@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsub    fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52 */
- bge cr7,.L10
- fcmpu cr7,fp1,fp12 /* if (x > 0.0 */
- ble cr7,L(lessthanzero)
- mffs fp11
- mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
- fadd fp1,fp1,fp13 /* x += TWO52 */
- fsub fp1,fp1,fp13 /* x -= TWO52 */
- fabs fp1,fp1 /* if (x == 0.0 */
- mtfsf 0xff,fp11 /* Restore FE_INEXACT state.  */
- blr
-L(lessthanzero):
- bgelr cr7
- mffs fp11
- mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
- fsub fp1,fp1,fp13 /* x -= TWO52 */
- fadd fp1,fp1,fp13 /* x += TWO52 */
- fnabs fp1,fp1 /* if (x == 0.0) */
- mtfsf 0xff,fp11 /* Restore FE_INEXACT state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
-END (__nearbyint)
-
-libm_alias_double (__nearbyint, nearbyint)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S b/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S
deleted file mode 100644
index b1895f9d10..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Round to int floating-point values.  PowerPC32 version.
-   Copyright (C) 2011-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Adhemerval Zanella <[hidden email]>, 2011
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* This has been coded in assembler because GCC makes such a mess of it
-   when it's coded in C.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
-
-/* float [fp1] nearbyintf(float [fp1] x) */
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0:
- .long 0x4B000000 /* TWO23: 2**23 */
-
- .section ".text"
-ENTRY (__nearbyintf)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
- addis r9,r9,.LC0-1b@ha
- lfs fp13,.LC0-1b@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsub    fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23 */
- bge cr7,.L10
- fcmpu cr7,fp1,fp12 /* if (x > 0.0 */
- ble cr7,L(lessthanzero)
- mffs fp11
- mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
- fadds fp1,fp1,fp13 /* x += TWO23 */
- fsubs fp1,fp1,fp13 /* x -= TWO23 */
- fabs fp1,fp1 /* if (x == 0.0) */
- mtfsf 0xff,fp11 /* Restore FE_INEXACT state.  */
- blr
-L(lessthanzero):
- bgelr cr7
- mffs fp11
- mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
- fsubs fp1,fp1,fp13 /* x -= TWO23 */
- fadds fp1,fp1,fp13 /* x += TWO23 */
- fnabs fp1,fp1 /* if (x == 0.0) */
- mtfsf 0xff,fp11 /* Restore FE_INEXACT state.  */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
-END (__nearbyintf)
-
-libm_alias_float (__nearbyint, nearbyint)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
deleted file mode 100644
index 4065af8fe3..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Round to int floating-point values.  PowerPC64 version.
-   Copyright (C) 2011-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Adhemerval Zanella <[hidden email]>, 2011
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* This has been coded in assembler because GCC makes such a mess of it
-   when it's coded in C.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
-
-/* double [fp1] nearbyint(double [fp1] x) */
-
- .section ".toc","aw"
-.LC0: /* 2**52 */
- .tc FD_43300000_0[TC],0x4330000000000000
- .section ".text"
-
-ENTRY (__nearbyint, 4)
- CALL_MCOUNT 0
- fabs fp0,fp1
- lfd fp13,.LC0@toc(2)
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- bge cr7,.L10
- fsub fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp1,fp12 /* if (x > 0.0) */
- ble cr7, L(lessthanzero)
- mffs fp11
- mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
- fadd fp1,fp1,fp13 /* x+= TWO52 */
- fsub fp1,fp1,fp13 /* x-= TWO52 */
- fabs fp1,fp1 /* if (x == 0.0) */
- mtfsf 0xff,fp11 /* Restore FE_INEXACT state.  */
- blr /* x = 0.0; */
-L(lessthanzero):
- bgelr cr7 /* if (x < 0.0) */
- mffs fp11
- mtfsb0 4*cr7+lt
- fsub fp1,fp1,fp13 /* x -= TWO52 */
- fadd fp1,fp1,fp13 /* x += TWO52 */
- fnabs fp1,fp1 /* if (x == 0.0) */
- mtfsf 0xff,fp11 /* Restore FE_INEXACT state.  */
- blr /* x = -0.0; */
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
-END (__nearbyint)
-
-libm_alias_double (__nearbyint, nearbyint)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
deleted file mode 100644
index 69949028a3..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Round to int floating-point values.  PowerPC64 version.
-   Copyright (C) 2011-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Adhemerval Zanella <[hidden email]>, 2011
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* This has been coded in assembler because GCC makes such a mess of it
-   when it's coded in C.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
-
-/* float [fp1] nearbyintf(float [fp1]) */
-
- .section ".toc","aw"
- .p2align 3
-.LC0: /* 2**23 */
- .long 0x4b000000
- .long 0x0
- .section ".text"
-
-ENTRY (__nearbyintf, 4)
- CALL_MCOUNT 0
- fabs fp0,fp1
- lfs fp13,.LC0@toc(2)
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- bge cr7,.L10
- fsubs fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp1,fp12 /* if (x > 0.0)  */
- ble cr7, L(lessthanzero)
- mffs fp11
- mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
- fadds fp1,fp1,fp13 /* x += TWO23 */
- fsubs fp1,fp1,fp13 /* x -= TWO23 */
- fabs fp1,fp1 /* if (x == 0.0) */
- mtfsf 0xff,fp11 /* Restore FE_INEXACT state.  */
- blr /* x = 0.0; */
-L(lessthanzero):
- bgelr cr7 /* if (x < 0.0) */
- mffs fp11
- mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
- fsubs fp1,fp1,fp13 /* x -= TWO23 */
- fadds fp1,fp1,fp13 /* x += TWO23 */
- fnabs fp1,fp1 /* if (x == 0.0) */
- mtfsf 0xff,fp11 /* Restore FE_INEXACT state.  */
- blr /* x = -0.0; */
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
-END (__nearbyintf)
-
-libm_alias_float (__nearbyint, nearbyint)
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 09/28] powerpc: consolidate rint

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patches consolidates all the powerpc rint{f} implementations on
the generic sysdeps/powerpc/fpu/s_rint{f}.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/fpu/round_to_integer.h (set_fenv_mode,
        round_to_integer_float): Add RINT handling.
        (reset_fenv_mode): New symbol.
        * sysdeps/powerpc/fpu/s_rint.c (__rint): Use generic implementation.
        * sysdeps/powerpc/fpu/s_rintf.c (__rintf): Likewise.
        * sysdeps/powerpc/powerpc32/fpu/s_rint.S: Likewise.
        * sysdeps/powerpc/powerpc32/fpu/s_rintf.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.
---
 sysdeps/powerpc/fpu/round_to_integer.h  | 35 ++++++++++---
 sysdeps/powerpc/fpu/s_rint.c            | 19 +------
 sysdeps/powerpc/fpu/s_rintf.c           | 19 +------
 sysdeps/powerpc/powerpc32/fpu/s_rint.S  | 69 -------------------------
 sysdeps/powerpc/powerpc32/fpu/s_rintf.S | 66 -----------------------
 sysdeps/powerpc/powerpc64/fpu/s_rint.S  | 58 ---------------------
 sysdeps/powerpc/powerpc64/fpu/s_rintf.S | 57 --------------------
 7 files changed, 31 insertions(+), 292 deletions(-)
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_rint.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_rintf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_rint.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_rintf.S

diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h
index 5d4378063a..c759483230 100644
--- a/sysdeps/powerpc/fpu/round_to_integer.h
+++ b/sysdeps/powerpc/fpu/round_to_integer.h
@@ -28,11 +28,17 @@ enum round_mode
   ROUND,
   TRUNC,
   NEARBYINT,
+  RINT
 };
 
-static inline void
+static inline fenv_t
 set_fenv_mode (enum round_mode mode)
 {
+  fenv_t fe = 0;
+  if (mode != RINT)
+    /* Save current FPU rounding mode and inexact state.  */
+    fe = fegetenv_register ();
+
   switch (mode)
   {
   case CEIL:
@@ -49,6 +55,22 @@ set_fenv_mode (enum round_mode mode)
     /*  Disable FE_INEXACT exception  */
     reset_fpscr_bit (FPSCR_XE);
     break;
+  case RINT:
+    break;
+  }
+  return fe;
+}
+
+static inline void
+reset_fenv_mode (fenv_t fe, enum round_mode mode)
+{
+  switch (mode)
+  {
+  default:
+    __builtin_mtfsf (0xff, fe);
+    break;
+  case RINT:
+    break;
   }
 }
 
@@ -64,9 +86,7 @@ round_to_integer_float (enum round_mode mode, float x)
 
   float r = x;
 
-  /* Save current FPU rounding mode and inexact state.  */
-  fenv_t fe = fegetenv_register ();
-  set_fenv_mode (mode);
+  fenv_t fe = set_fenv_mode (mode);
   if (x > 0.0)
     {
       /* IEEE 1003.1 round function.  IEEE specifies "round to the nearest
@@ -91,7 +111,7 @@ round_to_integer_float (enum round_mode mode, float x)
       r += 0x1p+23;
       r = -fabs (r);
     }
-  __builtin_mtfsf (0xff, fe);
+  reset_fenv_mode (fe, mode);
 
   return r;
 }
@@ -109,8 +129,7 @@ round_to_integer_double (enum round_mode mode, double x)
   double r = x;
 
   /* Save current FPU rounding mode and inexact state.  */
-  fenv_t fe = fegetenv_register ();
-  set_fenv_mode (mode);
+  fenv_t fe = set_fenv_mode (mode);
   if (x > 0.0)
     {
       if (mode == ROUND)
@@ -127,7 +146,7 @@ round_to_integer_double (enum round_mode mode, double x)
       r += 0x1p+52;
       r = -fabs (r);
     }
-  __builtin_mtfsf (0xff, fe);
+  reset_fenv_mode (fe, mode);
 
   return r;
 }
diff --git a/sysdeps/powerpc/fpu/s_rint.c b/sysdeps/powerpc/fpu/s_rint.c
index 8bf43e3efe..062d6b125b 100644
--- a/sysdeps/powerpc/fpu/s_rint.c
+++ b/sysdeps/powerpc/fpu/s_rint.c
@@ -19,26 +19,11 @@
 #define NO_MATH_REDIRECT
 #include <math.h>
 #include <libm-alias-double.h>
+#include <round_to_integer.h>
 
 double
 __rint (double x)
 {
-  static const float TWO52 = 4503599627370496.0;
-
-  if (fabs (x) < TWO52)
-    {
-      if (x > 0.0)
- {
-  x += TWO52;
-  x -= TWO52;
- }
-      else if (x < 0.0)
- {
-  x = TWO52 - x;
-  x = -(x - TWO52);
- }
-    }
-
-  return x;
+  return round_to_integer_double (RINT, x);
 }
 libm_alias_double (__rint, rint)
diff --git a/sysdeps/powerpc/fpu/s_rintf.c b/sysdeps/powerpc/fpu/s_rintf.c
index 03aaec2c85..c29e7a22b4 100644
--- a/sysdeps/powerpc/fpu/s_rintf.c
+++ b/sysdeps/powerpc/fpu/s_rintf.c
@@ -19,26 +19,11 @@
 #define NO_MATH_REDIRECT
 #include <math.h>
 #include <libm-alias-float.h>
+#include <round_to_integer.h>
 
 float
 __rintf (float x)
 {
-  static const float TWO23 = 8388608.0;
-
-  if (fabsf (x) < TWO23)
-    {
-      if (x > 0.0)
- {
-  x += TWO23;
-  x -= TWO23;
- }
-      else if (x < 0.0)
- {
-  x = TWO23 - x;
-  x = -(x - TWO23);
- }
-    }
-
-  return x;
+  return round_to_integer_float (RINT, x);
 }
 libm_alias_float (__rint, rint)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rint.S b/sysdeps/powerpc/powerpc32/fpu/s_rint.S
deleted file mode 100644
index 0b50b6f053..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_rint.S
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Round to int floating-point values.  PowerPC32 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* This has been coded in assembler because GCC makes such a mess of it
-   when it's coded in C.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0: /* 2**52 */
- .long 0x59800000
-
- .section ".text"
-ENTRY (__rint)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfs fp13,.LC0-got_label@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl cr7,.L10
- bng cr6,.L4
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- blr /* x = 0.0; */
-.L4:
- bnllr cr6 /* if (x < 0.0)  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- blr /* x = -0.0; */
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__rint)
-
-libm_alias_double (__rint, rint)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
deleted file mode 100644
index f22ad8b2b3..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Round float to int floating-point values.  PowerPC32 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0: /* 2**23 */
- .long 0x4b000000
-
- .section ".text"
-ENTRY (__rintf)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfs fp13,.LC0-got_label@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23)  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl cr7,.L10
- bng cr6,.L4
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- blr /* x = 0.0; */
-.L4:
- bnllr cr6 /* if (x < 0.0)  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- blr /* x = -0.0; */
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__rintf)
-
-libm_alias_float (__rint, rint)
-
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rint.S b/sysdeps/powerpc/powerpc64/fpu/s_rint.S
deleted file mode 100644
index 5616f4d908..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_rint.S
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Round to int floating-point values.  PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* This has been coded in assembler because GCC makes such a mess of it
-   when it's coded in C.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
- .section ".toc","aw"
-.LC0: /* 2**52 */
- .tc FD_43300000_0[TC],0x4330000000000000
- .section ".text"
-
-ENTRY (__rint, 4)
- CALL_MCOUNT 0
- lfd fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52)  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl cr7,.L10
- bng cr6,.L4
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- blr /* x = 0.0; */
-.L4:
- bnllr cr6 /* if (x < 0.0)  */
- fsub fp1,fp1,fp13 /* x-= TWO52;  */
- fadd fp1,fp1,fp13 /* x+= TWO52;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- blr /* x = -0.0; */
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__rint)
-
-libm_alias_double (__rint, rint)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S b/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
deleted file mode 100644
index 4511467584..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Round float to int floating-point values.  PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
- .section ".toc","aw"
- .p2align 3
-.LC0: /* 2**23 */
- .long 0x4b000000
- .long 0x0
- .section ".text"
-
-ENTRY (__rintf, 4)
- CALL_MCOUNT 0
- lfs fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0  */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23)  */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0)  */
- bnl cr7,.L10
- bng cr6,.L4
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fabs fp1,fp1 /* if (x == 0.0)  */
- blr /* x = 0.0; */
-.L4:
- bnllr cr6 /* if (x < 0.0)  */
- fsubs fp1,fp1,fp13 /* x-= TWO23;  */
- fadds fp1,fp1,fp13 /* x+= TWO23;  */
- fnabs fp1,fp1 /* if (x == 0.0)  */
- blr /* x = -0.0; */
-.L10:
- /* Ensure sNaN input is converted to qNaN.  */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__rintf)
-
-libm_alias_float (__rint, rint)
-
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 10/28] powerpc: copysign cleanup

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
GCC always expand copysign{f} for all possible cpus, so calling the libm
is only done if user explicitly states to disable the builtin (which is
usually done not for performance reason).  So to provide ifunc variant
for copysign only adds complexity for powerpc and powerpc64 and it not
required for powerpc64le.

This patch removes both powerpc32 and powerpc64 ifunc variants and
consolidates the powerpc implementation on
sysdeps/powerpc/fpu/s_copysign{f}.c using compiler builtins.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/fpu/s_copysign.c: New file.
        * sysdeps/powerpc/fpu/s_copysignf.c: Likewise.
        * sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Remove file.
        * sysdeps/powerpc/powerpc32/fpu/s_copysignf.S: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
        (sysdep_routines, libm-sysdep_routines): Remove s_copysign-power6 and
        s_copysign-ppc32.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Likewise.
        * sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (sysdeps_calls):
        Remove s_copysign-power6 s_copysign-ppc64.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_copysignf.S: Likewise.
        * sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
        * sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S: Likewise.
---
 sysdeps/powerpc/fpu/s_copysign.c              | 32 +++++++++++
 sysdeps/powerpc/fpu/s_copysignf.c             | 28 ++++++++++
 sysdeps/powerpc/powerpc32/fpu/s_copysign.S    | 53 -------------------
 sysdeps/powerpc/powerpc32/fpu/s_copysignf.S   |  1 -
 .../powerpc32/power4/fpu/multiarch/Makefile   |  6 +--
 .../power4/fpu/multiarch/s_copysign-power6.S  | 33 ------------
 .../power4/fpu/multiarch/s_copysign-ppc32.S   | 34 ------------
 .../power4/fpu/multiarch/s_copysign.c         | 45 ----------------
 .../power4/fpu/multiarch/s_copysignf.c        | 34 ------------
 .../powerpc/powerpc32/power6/fpu/s_copysign.S | 49 -----------------
 .../powerpc32/power6/fpu/s_copysignf.S        |  1 -
 .../powerpc/powerpc64/fpu/multiarch/Makefile  |  3 +-
 .../fpu/multiarch/s_copysign-power6.S         | 32 -----------
 .../fpu/multiarch/s_copysign-ppc64.S          | 34 ------------
 .../powerpc64/fpu/multiarch/s_copysign.c      | 45 ----------------
 .../powerpc64/fpu/multiarch/s_copysignf.c     | 34 ------------
 sysdeps/powerpc/powerpc64/fpu/s_copysign.S    | 53 -------------------
 sysdeps/powerpc/powerpc64/fpu/s_copysignf.S   |  1 -
 .../powerpc/powerpc64/power6/fpu/s_copysign.S | 49 -----------------
 .../powerpc64/power6/fpu/s_copysignf.S        |  1 -
 20 files changed, 64 insertions(+), 504 deletions(-)
 create mode 100644 sysdeps/powerpc/fpu/s_copysign.c
 create mode 100644 sysdeps/powerpc/fpu/s_copysignf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_copysign.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_copysignf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_copysign.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_copysignf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S

diff --git a/sysdeps/powerpc/fpu/s_copysign.c b/sysdeps/powerpc/fpu/s_copysign.c
new file mode 100644
index 0000000000..364242e5d9
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_copysign.c
@@ -0,0 +1,32 @@
+/* Copy sign of a number.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <math_ldbl_opt.h>
+#include <libm-alias-double.h>
+
+double
+__copysign (double x, double y)
+{
+  return __builtin_copysign (x, y);
+}
+libm_alias_double (__copysign, copysign)
+#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/powerpc/fpu/s_copysignf.c b/sysdeps/powerpc/fpu/s_copysignf.c
new file mode 100644
index 0000000000..d423bfa793
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_copysignf.c
@@ -0,0 +1,28 @@
+/* Smallest integral value not less than argument.  PowerPC version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-float.h>
+
+float
+__copysignf (float x, float y)
+{
+  return __builtin_copysignf (x, y);
+}
+libm_alias_float (__copysign, copysign)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
deleted file mode 100644
index fa9e5a2a1a..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copy a sign bit between floating-point values.
-   Copyright (C) 1997-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* This has been coded in assembler because GCC makes such a mess of it
-   when it's coded in C.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
-ENTRY(__copysign)
-/* double [f1] copysign (double [f1] x, double [f2] y);
-   copysign(x,y) returns a value with the magnitude of x and
-   with the sign bit of y.  */
- stwu r1,-16(r1)
- cfi_adjust_cfa_offset (16)
- stfd fp2,8(r1)
- lwz r3,8+HIWORD(r1)
- cmpwi   r3,0
- addi    r1,r1,16
- cfi_adjust_cfa_offset (-16)
- blt     L(0)
- fabs    fp1,fp1
- blr
-L(0): fnabs   fp1,fp1
- blr
- END (__copysign)
-
-libm_alias_double (__copysign, copysign)
-
-/* It turns out that it's safe to use this code even for single-precision.  */
-strong_alias(__copysign,__copysignf)
-libm_alias_float (__copysign, copysign)
-
-#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __copysign, copysignl, GLIBC_2_0)
-#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysignf.S b/sysdeps/powerpc/powerpc32/fpu/s_copysignf.S
deleted file mode 100644
index e05438ae7d..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_copysignf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* __copysignf is in s_copysign.S  */
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
index cf38e347f2..7008e775b7 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
@@ -2,8 +2,8 @@ ifeq ($(subdir),math)
 sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \
    s_isnanf-power6 s_isnanf-power5 s_isinf-power7 \
    s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \
-   s_finite-ppc32 s_finitef-ppc32 s_copysign-power6 \
-   s_copysign-ppc32 s_modf-power5+ s_modf-ppc32 \
+   s_finite-ppc32 s_finitef-ppc32 \
+   s_modf-power5+ s_modf-ppc32 \
    s_modff-power5+ s_modff-ppc32
 
 libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \
@@ -18,7 +18,7 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \
  s_floorf-ppc32 s_round-power5+ s_round-ppc32 \
  s_roundf-power5+ s_roundf-ppc32 s_trunc-power5+ \
  s_trunc-ppc32 s_truncf-power5+ s_truncf-ppc32 \
- s_copysign-power6 s_copysign-ppc32 s_lround-power6x \
+ s_lround-power6x \
  s_lround-power5+ s_lround-ppc32 s_lrint-power6x \
  s_lrint-ppc32 s_modf-power5+ s_modf-ppc32 \
  s_modff-power5+ s_modff-ppc32 s_logbl-power7 \
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S
deleted file mode 100644
index 24ab12e41e..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* copysign().  PowerPC32/POWER6 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __copysign __copysign_power6
-
-#include <sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S
deleted file mode 100644
index 0c283c65b0..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/* copysign().  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a, b, c, d)
-
-#define __copysign __copysign_ppc32
-#undef hidden_def
-#define hidden_def(name)
-  strong_alias (__copysign_ppc32, __GI___copysign)
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_copysign.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c
deleted file mode 100644
index f9d1795732..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Multiple versions of copysign.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define NO_MATH_REDIRECT
-/* Redefine copysign so that the compiler won't complain about the type
-   mismatch with the IFUNC selector in strong_alias below.  */
-#undef __copysign
-#define __copysign __redirect_copysign
-#include <math.h>
-#include <math_ldbl_opt.h>
-#undef __copysign
-#include <shlib-compat.h>
-#include "init-arch.h"
-#include <libm-alias-double.h>
-
-extern __typeof (__redirect_copysign) __copysign_ppc32 attribute_hidden;
-extern __typeof (__redirect_copysign) __copysign_power6 attribute_hidden;
-
-extern __typeof (__redirect_copysign) __libm_copysign;
-libc_ifunc (__libm_copysign,
-    (hwcap & PPC_FEATURE_ARCH_2_05)
-    ? __copysign_power6
-            : __copysign_ppc32);
-
-strong_alias (__libm_copysign, __copysign)
-libm_alias_double (__copysign, copysign)
-
-#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
-#endif
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c
deleted file mode 100644
index 12354d0872..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Multiple versions of copysignf.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define NO_MATH_REDIRECT
-#include <math.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-#include <libm-alias-float.h>
-
-/* It's safe to use double-precision implementation for single-precision.  */
-extern __typeof (__copysignf) __copysign_ppc32 attribute_hidden;
-extern __typeof (__copysignf) __copysign_power6 attribute_hidden;
-
-libc_ifunc (__copysignf,
-    (hwcap & PPC_FEATURE_ARCH_2_05)
-    ? __copysign_power6
-            : __copysign_ppc32);
-
-libm_alias_float (__copysign, copysign)
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S
deleted file mode 100644
index abf84ca191..0000000000
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S
+++ /dev/null
@@ -1,49 +0,0 @@
-/* copysign().  PowerPC32/POWER6 version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
-   Contributed by Luis Machado <[hidden email]>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
-/* double [f1] copysign (double [f1] x, double [f2] y);
-   copysign(x,y) returns a value with the magnitude of x and
-   with the sign bit of y.  */
-
- .section    ".text"
- .type    __copysign, @function
- .machine    power6
-EALIGN (__copysign, 4, 0)
- CALL_MCOUNT
- fcpsgn fp1,fp2,fp1
- blr
-END (__copysign)
-
-hidden_def (__copysign)
-libm_alias_double (__copysign, copysign)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__copysign, __copysignf)
-hidden_def (__copysignf)
-libm_alias_float (__copysign, copysign)
-
-#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, copysign, copysignl, GLIBC_2_0);
-#endif
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S
deleted file mode 100644
index d4aa702d07..0000000000
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_copysign.S.  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index 7d469d79af..36d5e65ee1 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -2,8 +2,7 @@ ifeq ($(subdir),math)
 # These functions are built both for libc and libm because they're required
 # by printf.  While the libc objects have the prefix s_, the libm ones are
 # prefixed with  m_.
-sysdep_calls := s_copysign-power6 s_copysign-ppc64 \
- s_finite-power8 s_finite-power7 s_finite-ppc64 \
+sysdep_calls := s_finite-power8 s_finite-power7 s_finite-ppc64 \
  s_finitef-ppc64 \
  s_isinf-power8 s_isinf-ppc64 \
  s_isinff-ppc64 s_isinf-power7 \
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S
deleted file mode 100644
index e901cea480..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* copysign().  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a, b, c, d)
-#undef hidden_def
-#define hidden_def(name)
-
-#define __copysign __copysign_power6
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_copysign.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S
deleted file mode 100644
index a4a783f3f6..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/* copysign().  PowerPC64 default version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
-   Contributed by Luis Machado <[hidden email]>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a, b, c, d)
-
-#define __copysign __copysign_ppc64
-#undef hidden_def
-#define hidden_def(name) \
-  strong_alias (__copysign_ppc64, __GI___copysign)
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_copysign.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c
deleted file mode 100644
index 3d7f7f051d..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Multiple versions of copysign.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define NO_MATH_REDIRECT
-/* Redefine copysign so that the compiler won't complain about the type
-   mismatch with the IFUNC selector in strong_alias below.  */
-#undef __copysign
-#define __copysign __redirect_copysign
-#include <math.h>
-#include <math_ldbl_opt.h>
-#undef __copysign
-#include <shlib-compat.h>
-#include "init-arch.h"
-#include <libm-alias-double.h>
-
-extern __typeof (__redirect_copysign) __copysign_ppc64 attribute_hidden;
-extern __typeof (__redirect_copysign) __copysign_power6 attribute_hidden;
-
-extern __typeof (__redirect_copysign) __libm_copysign;
-libc_ifunc (__libm_copysign,
-    (hwcap & PPC_FEATURE_ARCH_2_05)
-    ? __copysign_power6
-            : __copysign_ppc64);
-
-strong_alias (__libm_copysign, __copysign)
-libm_alias_double (__copysign, copysign)
-
-#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
-#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c
deleted file mode 100644
index d20984b01a..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Multiple versions of copysignf.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define NO_MATH_REDIRECT
-#include <math.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-#include <libm-alias-float.h>
-
-/* It's safe to use double-precision implementation for single-precision. */
-extern __typeof (__copysignf) __copysign_ppc64 attribute_hidden;
-extern __typeof (__copysignf) __copysign_power6 attribute_hidden;
-
-libc_ifunc (__copysignf,
-    (hwcap & PPC_FEATURE_ARCH_2_05)
-    ? __copysign_power6
-            : __copysign_ppc64);
-
-libm_alias_float (__copysign, copysign)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
deleted file mode 100644
index bf6283361c..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copy a sign bit between floating-point values.  PowerPC64 version.
-   Copyright (C) 1997-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* This has been coded in assembler because GCC makes such a mess of it
-   when it's coded in C.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
-ENTRY_TOCLESS (__copysign)
- CALL_MCOUNT 0
-/* double [f1] copysign (double [f1] x, double [f2] y);
-   copysign(x,y) returns a value with the magnitude of x and
-   with the sign bit of y.  */
- stfd fp2,-8(r1)
- nop
- nop
- nop
- ld r3,-8(r1)
- cmpdi   r3,0
- blt     L(0)
- fabs    fp1,fp1
- blr
-L(0): fnabs   fp1,fp1
- blr
- END (__copysign)
-
-libm_alias_double (__copysign, copysign)
-
-/* It turns out that it's safe to use this code even for single-precision.  */
-strong_alias(__copysign,__copysignf)
-libm_alias_float (__copysign, copysign)
-
-#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __copysign, copysignl, GLIBC_2_0)
-#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysignf.S b/sysdeps/powerpc/powerpc64/fpu/s_copysignf.S
deleted file mode 100644
index e05438ae7d..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_copysignf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* __copysignf is in s_copysign.S  */
diff --git a/sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S b/sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S
deleted file mode 100644
index feba531e5b..0000000000
--- a/sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S
+++ /dev/null
@@ -1,49 +0,0 @@
-/* copysign().  PowerPC64/POWER6 version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
-   Contributed by Luis Machado <[hidden email]>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
-/* double [f1] copysign (double [f1] x, double [f2] y);
-   copysign(x,y) returns a value with the magnitude of x and
-   with the sign bit of y.  */
-
- .section    ".text"
- .type    __copysign, @function
- .machine    power6
-ENTRY_TOCLESS (__copysign, 4)
- CALL_MCOUNT 0
- fcpsgn fp1,fp2,fp1
- blr
-END (__copysign)
-
-hidden_def (__copysign)
-libm_alias_double (__copysign, copysign)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__copysign, __copysignf)
-hidden_def (__copysignf)
-libm_alias_float (__copysign, copysign)
-
-#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, copysign, copysignl, GLIBC_2_0);
-#endif
diff --git a/sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S b/sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S
deleted file mode 100644
index d4aa702d07..0000000000
--- a/sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_copysign.S.  */
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 11/28] benchtests: Add isnan/isinf/isfinite benchmark

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * benchtests/Makefile (bench-math): Add isnan, isinf, and isfinite.
        (CFLAGS-bench-isnan.c, CFLAGS-bench-isinf.c,
        CFLAGS-bench-isfinite.c): New rule.
        * benchtests/isnan-input: New file.
        * benchtests/isinf-input: New file.
        * benchtests/isfinite-input: New file.
---
 benchtests/Makefile        |  5 ++++-
 benchtests/isfinite-inputs | 21 +++++++++++++++++++++
 benchtests/isinf-inputs    | 21 +++++++++++++++++++++
 benchtests/isnan-inputs    | 21 +++++++++++++++++++++
 4 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 benchtests/isfinite-inputs
 create mode 100644 benchtests/isinf-inputs
 create mode 100644 benchtests/isnan-inputs

diff --git a/benchtests/Makefile b/benchtests/Makefile
index cdc89488d6..42bf13b27f 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -24,7 +24,7 @@ include ../Makeconfig
 bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 log log2 \
       modf pow rint sin sincos sinh sqrt tan tanh fmin fmax fminf \
       fmaxf powf trunc truncf expf exp2f logf log2f sincosf sinf \
-      cosf
+      cosf isnan isinf isfinite
 
 bench-pthread := pthread_once thread_create
 
@@ -88,6 +88,9 @@ CFLAGS-bench-fmax.c += -fno-builtin
 CFLAGS-bench-fmaxf.c += -fno-builtin
 CFLAGS-bench-trunc.c += -fno-builtin
 CFLAGS-bench-truncf.c += -fno-builtin
+CFLAGS-bench-isnan.c += -fsignaling-nans
+CFLAGS-bench-isinf.c += -fsignaling-nans
+CFLAGS-bench-isfinite.c += -fsignaling-nans
 
 ifeq (${BENCHSET},)
 bench-malloc := malloc-thread malloc-simple
diff --git a/benchtests/isfinite-inputs b/benchtests/isfinite-inputs
new file mode 100644
index 0000000000..35a887c9df
--- /dev/null
+++ b/benchtests/isfinite-inputs
@@ -0,0 +1,21 @@
+## includes: math.h
+## args: double
+## ret: int
+0.9
+2.3
+3.7
+3.9
+4.0
+4.7
+5.9
+0x1.000000cf4a2a1p0
+0x1.0000010b239a8p0
+0x1.00000162a932ap0
+0x1.000002d452a11p0
+0x1.000005bc7d86cp0
+## name: INF
+__builtin_inf ()
+-__builtin_inf ()
+## name: NAN
+__builtin_nan ("")
+__builtin_nans ("")
diff --git a/benchtests/isinf-inputs b/benchtests/isinf-inputs
new file mode 100644
index 0000000000..35a887c9df
--- /dev/null
+++ b/benchtests/isinf-inputs
@@ -0,0 +1,21 @@
+## includes: math.h
+## args: double
+## ret: int
+0.9
+2.3
+3.7
+3.9
+4.0
+4.7
+5.9
+0x1.000000cf4a2a1p0
+0x1.0000010b239a8p0
+0x1.00000162a932ap0
+0x1.000002d452a11p0
+0x1.000005bc7d86cp0
+## name: INF
+__builtin_inf ()
+-__builtin_inf ()
+## name: NAN
+__builtin_nan ("")
+__builtin_nans ("")
diff --git a/benchtests/isnan-inputs b/benchtests/isnan-inputs
new file mode 100644
index 0000000000..35a887c9df
--- /dev/null
+++ b/benchtests/isnan-inputs
@@ -0,0 +1,21 @@
+## includes: math.h
+## args: double
+## ret: int
+0.9
+2.3
+3.7
+3.9
+4.0
+4.7
+5.9
+0x1.000000cf4a2a1p0
+0x1.0000010b239a8p0
+0x1.00000162a932ap0
+0x1.000002d452a11p0
+0x1.000005bc7d86cp0
+## name: INF
+__builtin_inf ()
+-__builtin_inf ()
+## name: NAN
+__builtin_nan ("")
+__builtin_nans ("")
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 12/28] math: Use wordsize-64 version for isnan

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
  - math.h will use compiler builtin for gcc 4.4+ when built without
    -fsignaling-nans and the builtin is expanded inline for all
    supported architectures.  As an example, there is no intra isnan
    call on libm for the architecture I checked (x86, arm, aarch64,
    and powerpc).

  - The resulting binary difference on 32 bits architecture is minimum
    for the non hotspot symbol.

  - It helps wordsize-64 architectures that use ldbl-opt.

  - It add some code simplification with reduction of duplicated
    implementations.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c: Move to ...
        * sysdeps/ieee754/dbl-64/s_isnan.c: ... here and format code.
---
 sysdeps/ieee754/dbl-64/s_isnan.c             | 17 +++------
 sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c | 40 --------------------
 2 files changed, 6 insertions(+), 51 deletions(-)
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c

diff --git a/sysdeps/ieee754/dbl-64/s_isnan.c b/sysdeps/ieee754/dbl-64/s_isnan.c
index 82723eeb8a..1f1535dea3 100644
--- a/sysdeps/ieee754/dbl-64/s_isnan.c
+++ b/sysdeps/ieee754/dbl-64/s_isnan.c
@@ -10,10 +10,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
-#endif
-
 /*
  * isnan(x) returns 1 is x is nan, else 0;
  * no branching!
@@ -23,17 +19,16 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
 #include <math_private.h>
 #include <ldbl-classify-compat.h>
 #include <shlib-compat.h>
+#include <stdint.h>
 
-#undef __isnan
 int
 __isnan (double x)
 {
-  int32_t hx, lx;
-  EXTRACT_WORDS (hx, lx, x);
-  hx &= 0x7fffffff;
-  hx |= (uint32_t) (lx | (-lx)) >> 31;
-  hx = 0x7ff00000 - hx;
-  return (int) (((uint32_t) hx) >> 31);
+  int64_t hx;
+  EXTRACT_WORDS64 (hx, x);
+  hx &= UINT64_C (0x7fffffffffffffff);
+  hx = UINT64_C (0x7ff0000000000000) - hx;
+  return (int)(((uint64_t)hx)>>63);
 }
 hidden_def (__isnan)
 weak_alias (__isnan, isnan)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
deleted file mode 100644
index cd805d157b..0000000000
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* @(#)s_isnan.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * isnan(x) returns 1 is x is nan, else 0;
- * no branching!
- */
-
-#include <math.h>
-#include <math_private.h>
-#include <ldbl-classify-compat.h>
-#include <shlib-compat.h>
-#include <stdint.h>
-
-#undef __isnan
-int __isnan(double x)
-{
- int64_t hx;
- EXTRACT_WORDS64(hx,x);
- hx &= UINT64_C(0x7fffffffffffffff);
- hx = UINT64_C(0x7ff0000000000000) - hx;
- return (int)(((uint64_t)hx)>>63);
-}
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-#ifdef NO_LONG_DOUBLE
-# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-# endif
-weak_alias (__isnan, isnanl)
-#endif
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 13/28] powerpc: Remove optimized isnan

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
The powerpc isnan optimizations are not really a gain:

  - GCC will call libm iff -fsignaling-nans is used. This usage pattern
    is usually not performance oriented and for such calls PLT overhead
    should dominate execution time.

  - The power5, power6, and power6x are just micro-optimization to
    improve the Load-Hit-Store hazards from floating-point to general
    register transfer, and current GCC already has support to minimize
    it by inserting either extra nops or group dispatch instructions.

  - The power7 uses ftdiv to optimize for some input patterns, but at
    cost of others.  Comparing against generic C implementation built
    for powerpc-linux-gnu-power4 (which uses the hp-timing support on
    benchtests):

    - Generic sysdeps/ieee754 implementation:
      "isnan": {
       "": {
        "duration": 4.98415e+09,
        "iterations": 2.34516e+09,
        "max": 45.925,
        "min": 2.052,
        "mean": 2.12529
       },
       "INF": {
        "duration": 4.74057e+09,
        "iterations": 1.69761e+09,
        "max": 91.01,
        "min": 2.052,
        "mean": 2.79249
       },
       "NAN": {
        "duration": 4.74071e+09,
        "iterations": 1.68768e+09,
        "max": 282.343,
        "min": 2.052,
        "mean": 2.809
       }
      }

    - power7 optimized one:
    $ ./testrun.sh benchtests/bench-isnan
      "isnan": {
       "": {
        "duration": 4.96842e+09,
        "iterations": 2.56297e+09,
        "max": 50.048,
        "min": 1.872,
        "mean": 1.93854
       },
       "INF": {
        "duration": 4.76648e+09,
        "iterations": 1.54213e+09,
        "max": 373.408,
        "min": 2.661,
        "mean": 3.09084
       },
       "NAN": {
        "duration": 4.76845e+09,
        "iterations": 1.54515e+09,
        "max": 51.016,
        "min": 2.736,
        "mean": 3.08607
       }
      }

    So it basically optimizes marginally for normal numbers while
    increasing the latency for other kind of FP.

  - The generic implementation requires getting the floating point
    status, disable the invalid operation bit, and restore the
    floating-point status.  Each operation is costly and requires
    flushing the FP pipeline.

    Using the same scenarion for the previous analysis:

      "isnan": {
       "": {
        "duration": 5.08284e+09,
        "iterations": 6.2898e+08,
        "max": 41.844,
        "min": 8.057,
        "mean": 8.08108
       },
       "INF": {
        "duration": 4.97904e+09,
        "iterations": 6.16176e+08,
        "max": 39.661,
        "min": 8.057,
        "mean": 8.08055
       },
       "NAN": {
        "duration": 4.98695e+09,
        "iterations": 5.95866e+08,
        "max": 29.728,
        "min": 8.345,
        "mean": 8.36925
       }
      }

  - The power8 implementation is just the generic implementation using
    ISA 2.07 mfvsrd instruction (which GCC uses for generic implementation).
    So generic implementation already generates best code for powerpc64le.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/fpu/s_isnan.c: Remove file.
        * sysdeps/powerpc/fpu/s_isnanf.S: Likewise.
        * sysdeps/powerpc/powerpc32/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/x/powerpc32/power4/fpu/multiarch/Makefile
        (sysdeps_routines): Remove s_isnan-* objects.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S:
        Remove file
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c: Likewise.
        * sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S: Likewise.
        * sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S: Likewise.
        * sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (sysdep_calls):
        Remove s_isnan-* objects.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S: Likewise.
        * sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise.
        * sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S: Likewise.
---
 sysdeps/powerpc/fpu/s_isnan.c                 | 62 -------------
 sysdeps/powerpc/fpu/s_isnanf.S                |  1 -
 sysdeps/powerpc/powerpc32/fpu/s_isnan.S       | 57 ------------
 .../powerpc32/power4/fpu/multiarch/Makefile   |  7 +-
 .../power4/fpu/multiarch/s_isnan-power5.S     | 33 -------
 .../power4/fpu/multiarch/s_isnan-power6.S     | 33 -------
 .../power4/fpu/multiarch/s_isnan-power7.S     | 33 -------
 .../power4/fpu/multiarch/s_isnan-ppc32.S      | 32 -------
 .../powerpc32/power4/fpu/multiarch/s_isnan.c  | 56 ------------
 .../power4/fpu/multiarch/s_isnanf-power5.S    | 28 ------
 .../power4/fpu/multiarch/s_isnanf-power6.S    | 28 ------
 .../powerpc32/power4/fpu/multiarch/s_isnanf.c | 39 --------
 .../powerpc/powerpc32/power5/fpu/s_isnan.S    | 61 -------------
 .../powerpc/powerpc32/power5/fpu/s_isnanf.S   | 45 ----------
 .../powerpc/powerpc32/power6/fpu/s_isnan.S    | 61 -------------
 .../powerpc/powerpc32/power6/fpu/s_isnanf.S   | 44 ---------
 .../powerpc/powerpc32/power7/fpu/s_isnan.S    | 90 -------------------
 .../powerpc/powerpc32/power7/fpu/s_isnanf.S   |  1 -
 .../powerpc/powerpc64/fpu/multiarch/Makefile  |  2 -
 .../powerpc64/fpu/multiarch/s_isnan-power5.S  | 32 -------
 .../powerpc64/fpu/multiarch/s_isnan-power6.S  | 32 -------
 .../powerpc64/fpu/multiarch/s_isnan-power6x.S | 32 -------
 .../powerpc64/fpu/multiarch/s_isnan-power7.S  | 32 -------
 .../powerpc64/fpu/multiarch/s_isnan-power8.S  | 32 -------
 .../powerpc64/fpu/multiarch/s_isnan-ppc64.S   | 36 --------
 .../powerpc/powerpc64/fpu/multiarch/s_isnan.c | 71 ---------------
 .../powerpc64/fpu/multiarch/s_isnanf.c        | 44 ---------
 sysdeps/powerpc/powerpc64/fpu/s_isnan.S       | 56 ------------
 .../powerpc/powerpc64/power5/fpu/s_isnan.S    | 60 -------------
 .../powerpc/powerpc64/power6/fpu/s_isnan.S    | 59 ------------
 .../powerpc/powerpc64/power6x/fpu/s_isnan.S   | 58 ------------
 .../powerpc/powerpc64/power7/fpu/s_isnan.S    | 68 --------------
 .../powerpc/powerpc64/power7/fpu/s_isnanf.S   |  1 -
 .../powerpc/powerpc64/power8/fpu/s_isnan.S    | 56 ------------
 .../powerpc/powerpc64/power8/fpu/s_isnanf.S   |  1 -
 35 files changed, 2 insertions(+), 1381 deletions(-)
 delete mode 100644 sysdeps/powerpc/fpu/s_isnan.c
 delete mode 100644 sysdeps/powerpc/fpu/s_isnanf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S

diff --git a/sysdeps/powerpc/fpu/s_isnan.c b/sysdeps/powerpc/fpu/s_isnan.c
deleted file mode 100644
index b62c4cbd0f..0000000000
--- a/sysdeps/powerpc/fpu/s_isnan.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Return 1 if argument is a NaN, else 0.
-   Copyright (C) 1997-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* Ugly kludge to avoid declarations.  */
-#define __isnanf __Xisnanf
-#define isnanf Xisnanf
-#define __GI___isnanf __GI___Xisnanf
-
-#include <math.h>
-#include <math_ldbl_opt.h>
-#include <fenv_libc.h>
-
-#undef __isnanf
-#undef isnanf
-#undef __GI___isnanf
-
-
-/* The hidden_proto in include/math.h was obscured by the macro hackery.  */
-__typeof (__isnan) __isnanf;
-hidden_proto (__isnanf)
-
-
-int
-__isnan (double x)
-{
-  fenv_t savedstate;
-  int result;
-  savedstate = fegetenv_register ();
-  reset_fpscr_bit (FPSCR_VE);
-  result = !(x == x);
-  fesetenv_register (savedstate);
-  return result;
-}
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isnan, __isnanf)
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
diff --git a/sysdeps/powerpc/fpu/s_isnanf.S b/sysdeps/powerpc/fpu/s_isnanf.S
deleted file mode 100644
index fc22f678a1..0000000000
--- a/sysdeps/powerpc/fpu/s_isnanf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* __isnanf is in s_isnan.c  */
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/fpu/s_isnan.S
deleted file mode 100644
index f28533d40a..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_isnan.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/* isnan().  PowerPC32 version.
-   Copyright (C) 2008-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isnan(x)  */
- .machine power4
-EALIGN (__isnan, 4, 0)
- mffs fp0
- mtfsb0 4*cr6+lt /* reset_fpscr_bit (FPSCR_VE) */
- fcmpu cr7,fp1,fp1
- mtfsf 255,fp0
- li r3,0
- beqlr+ cr7 /* (x == x) then not a NAN */
- li r3,1 /* else must be a NAN */
- blr
- END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-#ifndef __isnan
-strong_alias (__isnan, __isnanf)
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-#endif
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
-
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
index 7008e775b7..0b39461a1a 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
@@ -1,6 +1,5 @@
 ifeq ($(subdir),math)
-sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \
-   s_isnanf-power6 s_isnanf-power5 s_isinf-power7 \
+sysdep_routines += s_isinf-power7 \
    s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \
    s_finite-ppc32 s_finitef-ppc32 \
    s_modf-power5+ s_modf-ppc32 \
@@ -8,9 +7,7 @@ sysdep_routines += s_isnan-power7 s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \
 
 libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \
  s_llrint-ppc32 s_llround-power6 s_llround-power5+ \
- s_llround-ppc32 s_isnan-power7 \
- s_isnan-power6 s_isnan-power5 s_isnan-ppc32 \
- s_isnanf-power6 s_isnanf-power5 s_isinf-power7 \
+ s_llround-ppc32 s_isinf-power7 \
  s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \
  s_finite-ppc32 s_finitef-ppc32 s_ceil-power5+ \
  s_ceil-ppc32 s_ceilf-power5+ s_ceilf-ppc32 \
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S
deleted file mode 100644
index b4bb2bd4bf..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* isnan().  PowerPC32/POWER5 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, symbol, ver)
-
-#define __isnan __isnan_power5
-
-#include <sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S
deleted file mode 100644
index c8a429b1e6..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* isnan().  PowerPC32/POWER6 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, symbol, ver)
-
-#define __isnan __isnan_power6
-
-#include <sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S
deleted file mode 100644
index ae3fc0539b..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* isnan().  PowerPC32/POWER7 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, symbol, ver)
-
-#define __isnan __isnan_power7
-
-#include <sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S
deleted file mode 100644
index 4b204ae6cf..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* isnan().  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a, b)
-#undef compat_symbol
-#define compat_symbol(a, b, c, d)
-
-#define __isnan __isnan_ppc32
-#undef hidden_def
-#define hidden_def(name)
-  strong_alias (__isnan_ppc32, __GI___isnan)
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c
deleted file mode 100644
index 8a7c31f998..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Multiple versions of isnan.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define __isnan __redirect___isnan
-#define __isnanf __redirect___isnanf
-#define __isnanl __redirect___isnanl
-#include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-extern __typeof (__isnan) __isnan_ppc32 attribute_hidden;
-extern __typeof (__isnan) __isnan_power5 attribute_hidden;
-extern __typeof (__isnan) __isnan_power6 attribute_hidden;
-extern __typeof (__isnan) __isnan_power7 attribute_hidden;
-#undef __isnan
-#undef __isnanf
-#undef __isnanl
-
-libc_ifunc_redirected (__redirect___isnan, __isnan,
-       (hwcap & PPC_FEATURE_ARCH_2_06)
-       ? __isnan_power7
-       : (hwcap & PPC_FEATURE_ARCH_2_05)
- ? __isnan_power6
- : (hwcap & PPC_FEATURE_POWER5)
-   ? __isnan_power5
-   : __isnan_ppc32);
-
-weak_alias (__isnan, isnan)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S
deleted file mode 100644
index c456d82999..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/* isnanf().  PowerPC32/POWER5 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-
-#define __isnanf __isnanf_power5
-
-#include <sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S
deleted file mode 100644
index 0133cf218f..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/* isnanf().  PowerPC32/POWER6 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-
-#define __isnanf __isnanf_power6
-
-#include <sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c
deleted file mode 100644
index acb84dbc61..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Multiple versions of isnanf.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-/* Both ppc32 and power7 isnan(double) work for float.  */
-extern __typeof (__isnanf) __isnan_ppc32 attribute_hidden;
-extern __typeof (__isnanf) __isnanf_power5 attribute_hidden;
-extern __typeof (__isnanf) __isnanf_power6 attribute_hidden;
-extern __typeof (__isnanf) __isnan_power7 attribute_hidden;
-
-libc_ifunc_hidden (__isnanf, __isnanf,
-   (hwcap & PPC_FEATURE_ARCH_2_06)
-   ? __isnan_power7
-   : (hwcap & PPC_FEATURE_ARCH_2_05)
-     ? __isnanf_power6
-     : (hwcap & PPC_FEATURE_POWER5)
-       ? __isnanf_power5
-       : __isnan_ppc32);
-
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S
deleted file mode 100644
index 1326973bfc..0000000000
--- a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S
+++ /dev/null
@@ -1,61 +0,0 @@
-/* isnan().  PowerPC32 version.
-   Copyright (C) 2008-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isnan(x)  */
- .machine power5
-EALIGN (__isnan, 4, 0)
- stwu r1,-32(r1)
- cfi_adjust_cfa_offset (32)
- ori r1,r1,0
- stfd fp1,24(r1) /* copy FPR to GPR */
- ori r1,r1,0
- lwz r4,24+HIWORD(r1)
- lwz r5,24+LOWORD(r1)
- lis r0,0x7ff0 /* const long r0 0x7ff00000 00000000 */
- clrlwi r4,r4,1 /* x = fabs(x) */
- cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */
- cmpwi cr6,r5,0
- li r3,0 /* then return 0 */
- addi r1,r1,32
- cfi_adjust_cfa_offset (-32)
- bltlr+ cr7
- bgt- cr7,L(NaN)
- beqlr+ cr6
-L(NaN):
- li r3,1 /* else return 1 */
- blr
- END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
-
diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S
deleted file mode 100644
index 1cc495f3a8..0000000000
--- a/sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S
+++ /dev/null
@@ -1,45 +0,0 @@
-/* isnan().  PowerPC32 version.
-   Copyright (C) 2008-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isnanf(x)  */
- .machine power5
-EALIGN (__isnanf, 4, 0)
- stwu r1,-32(r1)
- cfi_adjust_cfa_offset (32)
- stfs fp1,28(r1) /* copy FPR to GPR */
- nop
- nop
- lwz r4,28(r1)
- lis r0,0x7f80 /* const long r0 0x7f800000 */
- clrlwi r4,r4,1 /* x = fabs(x) */
- cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */
- li r3,0 /* then return 0 */
- addi r1,r1,32
- cfi_adjust_cfa_offset (-32)
- blelr+ cr7
-L(NaN):
- li r3,1 /* else return 1 */
- blr
- END (__isnanf)
-
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S
deleted file mode 100644
index d283682a71..0000000000
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S
+++ /dev/null
@@ -1,61 +0,0 @@
-/* isnan().  PowerPC32 version.
-   Copyright (C) 2008-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isnan(x)  */
- .machine power6
-EALIGN (__isnan, 4, 0)
- stwu r1,-32(r1)
- cfi_adjust_cfa_offset (32)
- ori r1,r1,0
- stfd fp1,24(r1) /* copy FPR to GPR */
- ori r1,r1,0
- lwz r4,24+HIWORD(r1)
- lwz r5,24+LOWORD(r1)
- lis r0,0x7ff0 /* const long r0 0x7ff00000 00000000 */
- clrlwi r4,r4,1 /* x = fabs(x) */
- cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */
- cmpwi cr6,r5,0
- li r3,0 /* then return 0 */
- addi r1,r1,32
- cfi_adjust_cfa_offset (-32)
- bltlr+ cr7
- bgt- cr7,L(NaN)
- beqlr+ cr6
-L(NaN):
- li r3,1 /* else return 1 */
- blr
- END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
-
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S
deleted file mode 100644
index 6e61471cf0..0000000000
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S
+++ /dev/null
@@ -1,44 +0,0 @@
-/* isnanf().  PowerPC32 version.
-   Copyright (C) 2008-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isnanf(x)  */
- .machine power6
-EALIGN (__isnanf, 4, 0)
- stwu r1,-32(r1)
- cfi_adjust_cfa_offset (32)
- ori r1,r1,0
- stfs fp1,24(r1) /* copy FPR to GPR */
- ori r1,r1,0
- lwz r4,24(r1)
- lis r0,0x7f80 /* const long r0 0x7f800000 */
- clrlwi r4,r4,1 /* x = fabs(x) */
- cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */
- li r3,0 /* then return 0 */
- addi r1,r1,32
- cfi_adjust_cfa_offset (-32)
- blelr+ cr7
-L(NaN):
- li r3,1 /* else return 1 */
- blr
- END (__isnanf)
-
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
deleted file mode 100644
index 524a4a6a32..0000000000
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
+++ /dev/null
@@ -1,90 +0,0 @@
-/* isnan().  PowerPC32/POWER7 version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
-   Contributed by Luis Machado <[hidden email]>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isnan(x)  */
- .section    .rodata.cst8,"aM",@progbits,8
- .align 3
-.LC0:   /* 1.0 */
- .quad    0x3ff0000000000000
-
- .section    ".text"
- .type    __isnan, @function
- .machine    power7
-ENTRY (__isnan)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
-
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfd fp0,.LC0-got_label@l(r9)
-
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfd fp0,.LC0@l(r9)
-#endif
- ftdiv cr7,fp1,fp0
- li r3,0
- bflr 30      /* If not NaN or Inf, finish. */
-
- /* We have -INF/+INF/NaN or a denormal.  */
-
- stwu r1,-16(r1)    /* Allocate stack space.  */
- stfd fp1,8(r1)     /* Transfer FP to GPR's.  */
- ori 2,2,0      /* Force a new dispatch group.  */
- lwz     r4,8+HIWORD(r1) /* Load the upper half of the FP value.  */
- lwz     r5,8+LOWORD(r1) /* Load the lower half of the FP value.  */
- addi r1,r1,16      /* Reset the stack pointer.  */
- lis     r0,0x7ff0     /* Load the upper portion for an INF/NaN.  */
- clrlwi  r4,r4,1      /* r4 = abs(r4).  */
- cmpw    cr7,r4,r0     /* if (abs(r4) <= inf).  */
- cmpwi   cr6,r5,0      /* r5 == 0x00000000?  */
- bltlr cr7      /* LT means we have a denormal.  */
- bgt cr7,L(NaN)    /* GT means we have a NaN.  */
- beqlr cr6      /* EQ means we have +/-INF.  */
-L(NaN):
- li      r3,1      /* x == NaN?  */
- blr
- END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isnan, __isnanf)
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S
deleted file mode 100644
index b48c85e0d3..0000000000
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_isnan.S.  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index 36d5e65ee1..a0b5939abe 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -6,8 +6,6 @@ sysdep_calls := s_finite-power8 s_finite-power7 s_finite-ppc64 \
  s_finitef-ppc64 \
  s_isinf-power8 s_isinf-ppc64 \
  s_isinff-ppc64 s_isinf-power7 \
- s_isnan-power8 s_isnan-power7 s_isnan-power6x s_isnan-power6 \
- s_isnan-power5 s_isnan-ppc64 \
  s_modf-power5+ s_modf-ppc64 \
  s_modff-power5+ s_modff-ppc64
 
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S
deleted file mode 100644
index 949c51ed12..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* isnan().  PowerPC64/POWER5 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, symbol, ver)
-
-#define __isnan __isnan_power5
-
-#include <sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S
deleted file mode 100644
index e946d78c75..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* isnan().  PowerPC64/POWER6 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, symbol, ver)
-
-#define __isnan __isnan_power6
-
-#include <sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S
deleted file mode 100644
index 00016225eb..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* isnan().  PowerPC64/POWER6X version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, symbol, ver)
-
-#define __isnan __isnan_power6x
-
-#include <sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S
deleted file mode 100644
index f32b1feaca..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* isnan().  PowerPC64/POWER7 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, symbol, ver)
-
-#define __isnan __isnan_power7
-
-#include <sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S
deleted file mode 100644
index 4f292f146c..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* isnan().  PowerPC64/POWER7 version.
-   Copyright (C) 2014-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, symbol, ver)
-
-#define __isnan __isnan_power8
-
-#include <sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S
deleted file mode 100644
index 6c508aea16..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/* isnan().  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-
-#define __isnan __isnan_ppc64
-#ifdef SHARED
- #undef hidden_def
- #define hidden_def(name) \
-   .globl __GI___isnan ; .set __GI___isnan,__isnan_ppc64
-#endif
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_isnan.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
deleted file mode 100644
index 5aa44eab12..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Multiple versions of isnan.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define __isnan __redirect___isnan
-
-/* The following definitions, although not related to the 'double'
-   version of 'isnan', are required to guarantee macro expansions
-   (e.g.: from __isnanf to __redirect_isnanf) in include/math.h, thus
-   compensating for the unintended macro expansions in
-   math/bits/mathcalls-helper-functions.h.  */
-#define __isnanf __redirect___isnanf
-#define __isnanl __redirect___isnanl
-#define __isnanf128 __redirect___isnanf128
-
-#include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-extern __typeof (__isnan) __isnan_ppc64 attribute_hidden;
-extern __typeof (__isnan) __isnan_power5 attribute_hidden;
-extern __typeof (__isnan) __isnan_power6 attribute_hidden;
-extern __typeof (__isnan) __isnan_power6x attribute_hidden;
-extern __typeof (__isnan) __isnan_power7 attribute_hidden;
-extern __typeof (__isnan) __isnan_power8 attribute_hidden;
-#undef __isnan
-#undef __isnanf
-#undef __isnanl
-#undef __isnanf128
-
-libc_ifunc_redirected (__redirect___isnan, __isnan,
-       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-       ? __isnan_power8
-       : (hwcap & PPC_FEATURE_ARCH_2_06)
- ? __isnan_power7
- : (hwcap & PPC_FEATURE_POWER6_EXT)
-   ? __isnan_power6x
-   : (hwcap & PPC_FEATURE_ARCH_2_05)
-     ? __isnan_power6
-     : (hwcap & PPC_FEATURE_POWER5)
-       ? __isnan_power5
-       : __isnan_ppc64);
-
-weak_alias (__isnan, isnan)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c
deleted file mode 100644
index 5d789ce196..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Multiple versions of isnan.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-#include "init-arch.h"
-
-/* The double-precision implementation also works for the single one.  */
-extern __typeof (__isnanf) __isnan_ppc64 attribute_hidden;
-extern __typeof (__isnanf) __isnan_power5 attribute_hidden;
-extern __typeof (__isnanf) __isnan_power6 attribute_hidden;
-extern __typeof (__isnanf) __isnan_power6x attribute_hidden;
-extern __typeof (__isnanf) __isnan_power7 attribute_hidden;
-extern __typeof (__isnanf) __isnan_power8 attribute_hidden;
-
-libc_ifunc_hidden (__isnanf, __isnanf,
-   (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-   ? __isnan_power8
-   : (hwcap & PPC_FEATURE_ARCH_2_06)
-     ? __isnan_power7
-     : (hwcap & PPC_FEATURE_POWER6_EXT)
-       ? __isnan_power6x
-       : (hwcap & PPC_FEATURE_ARCH_2_05)
- ? __isnan_power6
- : (hwcap & PPC_FEATURE_POWER5)
-   ? __isnan_power5
-   : __isnan_ppc64);
-
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/fpu/s_isnan.S
deleted file mode 100644
index ff52c974f8..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_isnan.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* isnan().  PowerPC64 version.
-   Copyright (C) 2008-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isnan(x)  */
- .machine power4
-ENTRY_TOCLESS (__isnan, 4)
- CALL_MCOUNT 0
- mffs fp0
- mtfsb0 4*cr6+lt /* reset_fpscr_bit (FPSCR_VE) */
- fcmpu cr7,fp1,fp1
- mtfsf 255,fp0
- li r3,0
- beqlr+ cr7 /* (x == x) then not a NAN */
- li r3,1 /* else must be a NAN */
- blr
- END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isnan, __isnanf)
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
-
diff --git a/sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S
deleted file mode 100644
index d0c7d81942..0000000000
--- a/sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S
+++ /dev/null
@@ -1,60 +0,0 @@
-/* isnan().  PowerPC64 version.
-   Copyright (C) 2008-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isnan(x)  */
- .machine power5
-ENTRY_TOCLESS (__isnan, 4)
- CALL_MCOUNT 0
- stfd fp1,-8(r1) /* copy FPR to GPR */
- lis r0,0x7ff0
- nop /* insure the following is in a different */
- nop /* dispatch group */
- ld r4,-8(r1)
- sldi r0,r0,32 /* const long r0 0x7ff00000 00000000 */
- clrldi r4,r4,1 /* x = fabs(x) */
- cmpd cr7,r4,r0 /* if (fabs(x) <= inf) */
- li r3,0 /* then return 0 */
- blelr+ cr7
- li r3,1 /* else return 1 */
- blr
- END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isnan, __isnanf)
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
-
diff --git a/sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S
deleted file mode 100644
index be1c2c4d04..0000000000
--- a/sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S
+++ /dev/null
@@ -1,59 +0,0 @@
-/* isnan().  PowerPC64 version.
-   Copyright (C) 2008-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isnan(x)  */
- .machine power6
-ENTRY_TOCLESS (__isnan, 4)
- CALL_MCOUNT 0
- stfd fp1,-8(r1) /* copy FPR to GPR */
- ori r1,r1,0
- ld r4,-8(r1)
- lis r0,0x7ff0
- sldi r0,r0,32 /* const long r0 0x7ff00000 00000000 */
- clrldi r4,r4,1 /* x = fabs(x) */
- cmpd cr7,r4,r0 /* if (fabs(x) <= inf) */
- li r3,0 /* then return 0 */
- blelr+ cr7
- li r3,1 /* else return 1 */
- blr
- END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isnan, __isnanf)
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
-
diff --git a/sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S
deleted file mode 100644
index b32a87a025..0000000000
--- a/sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S
+++ /dev/null
@@ -1,58 +0,0 @@
-/* isnan().  PowerPC64 version.
-   Copyright (C) 2008-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isnan(x)  */
- .machine power6
-ENTRY_TOCLESS (__isnan, 4)
- CALL_MCOUNT 0
- mftgpr r4,fp1 /* copy FPR to GPR */
- lis r0,0x7ff0
- ori r1,r1,0
- clrldi r4,r4,1 /* x = fabs(x) */
- sldi r0,r0,32 /* const long r0 0x7ff00000 00000000 */
- cmpd cr7,r4,r0 /* if (fabs(x) <= inf) */
- li r3,0 /* then return 0 */
- blelr+ cr7
- li r3,1 /* else return 1 */
- blr
- END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isnan, __isnanf)
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
-
diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S
deleted file mode 100644
index f7df57fe6a..0000000000
--- a/sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S
+++ /dev/null
@@ -1,68 +0,0 @@
-/* isnan().  PowerPC64/POWER7 version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
-   Contributed by Luis Machado <[hidden email]>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isnan(x)  */
- .section    ".toc","aw"
-.LC0:   /* 1.0 */
- .tc    FD_ONE[TC],0x3ff0000000000000
- .section    ".text"
- .type    __isnan, @function
- .machine    power7
-ENTRY (__isnan, 4)
- CALL_MCOUNT 0
- lfd fp0,.LC0@toc(r2)
- ftdiv cr7,fp1,fp0
- li r3,0
- bflr 30      /* If not NaN, finish.  */
-
- stfd    fp1,-16(r1)   /* Transfer FP to GPR's.  */
- ori 2,2,0      /* Force a new dispatch group.  */
- ld r4,-16(r1)    /* Load FP into GPR.  */
- lis     r0,0x7ff0
- sldi r0,r0,32      /* const long r0 0x7ff00000 00000000.  */
- clrldi r4,r4,1      /* x = fabs(x)  */
- cmpd cr7,r4,r0     /* if (fabs(x) <= inf)  */
- blelr cr7      /* LE means not NaN.  */
- li r3,1      /* else return 1  */
- blr
- END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isnan, __isnanf)
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S
deleted file mode 100644
index b48c85e0d3..0000000000
--- a/sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_isnan.S.  */
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S
deleted file mode 100644
index b8ee9c7db4..0000000000
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* isnan().  PowerPC64/POWER8 version.
-   Copyright (C) 2014-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#define MFVSRD_R3_V1  .long 0x7c230066     /* mfvsrd  r3,vs1  */
-
-/* int [r3] __isnan([f1] x)  */
-
-ENTRY_TOCLESS (__isnan, 4)
- CALL_MCOUNT 0
- MFVSRD_R3_V1
- lis     r9,0x7ff0
- clrldi  r3,r3,1       /* r3 = r3 & 0x8000000000000000  */
- rldicr  r9,r9,32,31   /* r9 = (r9 << 32) & 0xffffffff  */
- subf    r3,r3,r9
- rldicl  r3,r3,1,63
- blr
-END (__isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isnan, __isnanf)
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
-weak_alias (__isnan, isnanl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
-compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S
deleted file mode 100644
index b48c85e0d3..0000000000
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_isnan.S.  */
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 14/28] math: Use wordsize-64 version for isinf

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
  - math.h will use compiler builtin for gcc 4.4+ when built without
    -fsignaling-nans and the builtin is expanded inline for all
    supported architectures.  As an example, there is no intra isnan
    call on libm for the architecture I checked (x86, arm, aarch64,
    and powerpc).

  - The resulting binary difference on 32 bits architecture is minimum
    for the non hotspot symbol.

  - It helps wordsize-64 architectures that use ldbl-opt.

  - It add some code simplification with reduction of duplicated
    implementations.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c: Move to ...
        * sysdeps/ieee754/dbl-64/s_isinf.c: ... here and format code.
---
 sysdeps/ieee754/dbl-64/s_isinf.c             | 15 ++++-----
 sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c | 34 --------------------
 2 files changed, 6 insertions(+), 43 deletions(-)
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c

diff --git a/sysdeps/ieee754/dbl-64/s_isinf.c b/sysdeps/ieee754/dbl-64/s_isinf.c
index 93eb65c147..e5300fd2a5 100644
--- a/sysdeps/ieee754/dbl-64/s_isinf.c
+++ b/sysdeps/ieee754/dbl-64/s_isinf.c
@@ -4,10 +4,6 @@
  * Public domain.
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
-#endif
-
 /*
  * isinf(x) returns 1 is x is inf, -1 if x is -inf, else 0;
  * no branching!
@@ -21,11 +17,12 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
 int
 __isinf (double x)
 {
-  int32_t hx, lx;
-  EXTRACT_WORDS (hx, lx, x);
-  lx |= (hx & 0x7fffffff) ^ 0x7ff00000;
-  lx |= -lx;
-  return ~(lx >> 31) & (hx >> 30);
+  int64_t ix;
+  EXTRACT_WORDS64 (ix,x);
+  int64_t t = ix & UINT64_C (0x7fffffffffffffff);
+  t ^= UINT64_C (0x7ff0000000000000);
+  t |= -t;
+  return ~(t >> 63) & (ix >> 62);
 }
 hidden_def (__isinf)
 weak_alias (__isinf, isinf)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c
deleted file mode 100644
index 2b427a8b4c..0000000000
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Written by J.T. Conklin <[hidden email]>.
- * Changed to return -1 for -Inf by Ulrich Drepper <[hidden email]>.
- * Public domain.
- */
-
-/*
- * isinf(x) returns 1 is x is inf, -1 if x is -inf, else 0;
- * no branching!
- */
-
-#include <math.h>
-#include <math_private.h>
-#include <ldbl-classify-compat.h>
-#include <shlib-compat.h>
-
-int
-__isinf (double x)
-{
- int64_t ix;
- EXTRACT_WORDS64(ix,x);
- int64_t t = ix & UINT64_C(0x7fffffffffffffff);
- t ^= UINT64_C(0x7ff0000000000000);
- t |= -t;
- return ~(t >> 63) & (ix >> 62);
-}
-hidden_def (__isinf)
-weak_alias (__isinf, isinf)
-#ifdef NO_LONG_DOUBLE
-# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
-compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
-# endif
-weak_alias (__isinf, isinfl)
-#endif
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 15/28] powerpc: Remove optimized isinf

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
The powerpc isinf optimizations onyl adds complexity:

  - GCC will call libm iff -fsignaling-nans is used. This usage pattern
    is usually not performance oriented and for such calls PLT overhead
    should dominate execution time.

  - The power7 uses ftdiv to optimize for some input pattern and branch
    implementation for INF and denormal that does:

    return (ix & UINT64_C (0x7fffffffffffffff)) == UINT64_C (0x7ff0000000000000)

    Although it does show slight better latency than generic algorithm,
    it is only for power7 and requires it to override it for power8.

  - The power8 implementation is just the generic implementation using
    ISA 2.07 mfvsrd instruction (which GCC uses for generic implementation).
    So generic implementation is already the best option for powerpc64le.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
        (sysdeps_routines, libm-sysdep_routines): Remove s_isinf*
        objects.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S:
        Remove file.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c: Likewise.
        * sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise.
        * sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile usysdep_call):
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c: Likewise.
        * sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
        * sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S: Likewise.
        * sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise.
        * sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S: Likewise.
---
 .../powerpc32/power4/fpu/multiarch/Makefile   |  6 +-
 .../power4/fpu/multiarch/s_isinf-power7.S     | 33 -------
 .../power4/fpu/multiarch/s_isinf-ppc32.c      | 33 -------
 .../powerpc32/power4/fpu/multiarch/s_isinf.c  | 50 -----------
 .../power4/fpu/multiarch/s_isinff-ppc32.c     | 31 -------
 .../powerpc32/power4/fpu/multiarch/s_isinff.c | 35 --------
 .../powerpc/powerpc32/power7/fpu/s_isinf.S    | 85 -------------------
 .../powerpc/powerpc32/power7/fpu/s_isinff.S   |  1 -
 .../powerpc/powerpc64/fpu/multiarch/Makefile  |  2 -
 .../powerpc64/fpu/multiarch/s_isinf-power7.S  | 32 -------
 .../powerpc64/fpu/multiarch/s_isinf-power8.S  | 32 -------
 .../powerpc64/fpu/multiarch/s_isinf-ppc64.c   | 33 -------
 .../powerpc/powerpc64/fpu/multiarch/s_isinf.c | 62 --------------
 .../powerpc64/fpu/multiarch/s_isinff-ppc64.c  | 31 -------
 .../powerpc64/fpu/multiarch/s_isinff.c        | 38 ---------
 .../powerpc/powerpc64/power7/fpu/s_isinf.S    | 69 ---------------
 .../powerpc/powerpc64/power7/fpu/s_isinff.S   |  1 -
 .../powerpc/powerpc64/power8/fpu/s_isinf.S    | 61 -------------
 .../powerpc/powerpc64/power8/fpu/s_isinff.S   |  1 -
 19 files changed, 2 insertions(+), 634 deletions(-)
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S

diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
index 0b39461a1a..c7b9d48094 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
@@ -1,14 +1,12 @@
 ifeq ($(subdir),math)
-sysdep_routines += s_isinf-power7 \
-   s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \
+sysdep_routines += s_finite-power7 \
    s_finite-ppc32 s_finitef-ppc32 \
    s_modf-power5+ s_modf-ppc32 \
    s_modff-power5+ s_modff-ppc32
 
 libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \
  s_llrint-ppc32 s_llround-power6 s_llround-power5+ \
- s_llround-ppc32 s_isinf-power7 \
- s_isinf-ppc32 s_isinff-ppc32 s_finite-power7 \
+ s_llround-ppc32 s_finite-power7 \
  s_finite-ppc32 s_finitef-ppc32 s_ceil-power5+ \
  s_ceil-ppc32 s_ceilf-power5+ s_ceilf-ppc32 \
  s_floor-power5+ s_floor-ppc32 s_floorf-power5+ \
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S
deleted file mode 100644
index 0e6e61352d..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* isinf().  PowerPC32/POWER7 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __isinf __isinf_power7
-
-#include <sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c
deleted file mode 100644
index 09e51c9891..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* isinf().  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-
-#undef weak_alias
-#define weak_alias(a, b)
-#undef strong_alias
-#define strong_alias(a, b)
-
-#define __isinf __isinf_ppc32
-#ifdef SHARED
-# undef hidden_def
-# define hidden_def(a) \
-   __hidden_ver1 (__isinf_ppc32, __GI___isinf, __isinf_ppc32);
-#endif
-
-#include <sysdeps/ieee754/dbl-64/s_isinf.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c
deleted file mode 100644
index c115c7fef1..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Multiple versions of isinf.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define __isinf __redirect___isinf
-#define __isinff __redirect___isinff
-#define __isinfl __redirect___isinfl
-#include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-extern __typeof (__isinf) __isinf_ppc32 attribute_hidden;
-extern __typeof (__isinf) __isinf_power7 attribute_hidden;
-#undef __isinf
-#undef __isinff
-#undef __isinfl
-
-libc_ifunc_redirected (__redirect___isinf,  __isinf,
-       (hwcap & PPC_FEATURE_ARCH_2_06)
-       ? __isinf_power7
-       : __isinf_ppc32);
-
-weak_alias (__isinf, isinf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isinf, __isinfl)
-weak_alias (__isinf, isinfl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
-compat_symbol (libc, isinf, isinfl, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c
deleted file mode 100644
index 8299fda5fa..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* isinff().  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-
-#undef weak_alias
-#define weak_alias(a, b)
-
-#define __isinff __isinff_ppc32
-#ifdef SHARED
-# undef hidden_def
-# define hidden_def(a) \
-   __hidden_ver1 (__isinff_ppc32, __GI___isinff, __isinff_ppc32);
-#endif
-
-#include <sysdeps/ieee754/flt-32/s_isinff.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c
deleted file mode 100644
index 92f078a0db..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Multiple versions of isinf.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define __isinff __redirect___isinff
-#include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-extern __typeof (__isinff) __isinff_ppc32 attribute_hidden;
-/* The power7 isinf(double) works for float.  */
-extern __typeof (__isinff) __isinf_power7 attribute_hidden;
-#undef __isinff
-
-libc_ifunc_redirected (__redirect___isinff,  __isinff,
-       (hwcap & PPC_FEATURE_ARCH_2_06)
-       ? __isinf_power7
-       : __isinff_ppc32);
-
-weak_alias (__isinff, isinff)
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
deleted file mode 100644
index 9cd45eb428..0000000000
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
+++ /dev/null
@@ -1,85 +0,0 @@
-/* isinf().  PowerPC32/POWER7 version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
-   Contributed by Luis Machado <[hidden email]>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isinf(x)  */
- .section    .rodata.cst8,"aM",@progbits,8
- .align 3
-.LC0:   /* 1.0 */
- .quad    0x3ff0000000000000
-
- .section    ".text"
- .type    __isinf, @function
- .machine    power7
-ENTRY (__isinf)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
-
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfd fp0,.LC0-got_label@l(r9)
-
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfd fp0,.LC0@l(r9)
-#endif
- ftdiv cr7,fp1,fp0
- li r3,0
- bflr    29      /* If not INF, return.  */
-
- /* Either we have +INF or -INF.  */
-
- stwu    r1,-16(r1)    /* Allocate stack space.  */
- stfd    fp1,8(r1)     /* Transfer FP to GPR's.  */
- ori 2,2,0      /* Force a new dispatch group.  */
- lhz r4,8+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
-    (biased exponent and sign bit).  */
- addi r1,r1,16      /* Reset the stack pointer.  */
- cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0?  */
- li r3,1
- beqlr   cr7      /* EQ means INF, otherwise -INF.  */
- li      r3,-1
- blr
- END (__isinf)
-
-hidden_def (__isinf)
-weak_alias (__isinf, isinf)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isinf, __isinff)
-hidden_def (__isinff)
-weak_alias (__isinff, isinff)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isinf, __isinfl)
-weak_alias (__isinf, isinfl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
-compat_symbol (libc, isinf, isinfl, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S
deleted file mode 100644
index be759e091e..0000000000
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_isinf.S.  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index a0b5939abe..3a2051d97b 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -4,8 +4,6 @@ ifeq ($(subdir),math)
 # prefixed with  m_.
 sysdep_calls := s_finite-power8 s_finite-power7 s_finite-ppc64 \
  s_finitef-ppc64 \
- s_isinf-power8 s_isinf-ppc64 \
- s_isinff-ppc64 s_isinf-power7 \
  s_modf-power5+ s_modf-ppc64 \
  s_modff-power5+ s_modff-ppc64
 
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S
deleted file mode 100644
index 28aeba9e66..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* isinf().  PowerPC64/POWER7 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __isinf __isinf_power7
-
-#include <sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S
deleted file mode 100644
index e9ccdabc5b..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* isinf().  PowerPC64/POWER8 version.
-   Copyright (C) 2014-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __isinf __isinf_power8
-
-#include <sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c
deleted file mode 100644
index b919394512..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* isinf().  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-
-#undef weak_alias
-#define weak_alias(a, b)
-#undef strong_alias
-#define strong_alias(a, b)
-
-#define __isinf __isinf_ppc64
-#ifdef SHARED
-# undef hidden_def
-# define hidden_def(a) \
-   __hidden_ver1 (__isinf_ppc64, __GI___isinf, __isinf_ppc64);
-#endif
-
-#include <sysdeps/ieee754/dbl-64/s_isinf.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
deleted file mode 100644
index f5b9044473..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Multiple versions of isinf.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define __isinf __redirect___isinf
-
-/* The following definitions, although not related to the 'double'
-   version of 'isinf', are required to guarantee macro expansions
-   (e.g.: from __isinff to __redirect_isinff) in include/math.h, thus
-   compensating for the unintended macro expansions in
-   math/bits/mathcalls-helper-functions.h.  */
-#define __isinff __redirect___isinff
-#define __isinfl __redirect___isinfl
-#define __isinff128 __redirect___isinff128
-
-#include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-extern __typeof (__isinf) __isinf_ppc64 attribute_hidden;
-extern __typeof (__isinf) __isinf_power7 attribute_hidden;
-extern __typeof (__isinf) __isinf_power8 attribute_hidden;
-#undef __isinf
-#undef __isinff
-#undef __isinfl
-#undef __isinff128
-
-libc_ifunc_redirected (__redirect___isinf, __isinf,
-       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-       ? __isinf_power8
-       : (hwcap & PPC_FEATURE_ARCH_2_06)
- ? __isinf_power7
- : __isinf_ppc64);
-
-weak_alias (__isinf, isinf)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isinf, __isinfl)
-weak_alias (__isinf, isinfl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
-compat_symbol (libc, isinf, isinfl, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c
deleted file mode 100644
index ac5274b4c1..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* isinff().  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-
-#undef weak_alias
-#define weak_alias(a, b)
-
-#define __isinff __isinff_ppc64
-#ifdef SHARED
-# undef hidden_def
-# define hidden_def(a) \
-   __hidden_ver1 (__isinff_ppc64, __GI___isinff, __isinff_ppc64);
-#endif
-
-#include <sysdeps/ieee754/flt-32/s_isinff.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c
deleted file mode 100644
index 16feaee3b8..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Multiple versions of isinf.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define __isinff __redirect___isinff
-#include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-extern __typeof (__isinff) __isinff_ppc64 attribute_hidden;
-/* The double-precision version also works for single-precision.  */
-extern __typeof (__isinff) __isinf_power7 attribute_hidden;
-extern __typeof (__isinff) __isinf_power8 attribute_hidden;
-#undef __isinff
-
-libc_ifunc_redirected (__redirect___isinff, __isinff,
-       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-       ? __isinf_power8
-       : (hwcap & PPC_FEATURE_ARCH_2_06)
- ? __isinf_power7
- : __isinff_ppc64);
-
-weak_alias (__isinff, isinff)
diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
deleted file mode 100644
index aed9d74d35..0000000000
--- a/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
+++ /dev/null
@@ -1,69 +0,0 @@
-/* isinf().  PowerPC64/POWER7 version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
-   Contributed by Luis Machado <[hidden email]>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __isinf(x)  */
- .section    ".toc","aw"
-.LC0:   /* 1.0 */
- .tc    FD_ONE[TC],0x3ff0000000000000
- .section    ".text"
- .type    __isinf, @function
- .machine    power7
-ENTRY (__isinf, 4)
- CALL_MCOUNT 0
- lfd fp0,.LC0@toc(r2)
- ftdiv cr7,fp1,fp0
- li r3,0
- bflr    29      /* If not INF, return.  */
-
- /* Either we have -INF/+INF or a denormal.  */
-
- stfd    fp1,-16(r1)   /* Transfer FP to GPR's.  */
- ori 2,2,0      /* Force a new dispatch group.  */
- lhz r4,-16+HISHORT(r1)  /* Fetch the upper 16 bits of the FP value
-    (biased exponent and sign bit).  */
- cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0?  */
- li r3,1
- beqlr   cr7      /* EQ means INF, otherwise -INF.  */
- li      r3,-1
- blr
- END (__isinf)
-
-hidden_def (__isinf)
-weak_alias (__isinf, isinf)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isinf, __isinff)
-hidden_def (__isinff)
-weak_alias (__isinff, isinff)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isinf, __isinfl)
-weak_alias (__isinf, isinfl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
-compat_symbol (libc, isinf, isinfl, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S
deleted file mode 100644
index be759e091e..0000000000
--- a/sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_isinf.S.  */
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S
deleted file mode 100644
index 1fb2851a84..0000000000
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S
+++ /dev/null
@@ -1,61 +0,0 @@
-/* isinf().  PowerPC64/POWER8 version.
-   Copyright (C) 2014-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#define MFVSRD_R3_V1  .long 0x7c230066     /* mfvsrd  r3,vs1  */
-
-/* int [r3] __isinf([fp1] x)  */
-
-ENTRY_TOCLESS (__isinf, 4)
- CALL_MCOUNT 0
- MFVSRD_R3_V1
- lis     r9,0x7ff0     /* r9 = 0x7ff0  */
- rldicl  r10,r3,0,1    /* r10 = r3 & (0x8000000000000000)  */
- sldi    r9,r9,32      /* r9 = r9 << 52  */
- cmpd    cr7,r10,r9    /* fp1 & 0x7ff0000000000000 ?  */
- beq     cr7,L(inf)
- li      r3,0          /* Not inf  */
- blr
-L(inf):
- sradi   r3,r3,63      /* r3 = r3 >> 63  */
- ori     r3,r3,1       /* r3 = r3 | 0x1  */
- blr
-END (__isinf)
-
-hidden_def (__isinf)
-weak_alias (__isinf, isinf)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__isinf, __isinff)
-hidden_def (__isinff)
-weak_alias (__isinff, isinff)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__isinf, __isinfl)
-weak_alias (__isinf, isinfl)
-#endif
-
-#if !IS_IN (libm)
-# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
-compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
-compat_symbol (libc, isinf, isinfl, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S
deleted file mode 100644
index be759e091e..0000000000
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_isinf.S.  */
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 16/28] math: Use wordsize-64 version for finite

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
  - math.h will use compiler builtin for gcc 4.4+ when built without
    -fsignaling-nans and the builtin is expanded inline for all
    supported architectures.  As an example, there is no intra finite
    call on libm for the architecture I checked (x86, arm, aarch64,
    and powerpc).

  - The resulting binary difference on 32 bits architecture is minimum
    for the non hotspot symbol.

  - It helps wordsize-64 architectures that use ldbl-opt.

  - It add some code simplification with reduction of duplicated
    implementations.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c: Move to ...
        * sysdeps/ieee754/dbl-64/s_finite.c: ... here and format code.
---
 sysdeps/ieee754/dbl-64/s_finite.c             | 22 +++-------
 sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c | 43 -------------------
 2 files changed, 7 insertions(+), 58 deletions(-)
 delete mode 100644 sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c

diff --git a/sysdeps/ieee754/dbl-64/s_finite.c b/sysdeps/ieee754/dbl-64/s_finite.c
index da1519b1d0..98a40fbff6 100644
--- a/sysdeps/ieee754/dbl-64/s_finite.c
+++ b/sysdeps/ieee754/dbl-64/s_finite.c
@@ -1,4 +1,3 @@
-/* @(#)s_finite.c 5.1 93/09/24 */
 /*
  * ====================================================
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -10,10 +9,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $";
-#endif
-
 /*
  * finite(x) returns 1 is x is finite, else 0;
  * no branching!
@@ -23,18 +18,15 @@ static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $";
 #include <math_private.h>
 #include <ldbl-classify-compat.h>
 #include <shlib-compat.h>
+#include <stdint.h>
 
-#undef __finite
-
-#ifndef FINITE
-# define FINITE __finite
-#endif
-
-int FINITE(double x)
+int
+__finite (double x)
 {
-  int32_t hx;
-  GET_HIGH_WORD (hx, x);
-  return (int) ((uint32_t) ((hx & 0x7ff00000) - 0x7ff00000) >> 31);
+  int64_t lx;
+  EXTRACT_WORDS64 (lx,x);
+  return (int)((uint64_t)((lx & INT64_C(0x7ff0000000000000))
+  - INT64_C (0x7ff0000000000000)) >> 63);
 }
 hidden_def (__finite)
 weak_alias (__finite, finite)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
deleted file mode 100644
index 40676924fe..0000000000
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * finite(x) returns 1 is x is finite, else 0;
- * no branching!
- */
-
-#include <math.h>
-#include <math_private.h>
-#include <ldbl-classify-compat.h>
-#include <shlib-compat.h>
-#include <stdint.h>
-
-#undef __finite
-int
-__finite(double x)
-{
-  int64_t lx;
-  EXTRACT_WORDS64(lx,x);
-  return (int)((uint64_t)((lx&INT64_C(0x7ff0000000000000))-INT64_C(0x7ff0000000000000))>>63);
-}
-hidden_def (__finite)
-weak_alias (__finite, finite)
-#ifdef NO_LONG_DOUBLE
-# if LDBL_CLASSIFY_COMPAT
-#  if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
-compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
-#  endif
-#  if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_23)
-compat_symbol (libm, __finite, __finitel, GLIBC_2_1);
-#  endif
-# endif
-weak_alias (__finite, finitel)
-#endif
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 17/28] powerpc: Remove optimized finite

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
The powerpc finite optimization do not show much gain:

  - GCC will call libm iff -fsignaling-nans is used. This usage pattern
    is usually not performance oriented and for such calls PLT overhead
    should dominate execution time.

  - The power7 uses ftdiv to optimize for some input patterns, but at
    cost of others.  Comparing against generic C implementation built
    for powerpc64-linux-gnu-power7 (--with-cpu=power7):

    - Generic sysdeps/ieee754 implementation:
       "isfinite": {
        "": {
         "duration": 5.0082e+09,
         "iterations": 2.45299e+09,
         "max": 43.824,
         "min": 2.008,
         "mean": 2.04167
        },
        "INF": {
         "duration": 4.66554e+09,
         "iterations": 2.28288e+09,
         "max": 35.73,
         "min": 2.008,
         "mean": 2.04371
        },
        "NAN": {
         "duration": 4.66274e+09,
         "iterations": 2.28716e+09,
         "max": 34.161,
         "min": 2.009,
         "mean": 2.03866
        }
       }

    - power7 optimized one:
       "isfinite": {
        "": {
         "duration": 4.99111e+09,
         "iterations": 2.65566e+09,
         "max": 25.015,
         "min": 1.716,
         "mean": 1.87942
        },
        "INF": {
         "duration": 4.6783e+09,
         "iterations": 2.0999e+09,
         "max": 35.264,
         "min": 1.868,
         "mean": 2.22787
        },
        "NAN": {
         "duration": 4.67915e+09,
         "iterations": 2.08678e+09,
         "max": 38.099,
         "min": 1.869,
         "mean": 2.24228
        }
       }

     So it basically optimizes marginally for normal numbers while
     increasing the latency for other kind of FP.

  - The power8 implementation is just the generic implementation using
    ISA 2.07 mfvsrd instruction (which GCC uses for generic implementation).
    So generic implementation is the best option for powerpc64le.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
        (sysdeps_routines, libm-sysdep_routines): Remove s_finite*
        objects.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S:
        Remove file.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c: Likewise.
        * sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S: Likewise.
        * sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile usysdep_call):
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c: Likewise.
        * sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise.
        * sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S: Likewise.
        * sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise.
        * sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S: Likewise.
---
 .../powerpc32/power4/fpu/multiarch/Makefile   |  7 +-
 .../power4/fpu/multiarch/s_finite-power7.S    | 33 -------
 .../power4/fpu/multiarch/s_finite-ppc32.c     | 33 -------
 .../powerpc32/power4/fpu/multiarch/s_finite.c | 57 ------------
 .../power4/fpu/multiarch/s_finitef-ppc32.c    | 31 -------
 .../power4/fpu/multiarch/s_finitef.c          | 34 -------
 .../powerpc/powerpc32/power7/fpu/s_finite.S   | 93 -------------------
 .../powerpc/powerpc32/power7/fpu/s_finitef.S  |  1 -
 .../powerpc/powerpc64/fpu/multiarch/Makefile  |  4 +-
 .../powerpc64/fpu/multiarch/s_finite-power7.S | 32 -------
 .../powerpc64/fpu/multiarch/s_finite-power8.S | 32 -------
 .../powerpc64/fpu/multiarch/s_finite-ppc64.c  | 34 -------
 .../powerpc64/fpu/multiarch/s_finite.c        | 69 --------------
 .../powerpc64/fpu/multiarch/s_finitef-ppc64.c | 32 -------
 .../powerpc64/fpu/multiarch/s_finitef.c       | 37 --------
 .../powerpc/powerpc64/power7/fpu/s_finite.S   | 70 --------------
 .../powerpc/powerpc64/power7/fpu/s_finitef.S  |  1 -
 .../powerpc/powerpc64/power8/fpu/s_finite.S   | 56 -----------
 .../powerpc/powerpc64/power8/fpu/s_finitef.S  |  1 -
 19 files changed, 3 insertions(+), 654 deletions(-)
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S

diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
index c7b9d48094..51b13fe33a 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
@@ -1,13 +1,10 @@
 ifeq ($(subdir),math)
-sysdep_routines += s_finite-power7 \
-   s_finite-ppc32 s_finitef-ppc32 \
-   s_modf-power5+ s_modf-ppc32 \
+sysdep_routines += s_modf-power5+ s_modf-ppc32 \
    s_modff-power5+ s_modff-ppc32
 
 libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \
  s_llrint-ppc32 s_llround-power6 s_llround-power5+ \
- s_llround-ppc32 s_finite-power7 \
- s_finite-ppc32 s_finitef-ppc32 s_ceil-power5+ \
+ s_llround-ppc32 s_ceil-power5+ \
  s_ceil-ppc32 s_ceilf-power5+ s_ceilf-ppc32 \
  s_floor-power5+ s_floor-ppc32 s_floorf-power5+ \
  s_floorf-ppc32 s_round-power5+ s_round-ppc32 \
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S
deleted file mode 100644
index 0cde9f1cd1..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* finite().  PowerPC32/POWER7 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __finite __finite_power7
-
-#include <sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c
deleted file mode 100644
index c03a26e00f..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* finite().  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-
-#undef weak_alias
-#define weak_alias(a, b)
-#undef strong_alias
-#define strong_alias(a, b)
-
-#define FINITE __finite_ppc32
-#ifdef SHARED
-# undef hidden_def
-# define hidden_def(a) \
-   __hidden_ver1 (__finite_ppc32, __GI___finite, __finite_ppc32);
-#endif
-
-#include <sysdeps/ieee754/dbl-64/s_finite.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c
deleted file mode 100644
index 677b71baf3..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Multiple versions of finite.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define __finite __redirect___finite
-#define __finitef __redirect___finitef
-#define __finitel __redirect___finitel
-#include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-extern __typeof (__finite) __finite_ppc32 attribute_hidden;
-extern __typeof (__finite) __finite_power7 attribute_hidden;
-#undef __finite
-#undef __finitef
-#undef __finitel
-
-libc_ifunc_redirected (__redirect___finite,  __finite,
-       (hwcap & PPC_FEATURE_ARCH_2_06)
-       ? __finite_power7
-       : __finite_ppc32);
-
-weak_alias (__finite, finite)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__finite, __finitel)
-weak_alias (__finite, finitel)
-#endif
-
-#if IS_IN (libm)
-# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
-compat_symbol (libm, finite, finitel, GLIBC_2_0);
-# endif
-# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)
-compat_symbol (libm, __finite, __finitel, GLIBC_2_1);
-# endif
-#else
-# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
-compat_symbol (libc, finite, finitel, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c
deleted file mode 100644
index e43c7a54bc..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* finitef().  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-
-#undef weak_alias
-#define weak_alias(a, b)
-
-#define FINITEF __finitef_ppc32
-#ifdef SHARED
-# undef hidden_def
-# define hidden_def(a) \
-   __hidden_ver1 (__finitef_ppc32, __GI___finitef, __finitef_ppc32);
-#endif
-
-#include <sysdeps/ieee754/flt-32/s_finitef.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c
deleted file mode 100644
index da4780551e..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Multiple versions of finitef.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define __finitef __redirect___finitef
-#include <math.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-extern __typeof (__finitef) __finitef_ppc32 attribute_hidden;
-/* The power7 finite(double) works for float.  */
-extern __typeof (__finitef) __finite_power7 attribute_hidden;
-#undef __finitef
-
-libc_ifunc_redirected  (__redirect___finitef, __finitef,
- (hwcap & PPC_FEATURE_ARCH_2_06)
- ? __finite_power7
- : __finitef_ppc32);
-
-weak_alias (__finitef, finitef)
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
deleted file mode 100644
index 07fa8ae7b7..0000000000
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
+++ /dev/null
@@ -1,93 +0,0 @@
-/* finite().  PowerPC32/POWER7 version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
-   Contributed by Luis Machado <[hidden email]>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __finite(x)  */
- .section    .rodata.cst8,"aM",@progbits,8
- .align 3
-.LC0:   /* 1.0 */
- .quad    0x3ff0000000000000
-
- .section    ".text"
- .type    __finite, @function
- .machine    power7
-ENTRY (__finite)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
-
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfd fp0,.LC0-got_label@l(r9)
-
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfd fp0,.LC0@l(r9)
-#endif
- ftdiv cr7,fp1,fp0
- li r3,1
- bflr 30
-
- /* We have -INF/+INF/NaN or a denormal.  */
-
- stwu r1,-16(r1)    /* Allocate stack space.  */
- stfd    fp1,8(r1)     /* Transfer FP to GPR's.  */
-
- ori 2,2,0      /* Force a new dispatch group.  */
- lhz r0,8+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
-    (biased exponent and sign bit).  */
- clrlwi r0,r0,17      /* r0 = abs(r0).  */
- addi r1,r1,16      /* Reset the stack pointer.  */
- cmpwi cr7,r0,0x7ff0 /* r4 == 0x7ff0?.  */
- bltlr cr7      /* LT means we have a denormal.  */
- li r3,0
- blr
- END (__finite)
-
-hidden_def (__finite)
-weak_alias (__finite, finite)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__finite, __finitef)
-hidden_def (__finitef)
-weak_alias (__finitef, finitef)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__finite, __finitel)
-weak_alias (__finite, finitel)
-#endif
-
-#if IS_IN (libm)
-# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
-compat_symbol (libm, finite, finitel, GLIBC_2_0)
-# endif
-# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)
-compat_symbol (libm, __finite, __finitel, GLIBC_2_1)
-# endif
-#else
-# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
-compat_symbol (libc, finite, finitel, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S
deleted file mode 100644
index 54bd94176d..0000000000
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_finite.S.  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index 3a2051d97b..4aa7fd6295 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -2,9 +2,7 @@ ifeq ($(subdir),math)
 # These functions are built both for libc and libm because they're required
 # by printf.  While the libc objects have the prefix s_, the libm ones are
 # prefixed with  m_.
-sysdep_calls := s_finite-power8 s_finite-power7 s_finite-ppc64 \
- s_finitef-ppc64 \
- s_modf-power5+ s_modf-ppc64 \
+sysdep_calls := s_modf-power5+ s_modf-ppc64 \
  s_modff-power5+ s_modff-ppc64
 
 sysdep_routines += $(sysdep_calls)
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S
deleted file mode 100644
index c360c3a8db..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* isnan().  PowerPC64/POWER7 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, symbol, ver)
-
-#define __finite __finite_power7
-
-#include <sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S
deleted file mode 100644
index 8fa57e222e..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* isnan().  PowerPC64/POWER7 version.
-   Copyright (C) 2014-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, symbol, ver)
-
-#define __finite __finite_power8
-
-#include <sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c
deleted file mode 100644
index 59cc8ba168..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* finite().  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   Contributed by Luis Machado <[hidden email]>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-
-#undef weak_alias
-#define weak_alias(a, b)
-#undef strong_alias
-#define strong_alias(a, b)
-
-#define FINITE __finite_ppc64
-#ifdef SHARED
-# undef hidden_def
-# define hidden_def(a) \
-   __hidden_ver1 (__finite_ppc64, __GI___finite, __finite_ppc64);
-#endif
-
-#include <sysdeps/ieee754/dbl-64/s_finite.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
deleted file mode 100644
index 4f88a221cc..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Multiple versions of finite.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define __finite __redirect___finite
-
-/* The following definitions, although not related to the 'double'
-   version of 'finite', are required to guarantee macro expansions
-   (e.g.: from __finitef to __redirect_finitef) in include/math.h, thus
-   compensating for the unintended macro expansions in
-   math/bits/mathcalls-helper-functions.h.  */
-#define __finitef __redirect___finitef
-#define __finitel __redirect___finitel
-#define __finitef128 __redirect___finitef128
-
-#include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-extern __typeof (__finite) __finite_ppc64 attribute_hidden;
-extern __typeof (__finite) __finite_power7 attribute_hidden;
-extern __typeof (__finite) __finite_power8 attribute_hidden;
-#undef __finite
-#undef __finitef
-#undef __finitel
-#undef __finitef128
-
-libc_ifunc_redirected (__redirect___finite, __finite,
-       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-       ? __finite_power8
-       : (hwcap & PPC_FEATURE_ARCH_2_06)
- ? __finite_power7
- : __finite_ppc64);
-
-weak_alias (__finite, finite)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__finite, __finitel)
-weak_alias (__finite, finitel)
-#endif
-
-#if IS_IN (libm)
-# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
-compat_symbol (libm, finite, finitel, GLIBC_2_0);
-# endif
-# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)
-compat_symbol (libm, __finite, __finitel, GLIBC_2_1);
-# endif
-#else
-# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
-compat_symbol (libc, finite, finitel, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c
deleted file mode 100644
index 77af76d3ef..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* finitef().  PowerPC64 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   Contributed by Luis Machado <[hidden email]>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <math.h>
-
-#undef weak_alias
-#define weak_alias(a, b)
-
-#define FINITEF __finitef_ppc64
-#ifdef SHARED
-# undef hidden_def
-# define hidden_def(a) \
-   __hidden_ver1 (__finitef_ppc64, __GI___finitef, __finitef_ppc64);
-#endif
-
-#include <sysdeps/ieee754/flt-32/s_finitef.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c
deleted file mode 100644
index cde669e5e3..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Multiple versions of finitef.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#define __finitef __redirect___finitef
-#include <math.h>
-#include <shlib-compat.h>
-#include "init-arch.h"
-
-extern __typeof (__finitef) __finitef_ppc64 attribute_hidden;
-/* The double-precision version also works for single-precision.  */
-extern __typeof (__finitef) __finite_power7 attribute_hidden;
-extern __typeof (__finitef) __finite_power8 attribute_hidden;
-#undef __finitef
-
-libc_ifunc_redirected (__redirect___finitef, __finitef,
-       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-       ? __finite_power8
-       : (hwcap & PPC_FEATURE_ARCH_2_06)
- ? __finite_power7
- : __finitef_ppc64);
-
-weak_alias (__finitef, finitef)
diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
deleted file mode 100644
index 5b5746c9a5..0000000000
--- a/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
+++ /dev/null
@@ -1,70 +0,0 @@
-/* finite().  PowerPC64/POWER7 version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
-   Contributed by Luis Machado <[hidden email]>.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-/* int __finite(x)  */
- .section    ".toc","aw"
-.LC0:   /* 1.0 */
- .tc    FD_ONE[TC],0x3ff0000000000000
- .section    ".text"
- .type    __finite, @function
- .machine    power7
-ENTRY (__finite, 4)
- CALL_MCOUNT 0
- lfd     fp0,.LC0@toc(r2)
- ftdiv   cr7,fp1,fp0
- li r3,1
- bflr    30
-
- /* If we are here, we either have +/-INF,
- NaN or denormal.  */
-
- stfd    fp1,-16(r1)   /* Transfer FP to GPR's.  */
- ori 2,2,0      /* Force a new dispatch group.  */
- lhz     r4,-16+HISHORT(r1)  /* Fetch the upper 16 bits of the FP value
-    (biased exponent and sign bit).  */
- clrlwi  r4,r4,17      /* r4 = abs(r4).  */
- cmpwi   cr7,r4,0x7ff0 /* r4 == 0x7ff0?  */
- bltlr   cr7      /* LT means finite, other non-finite.  */
- li      r3,0
- blr
- END (__finite)
-
-hidden_def (__finite)
-weak_alias (__finite, finite)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__finite, __finitef)
-hidden_def (__finitef)
-weak_alias (__finitef, finitef)
-
-#if IS_IN (libm)
-# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
-compat_symbol (libm, __finite, __finitel, GLIBC_2_0)
-compat_symbol (libm, finite, finitel, GLIBC_2_0)
-# endif
-#else
-# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
-compat_symbol (libc, finite, finitel, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S
deleted file mode 100644
index 54bd94176d..0000000000
--- a/sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_finite.S.  */
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S
deleted file mode 100644
index f5316e898f..0000000000
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* isfinite().  PowerPC64/POWER8 version.
-   Copyright (C) 2014-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#define MFVSRD_R3_V1  .long 0x7c230066     /* mfvsrd  r3,vs1  */
-
-/* int [r3] __finite ([fp1] x)  */
-
-ENTRY_TOCLESS (__finite, 4)
- CALL_MCOUNT 0
- MFVSRD_R3_V1
- lis     r9,0x8010
- clrldi  r3,r3,1       /* r3 = r3 & 0x8000000000000000  */
- rldicr  r9,r9,32,31   /* r9 = (r9 << 32) & 0xffffffff  */
- add     r3,r3,r9
- rldicl  r3,r3,1,63
- blr
-END (__finite)
-
-hidden_def (__finite)
-weak_alias (__finite, finite)
-
-/* It turns out that the 'double' version will also always work for
-   single-precision.  */
-strong_alias (__finite, __finitef)
-hidden_def (__finitef)
-weak_alias (__finitef, finitef)
-
-#if IS_IN (libm)
-# if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
-compat_symbol (libm, __finite, __finitel, GLIBC_2_0)
-compat_symbol (libm, finite, finitel, GLIBC_2_0)
-# endif
-#else
-# if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
-compat_symbol (libc, finite, finitel, GLIBC_2_0);
-# endif
-#endif
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S
deleted file mode 100644
index 54bd94176d..0000000000
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S
+++ /dev/null
@@ -1 +0,0 @@
-/* This function uses the same code as s_finite.S.  */
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 18/28] powerpc: refactor powerpc64 lrint/lrintf/llrint/llrintf

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patches consolidates all the powerpc llrint{f} implementations on
the generic sysdeps/powerpc/fpu/s_llrint{f}.

The IFUNC support is also moved only to powerpc64 only, since for
powerpc64le generic implementation resulting in optimized code.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
        (libm-sysdep_routines): Add s_llrint-power8, s_llrint-power6x, and
        s_llrint-ppc64.
        (CFLAGS-s_llrint-power8.c, CFLAGS-s_llrint-power6x.c): New rule.
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c: New
        file.
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c:
        Likewise.
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_lrint.c: Move to ...
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c: ... here.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c: Move to ...
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint.c: ... here.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c: Move to ...
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrintf.c: ... here.
        * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c: New file.
        * sysdeps/powerpc/powerpc64/fpu/Makefile: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
        (libm-sysdep_routines): Remove s_llrint-* objects.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S: Remove
        file.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S:
        Likewise.
        * sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_llrint.c: New file.
        * sysdeps/powerpc/powerpc64/fpu/s_llrintf.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_lrint.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_lrintf.c: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Remove file.
        * sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise.
        * sysdeps/powerpc/powerpc64/fpu/s_lrint.S: Likewise.
        * sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise.
        * sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise.
---
 .../powerpc64/be/fpu/multiarch/Makefile       |  7 ++-
 .../be/fpu/multiarch/s_llrint-power6x.c       |  2 +
 .../be/fpu/multiarch/s_llrint-power8.c        |  2 +
 .../be/fpu/multiarch/s_llrint-ppc64.c         |  2 +
 .../{ => be}/fpu/multiarch/s_llrint.c         |  0
 .../{ => be}/fpu/multiarch/s_llrintf.c        |  0
 .../{ => be}/fpu/multiarch/s_lrint.c          |  0
 sysdeps/powerpc/powerpc64/fpu/Makefile        |  5 ++
 .../powerpc/powerpc64/fpu/multiarch/Makefile  |  3 +-
 .../fpu/multiarch/s_llrint-power6x.S          | 30 ----------
 .../powerpc64/fpu/multiarch/s_llrint-power8.S | 30 ----------
 .../powerpc64/fpu/multiarch/s_llrint-ppc64.S  | 30 ----------
 sysdeps/powerpc/powerpc64/fpu/s_llrint.S      | 45 ---------------
 sysdeps/powerpc/powerpc64/fpu/s_llrint.c      | 55 +++++++++++++++++++
 sysdeps/powerpc/powerpc64/fpu/s_llrintf.S     |  1 -
 sysdeps/powerpc/powerpc64/fpu/s_llrintf.c     |  1 +
 sysdeps/powerpc/powerpc64/fpu/s_lrint.S       |  1 -
 sysdeps/powerpc/powerpc64/fpu/s_lrint.c       |  1 +
 sysdeps/powerpc/powerpc64/fpu/s_lrintf.c      |  1 +
 .../powerpc/powerpc64/power6x/fpu/s_llrint.S  | 42 --------------
 .../powerpc/powerpc64/power8/fpu/s_llrint.S   | 43 ---------------
 21 files changed, 76 insertions(+), 225 deletions(-)
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c
 create mode 100644 sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llrint.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_llrintf.c (100%)
 rename sysdeps/powerpc/powerpc64/{ => be}/fpu/multiarch/s_lrint.c (100%)
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/Makefile
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrint.S
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrint.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrintf.S
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_llrintf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lrint.S
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lrint.c
 create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_lrintf.c
 delete mode 100644 sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S
 delete mode 100644 sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S

diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
index 53e600f5f6..febda6dbb3 100644
--- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
@@ -14,7 +14,10 @@ libm-sysdep_routines += s_ceil-power5+ \
  s_trunc-power5+ \
  s_trunc-ppc64 \
  s_truncf-power5+ \
- s_truncf-ppc64
+ s_truncf-ppc64 \
+ s_llrint-power8 \
+ s_llrint-power6x \
+ s_llrint-ppc64
 
 CFLAGS-s_ceil-power5+.c = -mcpu=power5+
 CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
@@ -24,4 +27,6 @@ CFLAGS-s_round-power5+.c = -mcpu=power5+
 CFLAGS-s_roundf-power5+.c = -mcpu=power5+
 CFLAGS-s_trunc-power5+.c = -mcpu=power5+
 CFLAGS-s_truncf-power5+.c = -mcpu=power5+
+CFLAGS-s_llrint-power8.c += -mcpu=power8
+CFLAGS-s_llrint-power6x.c += -mcpu=power6x
 endif
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c
new file mode 100644
index 0000000000..ee139b4045
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c
@@ -0,0 +1,2 @@
+#define __llrint __llrint_power6x
+#include <sysdeps/powerpc/powerpc64/fpu/s_llrint.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c
new file mode 100644
index 0000000000..0f5cbff69a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c
@@ -0,0 +1,2 @@
+#define __llrint __llrint_power8
+#include <sysdeps/powerpc/powerpc64/fpu/s_llrint.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c
new file mode 100644
index 0000000000..40f212716b
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c
@@ -0,0 +1,2 @@
+#define __llrint  __llrint_ppc64
+#include <sysdeps/powerpc/powerpc64/fpu/s_llrint.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint.c
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint.c
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrintf.c
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrintf.c
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_lrint.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_lrint.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c
diff --git a/sysdeps/powerpc/powerpc64/fpu/Makefile b/sysdeps/powerpc/powerpc64/fpu/Makefile
new file mode 100644
index 0000000000..6988a1d396
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/Makefile
@@ -0,0 +1,5 @@
+ifeq ($(subdir),math)
+# lrintf and llrintf are aliased to llrint, so suppress compiler builtins to
+# avoid mismatched signatures.
+CFLAGS-s_llrint.c += -fno-builtin-lrintf -fno-builtin-llrintf
+endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index 4aa7fd6295..fec878bb9d 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -8,12 +8,11 @@ sysdep_calls := s_modf-power5+ s_modf-ppc64 \
 sysdep_routines += $(sysdep_calls)
 libm-sysdep_routines += s_llround-power6x \
  s_llround-power5+ s_llround-ppc64 \
- s_llrint-power6x s_llrint-ppc64 \
  s_logb-power7 s_logbf-power7 \
  s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \
  s_logbl-ppc64 e_hypot-ppc64 \
  e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \
- s_llrint-power8 s_llround-power8 s_llroundf-ppc64 \
+ s_llround-power8 s_llroundf-ppc64 \
  e_expf-power8 e_expf-ppc64 \
  $(sysdep_calls:s_%=m_%)
 
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S
deleted file mode 100644
index 19f9dd2d80..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Round double to long int.  PowerPC64/POWER6X default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __llrint __llrint_power6x
-
-#include <sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S
deleted file mode 100644
index 93310e8662..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Round double to long int.  PowerPC64/POWER6X default version.
-   Copyright (C) 2014-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __llrint __llrint_power8
-
-#include <sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S
deleted file mode 100644
index 2811def336..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Round double to long int.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __llrint __llrint_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_llrint.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
deleted file mode 100644
index 2e0d4dfdd0..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Round double to long int.  PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
-/* long long int[r3] __llrint (double x[fp1])  */
-ENTRY_TOCLESS (__llrint)
- CALL_MCOUNT 0
- fctid fp13,fp1
- stfd fp13,-16(r1)
- nop /* Insure the following load is in a different dispatch group */
- nop /* to avoid pipe stall on POWER4&5.  */
- nop
- ld r3,-16(r1)
- blr
- END (__llrint)
-
-strong_alias (__llrint, __lrint)
-libm_alias_double (__llrint, llrint)
-libm_alias_double (__lrint, lrint)
-/* The double version also works for single-precision as both float and
-   double parameters are passed in 64bit FPRs and both versions are expected
-   to return [long] long type.  */
-strong_alias (__llrint, __llrintf)
-libm_alias_float (__llrint, llrint)
-strong_alias (__lrint, __lrintf)
-libm_alias_float (__lrint, lrint)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrint.c b/sysdeps/powerpc/powerpc64/fpu/s_llrint.c
new file mode 100644
index 0000000000..968b70b79d
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llrint.c
@@ -0,0 +1,55 @@
+/* Round to nearest integer.  PowerPC64 version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#define lrint __redirect_lrint
+#define lrintf __redirect_lrintf
+#define llrintf __redirect_llrintf
+#define __lrint __redirect___lrint
+#define __lrintf __redirect___lrintf
+#define __llrintf __redirect___llrintf
+#include <math.h>
+#undef lrint
+#undef lrintf
+#undef llrintf
+#undef __lrint
+#undef __lrintf
+#undef __llrintf
+#include <libm-alias-float.h>
+#include <libm-alias-double.h>
+
+long long int
+__llrint (double x)
+{
+  long int ret;
+  __asm__ ("fctid %0, %1" : "=d" (ret) : "d" (x));
+  return ret;
+}
+#ifndef __llrint
+strong_alias (__llrint, __lrint)
+libm_alias_double (__llrint, llrint)
+libm_alias_double (__lrint, lrint)
+
+/* The double version also works for single-precision as both float and
+   double parameters are passed in 64bit FPRs and both versions are expected
+   to return [long] long type.  */
+strong_alias (__llrint, __llrintf)
+libm_alias_float (__llrint, llrint)
+strong_alias (__lrint, __lrintf)
+libm_alias_float (__lrint, lrint)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S
deleted file mode 100644
index ba7752311d..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* __llrintf is in s_llrint.S.  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c
new file mode 100644
index 0000000000..fd8ce33620
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.c
@@ -0,0 +1 @@
+/* llrintf is implemented at s_llrint.c  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrint.S b/sysdeps/powerpc/powerpc64/fpu/s_lrint.S
deleted file mode 100644
index d3c2fff581..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_lrint.S
+++ /dev/null
@@ -1 +0,0 @@
-/* __lrint is in s_llrint.c  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrint.c b/sysdeps/powerpc/powerpc64/fpu/s_lrint.c
new file mode 100644
index 0000000000..4e48d8ca00
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_lrint.c
@@ -0,0 +1 @@
+/* lrint is implemented at s_llrint.c  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrintf.c b/sysdeps/powerpc/powerpc64/fpu/s_lrintf.c
new file mode 100644
index 0000000000..3f0c570a91
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_lrintf.c
@@ -0,0 +1 @@
+/* lrintf is implemented at s_llrint.c  */
diff --git a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S
deleted file mode 100644
index edf3974c77..0000000000
--- a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Round double to long int.  POWER6x PowerPC64 version.
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
- .machine "power6"
-/* long long int[r3] __llrint (double x[fp1])  */
-ENTRY_TOCLESS (__llrint)
- CALL_MCOUNT 0
- fctid fp13,fp1
- mftgpr  r3,fp13
- blr
- END (__llrint)
-
-strong_alias (__llrint, __lrint)
-libm_alias_double (__llrint, llrint)
-libm_alias_double (__lrint, lrint)
-/* The double version also works for single-precision as both float and
-   double parameters are passed in 64bit FPRs and both versions are expected
-   to return [long] long type.  */
-strong_alias (__llrint, __llrintf)
-libm_alias_float (__llrint, llrint)
-strong_alias (__lrint, __lrintf)
-libm_alias_float (__lrint, lrint)
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S
deleted file mode 100644
index dbd3ab89d6..0000000000
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Round double to long int.  POWER8 PowerPC64 version.
-   Copyright (C) 2014-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
-#define MFVSRD_R3_V1  .long 0x7c230066     /* mfvsrd  r3,vs1  */
-
-/* long long int[r3] __llrint (double x[fp1])  */
-ENTRY_TOCLESS (__llrint)
- CALL_MCOUNT 0
- fctid fp1,fp1
- MFVSRD_R3_V1
- blr
-END (__llrint)
-
-strong_alias (__llrint, __lrint)
-libm_alias_double (__llrint, llrint)
-libm_alias_double (__lrint, lrint)
-/* The double version also works for single-precision as both float and
-   double parameters are passed in 64bit FPRs and both versions are expected
-   to return [long] long type.  */
-strong_alias (__llrint, __llrintf)
-libm_alias_float (__llrint, llrint)
-strong_alias (__lrint, __lrintf)
-libm_alias_float (__lrint, lrint)
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 19/28] powerpc: Refactor powerpc32 lrint/lrintf/llrint/llrintf

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patches consolidates all the powerpc llrint{f} implementations on
the generic sysdeps/powerpc/powerpc32/fpu/s_llrint{f}.  The only missing
optimization is the power6x one which I could not make GCC generates
mftgpr for 32 bits output.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/powerpc/fpu/s_lrintf.S: Remove file.
        * sysdeps/powerpc/powerpc64/fpu/s_lrintf.c: Move to ...
        * sysdeps/powerpc/fpu/s_lrintf.c: ... here.
        * sysdeps/powerpc/powerpc32/fpu/Makefile
        [$(subdir) == math] (CFLAGS-s_lrint.c): New rule.
        * sysdeps/powerpc/powerpc32/fpu/s_llrint.c (__llrint): Add power4
        optimization.
        * sysdeps/powerpc/powerpc32/fpu/s_llrintf.c (__llrintf): Likewise.
        * sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Remove file.
        * sysdeps/powerpc/powerpc32/fpu/s_lrint.c: New file.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
        (CFLAGS-s_llrintf-power6.c, CFLAGS-s_llrintf-ppc32.c,
        CFLAGS-s_llrint-power6.c, CFLAGS-s_llrint-ppc32.c,
        CFLAGS-s_lrint-ppc32.c): New rule.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S:
        Remove file.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Likewise.
        * sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Likewise.
        * sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c:
        New file.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c:
        Likewise.
        * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c:
        Likewise.
---
 sysdeps/powerpc/fpu/s_lrintf.S                |  1 -
 .../powerpc/{powerpc64 => }/fpu/s_lrintf.c    |  0
 sysdeps/powerpc/powerpc32/fpu/Makefile        |  6 +++
 sysdeps/powerpc/powerpc32/fpu/s_llrint.c      |  9 +++++
 sysdeps/powerpc/powerpc32/fpu/s_llrintf.c     |  7 ++++
 sysdeps/powerpc/powerpc32/fpu/s_lrint.S       | 40 -------------------
 sysdeps/powerpc/powerpc32/fpu/s_lrint.c       | 40 +++++++++++++++++++
 .../powerpc32/power4/fpu/multiarch/Makefile   |  5 +++
 .../power4/fpu/multiarch/s_llrint-power6.S    | 31 --------------
 .../power4/fpu/multiarch/s_llrint-power6.c    |  2 +
 .../power4/fpu/multiarch/s_llrint-ppc32.S     | 31 --------------
 .../power4/fpu/multiarch/s_llrint-ppc32.c     |  2 +
 .../power4/fpu/multiarch/s_llrintf-power6.S   | 26 ------------
 .../power4/fpu/multiarch/s_llrintf-power6.c   |  2 +
 .../power4/fpu/multiarch/s_llrintf-ppc32.S    | 26 ------------
 .../power4/fpu/multiarch/s_llrintf-ppc32.c    |  2 +
 .../power4/fpu/multiarch/s_lrint-ppc32.S      | 31 --------------
 .../power4/fpu/multiarch/s_lrint-ppc32.c      |  2 +
 .../powerpc/powerpc32/power4/fpu/s_llrint.S   | 39 ------------------
 .../powerpc/powerpc32/power4/fpu/s_llrintf.S  | 39 ------------------
 .../powerpc/powerpc32/power6/fpu/s_llrint.S   | 39 ------------------
 .../powerpc/powerpc32/power6/fpu/s_llrintf.S  | 39 ------------------
 22 files changed, 77 insertions(+), 342 deletions(-)
 delete mode 100644 sysdeps/powerpc/fpu/s_lrintf.S
 rename sysdeps/powerpc/{powerpc64 => }/fpu/s_lrintf.c (100%)
 delete mode 100644 sysdeps/powerpc/powerpc32/fpu/s_lrint.S
 create mode 100644 sysdeps/powerpc/powerpc32/fpu/s_lrint.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S
 create mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S
 delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S

diff --git a/sysdeps/powerpc/fpu/s_lrintf.S b/sysdeps/powerpc/fpu/s_lrintf.S
deleted file mode 100644
index e24766535f..0000000000
--- a/sysdeps/powerpc/fpu/s_lrintf.S
+++ /dev/null
@@ -1 +0,0 @@
-/* __lrintf is in s_lrint.c  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_lrintf.c b/sysdeps/powerpc/fpu/s_lrintf.c
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/s_lrintf.c
rename to sysdeps/powerpc/fpu/s_lrintf.c
diff --git a/sysdeps/powerpc/powerpc32/fpu/Makefile b/sysdeps/powerpc/powerpc32/fpu/Makefile
index e05073970d..c79b192f60 100644
--- a/sysdeps/powerpc/powerpc32/fpu/Makefile
+++ b/sysdeps/powerpc/powerpc32/fpu/Makefile
@@ -1,3 +1,9 @@
+ifeq ($(subdir),math)
+# lrint is aliased to lrintf, so suppress compiler builtins to
+# avoid mismatched signatures.
+CFLAGS-s_lrint.c += -fno-builtin-lrintf
+endif
+
 ifeq ($(subdir),misc)
 sysdep_routines += fprsave fprrest
 endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_llrint.c b/sysdeps/powerpc/powerpc32/fpu/s_llrint.c
index 7e91d606c2..42558efd46 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_llrint.c
+++ b/sysdeps/powerpc/powerpc32/fpu/s_llrint.c
@@ -26,6 +26,12 @@
 long long int
 __llrint (double x)
 {
+#ifdef _ARCH_PWR4
+  /* Assume powerpc64 instructions availability.  */
+  long long int ret;
+  __asm__ ("fctid %0, %1" : "=d" (ret) : "d" (x));
+  return ret;
+#else
   double rx = rint (x);
   if (HAVE_PPC_FCTIDZ || rx != x)
     return (long long int) rx;
@@ -53,5 +59,8 @@ __llrint (double x)
       else
  return (long long int) (long int) rx << 32;
     }
+#endif
 }
+#ifndef __llrint
 libm_alias_double (__llrint, llrint)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c b/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
index 021a86fada..b75655e2c1 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
+++ b/sysdeps/powerpc/powerpc32/fpu/s_llrintf.c
@@ -24,6 +24,12 @@
 long long int
 __llrintf (float x)
 {
+#ifdef _ARCH_PWR4
+  /* Assume powerpc64 instructions availability.  */
+  long long int ret;
+  __asm__ ("fctid %0, %1" : "=d" (ret) : "d" (x));
+  return ret;
+#else
   float rx = rintf (x);
   if (HAVE_PPC_FCTIDZ || rx != x)
     return (long long int) rx;
@@ -43,5 +49,6 @@ __llrintf (float x)
       mant <<= exponent - 23;
       return (long long int) ((i0 & 0x80000000) != 0 ? -mant : mant);
     }
+#endif
 }
 libm_alias_float (__llrint, llrint)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lrint.S b/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
deleted file mode 100644
index fdad180116..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Round double to long int.  PowerPC32 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
-/* long int[r3] __lrint (double x[fp1])  */
-ENTRY (__lrint)
- stwu r1,-16(r1)
- fctiw fp13,fp1
- stfd fp13,8(r1)
- nop /* Ensure the following load is in a different dispatch group */
- nop /* to avoid pipe stall on POWER4&5.  */
- nop
- lwz r3,8+LOWORD(r1)
- addi r1,r1,16
- blr
- END (__lrint)
-
-libm_alias_double (__lrint, lrint)
-
-strong_alias (__lrint, __lrintf)
-libm_alias_float (__lrint, lrint)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lrint.c b/sysdeps/powerpc/powerpc32/fpu/s_lrint.c
new file mode 100644
index 0000000000..21bdc5c063
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_lrint.c
@@ -0,0 +1,40 @@
+/* Round to nearest integer.  PowerPC32 version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#define lrintf __redirect_lrintf
+#define __lrintf __redirect___lrintf
+#include <math.h>
+#undef lrintf
+#undef __lrintf
+#include <fenv_private.h>
+#include <libm-alias-double.h>
+#include <libm-alias-float.h>
+
+long int
+__lrint (double x)
+{
+  long long int ret;
+  __asm__ ("fctiw %0, %1" : "=d" (ret) : "d" (x));
+  return ret;
+}
+#ifndef __lrint
+libm_alias_double (__lrint, lrint)
+strong_alias (__lrint, __lrintf)
+libm_alias_float (__lrint, lrint)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
index 51b13fe33a..d33d403a1b 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
@@ -18,6 +18,11 @@ libm-sysdep_routines += s_llrintf-power6 s_llrintf-ppc32 s_llrint-power6 \
  s_logbf-power7 s_logbf-ppc32 e_hypot-power7 \
  e_hypot-ppc32 e_hypotf-power7 e_hypotf-ppc32
 
+CFLAGS-s_llrintf-power6.c += -mcpu=power6
+CFLAGS-s_llrintf-ppc32.c += -mcpu=power4
+CFLAGS-s_llrint-power6.c += -mcpu=power6
+CFLAGS-s_llrint-ppc32.c += -mcpu=power4
+CFLAGS-s_lrint-ppc32.c += -mcpu=power4
 CFLAGS-s_ceil-power5+.c = -mcpu=power5+
 CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
 CFLAGS-s_modf-power5+.c = -mcpu=power5+
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S
deleted file mode 100644
index 253a12bf72..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Round double to long int.  PowerPC32/Power6.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __llrint __llrint_power6
-
-#include <sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c
new file mode 100644
index 0000000000..328e11844f
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c
@@ -0,0 +1,2 @@
+#define __llrint __llrint_power6
+#include <sysdeps/powerpc/powerpc32/fpu/s_llrint.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S
deleted file mode 100644
index e7bf6760c1..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* llrint function.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __llrint __llrint_ppc32
-
-#include <sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c
new file mode 100644
index 0000000000..8f192ab990
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c
@@ -0,0 +1,2 @@
+#define __llrint __llrint_ppc32
+#include <sysdeps/powerpc/powerpc32/fpu/s_llrint.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S
deleted file mode 100644
index c6b7769457..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Round float to long int.  PowerPC32/POWER6 version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __llrintf __llrintf_power6
-
-#include <sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c
new file mode 100644
index 0000000000..5b1a5a8cf0
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c
@@ -0,0 +1,2 @@
+#define __llrintf __llrintf_power6
+#include <sysdeps/powerpc/powerpc32/fpu/s_llrintf.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S
deleted file mode 100644
index c592b31aff..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/* llrintf function.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __llrintf __llrintf_ppc32
-
-#include <sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c
new file mode 100644
index 0000000000..061962b84d
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c
@@ -0,0 +1,2 @@
+#define __llrintf __llrintf_ppc32
+#include <sysdeps/powerpc/powerpc32/fpu/s_llrintf.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S
deleted file mode 100644
index 617a9a7b8d..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Round double to long int.  PowerPC32 default version.
-   Copyright (C) 2013-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __lrint __lrint_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_lrint.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c
new file mode 100644
index 0000000000..ce2764b61b
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c
@@ -0,0 +1,2 @@
+#define __lrint __lrint_ppc32
+#include <sysdeps/powerpc/powerpc32/fpu/s_lrint.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S b/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S
deleted file mode 100644
index 3fdb5c3fe3..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Round double to long int.  PowerPC32 on PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
-/* long long int[r3, r4] __llrint (double x[fp1])  */
-ENTRY (__llrint)
- CALL_MCOUNT
- stwu r1,-16(r1)
- cfi_adjust_cfa_offset (16)
- fctid fp13,fp1
- stfd fp13,8(r1)
- nop /* Insure the following load is in a different dispatch group */
- nop /* to avoid pipe stall on POWER4&5.  */
- nop
- lwz r3,8+HIWORD(r1)
- lwz r4,8+LOWORD(r1)
- addi r1,r1,16
- blr
- END (__llrint)
-
-libm_alias_double (__llrint, llrint)
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S
deleted file mode 100644
index 3a6364241e..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Round float to long int.  PowerPC32 on PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
-/* long long int[r3, r4] __llrintf (float x[fp1])  */
-ENTRY (__llrintf)
- CALL_MCOUNT
- stwu r1,-16(r1)
- cfi_adjust_cfa_offset (16)
- fctid fp13,fp1
- stfd fp13,8(r1)
- nop /* Insure the following load is in a different dispatch group */
- nop /* to avoid pipe stall on POWER4&5.  */
- nop
- lwz r3,8+HIWORD(r1)
- lwz r4,8+LOWORD(r1)
- addi r1,r1,16
- blr
- END (__llrintf)
-
-libm_alias_float (__llrint, llrint)
-
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S
deleted file mode 100644
index e8134f7451..0000000000
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Round double to long int.  PowerPC32 on PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-double.h>
-
-/* long long int[r3, r4] __llrint (double x[fp1])  */
-ENTRY (__llrint)
- CALL_MCOUNT
- stwu r1,-16(r1)
- cfi_adjust_cfa_offset (16)
- fctid fp13,fp1
- stfd fp13,8(r1)
-/* Insure the following load is in a different dispatch group by
-   inserting "group ending nop".  */
- ori r1,r1,0
- lwz r3,8+HIWORD(r1)
- lwz r4,8+LOWORD(r1)
- addi r1,r1,16
- blr
- END (__llrint)
-
-libm_alias_double (__llrint, llrint)
diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S
deleted file mode 100644
index b4d013f7a3..0000000000
--- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Round float to long int.  PowerPC32 on PowerPC64 version.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <libm-alias-float.h>
-
-/* long long int[r3, r4] __llrintf (float x[fp1])  */
-ENTRY (__llrintf)
- CALL_MCOUNT
- stwu r1,-16(r1)
- cfi_adjust_cfa_offset (16)
- fctid fp13,fp1
- stfd fp13,8(r1)
-/* Insure the following load is in a different dispatch group by
-   inserting "group ending nop".  */
- ori r1,r1,0
- lwz r3,8+HIWORD(r1)
- lwz r4,8+LOWORD(r1)
- addi r1,r1,16
- blr
- END (__llrintf)
-
-libm_alias_float (__llrint, llrint)
-
--
2.17.1

123